Visio 2013

 Copy code hover
[image]

Visio 2013
Send feedback

Published: March 5, 2013

Visio product logo

Use Visio 2013 to create custom drawing solutions.

Explore Visio 2013 developer resources

New features and scenarios

New features

What's new for Visio 2013 developers

How to: Manipulate the Visio file format programmatically

What's new for ShapeSheet developers in Visio 2013

Get started

Get started

Introduction to the Visio 2013 file format (.vsdx)

References

Reference

Visio 2013 Automation reference

Visio 2013 ShapeSheet reference

Visio 2013 File Format reference

Visio 2013 Save As Web reference

Visio 2013 Viewer reference

Find training and other resources about Office

Email us to suggest content Subscribe to the Office developer RSS Read Office developer blogs Read Office developer forums Visit MSDN Office and SharePoint on Facebook Follow @MSDN_Office on Twitter

Download

Office updates

Office 365

Office code samples

Office scripts and sample files

Office downloads

Office 365 downloads

How To

Train Office 2010 end users

Office developer videos

Office IT pro training

Office IT pro videos

Sites

Office 365 IT pros

Office 2013 Resource Kit

SharePoint developers

SharePoint IT pros

Office.com

Microsoft.com: Office 365

Additional resources

  • Access 2013

  • Excel 2013

  • InfoPath 2013

  • Office 2013

  • OneNote 2013

  • Outlook 2013

  • PowerPoint 2013

  • Project 2013

  • Publisher 2013

  • SharePoint 2013

  • Word 2013

© 2013 Microsoft Corporation. All rights reserved.


What's new for Visio 2013 developers

 Copy code hover
[image]

What's new for Visio 2013 developers
Send feedback

Published: July 16, 2012

This document provides a top-level view of the enhancements and additions for developers in Visio 2013. For developers who are ready to get a jump start on the Visio platform, it provides you with sufficient detail to begin coding against Visio 2013.

In this article
Introduction
New file format
Themes
Change shape
Shape effects
Commenting
Coauthoring
Customizable image clipping
Relative geometries
Support for Business Connectivity Services (BCS) data
Improvements in Visio Services
Duplicate page
Visio object model changes
Additional resources

Introduction

Visio 2013 provides a powerful single platform for your custom drawing solutions. New objects, collections, properties, methods, enumerations, and events, along with new ShapeSheet cells and functions, give you more options for defining the behavior of the elements in your solutions.

Among the new features of interest to developers in Visio 2013 are the new file format; robust updates to themes; change shape feature (allowing you to replace shapes with another); new shape effects; improvements to commenting; coauthoring on SharePoint Server 2013; customizable image clipping; relative geometry; support for Business Connectivity Services (BCS) data; updates to Visio Services in Microsoft SharePoint Server 2013; and a duplicate page feature. This topic gives a brief summary of each of these features and mentions some of the new Visio objects and members that are associated with the features and exposed in Visual Basic for Applications (VBA). For information about these features and accompanying code samples, see the Visio Developer Center.

Note Note

Visio 2013 includes many new ShapeSheet cells, rows, and functions to support the new features in Visio. For more information about what's new in the ShapeSheet for Visio 2013, see the article What's new for ShapeSheet developers in Visio 2013.

New file format

Visio 2013 introduces a new file format, based on the Open Packaging Conventions (OPC) standard (ISO 29500, Part 2) and the XML elements from the previous Visio XML file format (.vdx). It is a zipped, XML-based file format similar to the file formats used in other applications.

Because the new file format is supported by both Visio 2013 and Visio Services in Microsoft SharePoint Server 2013, you can save a Visio drawing directly to an SharePoint Server library, without having to publish the file as a Visio Web Drawing (.vdw). Even so, Visio Services can still read and display Visio Web Drawing files.

The new file format includes the following file types (by extension):

  • .vsdx (Visio drawing)

  • .vsdm (Visio macro-enabled drawing)

  • .vssx (Visio stencil)

  • .vssm (Visio macro-enabled stencil)

  • .vstx (Visio template)

  • .vstm (Visio macro-enabled template)

By using existing support for reading and writing to the file format package (such as System.IO.Packaging) and for parsing XML (System.Xml.Linq), you can programmatically work with the new file formats.

Visio 2013 retains the ability to read the old file formats (.vsd, .vss, .vst, .vdx, .vsx, .vtx, .vdw, .vwi). Visio 2013 does not save to the previous Visio XML file format (.vdx). Solutions or tools that consume the previous Visio XML file format (.vdx) files may need to be refactored in order to read the new file format and its schemas.

Visio Services retains the ability to display the Visio Web Drawing (.vdw) format in the browser. It now also renders the new Visio drawing (.vsdx) and Visio macro-enabled drawing (.vsdm) formats.

Themes

Themes have been redesigned in Visio 2013, making use of a greater variety of effects and styles including the integration of Shape Art effects. Users can now decide on an overarching style by applying a theme, personalize the diagram with theme variants, and highlight individual shapes with Quick Styles. ShapeSheet developers can take advantage of these features with new functions and cells in the ShapeSheet.

You can also manipulate themes at the Page, Shape, and Selection object level. New APIs for working with themes include Page.SetTheme method, Page.SetThemeVariant method, Shape.SetQuickStyle method, and the Selection.SetQuickStyle method.

For a detailed list of the new APIs in Visio 2013, see the Visio object model changes section in this article. For more information about the new ShapeSheet cells in Visio 2013, see the article What's new for ShapeSheet developers in Visio 2013.

Change shape

Visio 2013 includes a shape replacement API that enables you to swap one or more shapes for another shape contained in a stencil, while retaining some of the local values from the original shape, like the shape text shape, shape data, or shape formatting. Shape developers can update the ShapeSheet settings of their custom shapes to specify the Change Shape behavior for their shapes. Among the new APIs are the Shape.ReplaceShapes and Selection.ReplaceShapes methods and the ReplaceShape event.

For a detailed list of the new APIs in Visio 2013, see the Visio object model changes section in this article. For more information about the new ShapeSheet cells in Visio 2013, see the article What's new for ShapeSheet developers in Visio 2013.

Shape effects

New shape effects such as bevel, 3-D rotation, glow, reflection, and sketching have been added to Visio 2013. The ShapeSheet includes new cells for working with these affects.

For more information about the new ShapeSheet cells in Visio 2013, see the article What's new for ShapeSheet developers in Visio 2013.

Commenting

Visio 2013 includes a new commenting framework. Comments can now be associated with a particular shape or page. Visio 2013 includes two new objects, Comments and Comment. New APIs for accessing comments programmatically include the Document.Comments, Page.Comments, Shape.Comments, and Page.ShapeComments properties.

Visio Services includes JavaScript APIs to read the comments from a page or shape in a diagram.

For a detailed list of the new APIs in Visio 2013, see the Visio object model changes section in this article.

Note Note

Comments are no longer accessible through the ShapeSheet.

Coauthoring

Visio 2013 includes the ability to co-author diagrams stored on SharePoint or Windows Live SkyDrive. Developers have access to the Document.AfterDocumentMerge event which provides information about diagram changes due to coauthoring. Solution developers also have the ability to disable coauthoring to suit their custom needs using the NoCoauth cell on the Document ShapeSheet.

For a detailed list of the new APIs in Visio 2013, see the Visio object model changes section in this article.

Customizable image clipping

Visio 2013 supports defining a Custom Image Clipping path to crop images to any shape. This extends the capacities of Visio 2010, which supported clipping images in a rectangular way. This functionality is available in the ShapeSheet by using the ClippingPath cell in the Foreign Image Info section.

For more information about the new ShapeSheet cells in Visio 2013, see the article What's new for ShapeSheet developers in Visio 2013.

Relative geometries

In previous versions of Visio, shape geometry was defined by formulas that depended on the height or width of the shape. For example, in Visio 2010 the vertices of many built-in Visio shapes were defined by multiplying the height or width of the shape by a constant. These shapes had Geometry sections that included MoveTo or LineTo rows (for example) with formulas like Width*1 and Height*0.

Visio 2013 now supports relative geometry in the ShapeSheet. Shape developers can now use relative geometries to specify geometries as simple values or formulas, which multiply by the height or width automatically. Shape vertices can now be expressed with constants, for instance, removing the need to express vertices as multiples of the shape width or height. This makes it easier for developers to create shapes, with better performance and smaller file sizes. New rows include the RelMoveTo and RelLineTo rows where the X and Y cell values are automatically multiplied by the width or height of the shape (respectively).

For more information about the new ShapeSheet rows in Visio 2013, see the article What's new for ShapeSheet developers in Visio 2013.

Support for Business Connectivity Services (BCS) data

Visio 2013 diagrams can now be connected to external lists on SharePoint Server 2013 servers. An external list is a content source external to SharePoint (for example, a SQL Server table) that has been connected to a SharePoint list by using Microsoft Business Connectivity Services (BCS). Visio Services supports the ability to refresh the Visio diagrams as the data updates.

For more information about what's new in Visio Services, see the article Visio Services in SharePoint 2013. For more information about Business Connectivity Services (BCS), see Business Connectivity Services in SharePoint 2013.

Improvements in Visio Services

Visio Services in Microsoft SharePoint Server 2013 includes many improvements. As mentioned previously, Visio Services supports the new Visio file format (both .vsdx and .vsdm). Visio Services has expanded data refresh and recalculation, including the ability to recalculate formulas across an entire diagram.

For more information about what's new in Visio Services, see the article Visio Services in SharePoint 2013.

Duplicate page

You can now copy a page and all of its shapes within the same document in Visio 2013. Accordingly, the Page object has a new method, Duplicate, which duplicates the page and returns a new Page object.

Visio object model changes

New objects, properties, methods, and events have been added to the Visio object model to provide programmability support for new Visio 2013 features. Additionally, object model improvements address frequent developer requests for changes to the Visio platform.

New members

The following members have been added to existing objects in the Visio object model.

Table 1. Visio object model enhancements

Object or collection | New members
Application Object (Visio) | Application.AfterReplaceShapes Event (Visio)
 | Application.BeforeReplaceShapes Event (Visio)
 | Application.QueryCancelReplaceShapes Event (Visio)
 | Application.ReplaceShapesCanceled Event (Visio)
ApplicationSettings Object (Visio) | ApplicationSettings.EnterCommitsText Property (Visio)
 | ApplicationSettings.SVGExportFormat Property (Visio)
Document Object (Visio) | Document.AfterDocumentMerge Event (Visio)
 | Document.Comments Property (Visio)
 | Document.CompatibilityMode Property (Visio)
Documents Object (Visio) | Documents.AfterDocumentMerge Event (Visio)
 | Documents.AfterReplaceShapes Event (Visio)
 | Documents.BeforeReplaceShapes Event (Visio)
 | Documents.QueryCancelReplaceShapes Event (Visio)
 | Documents.ReplaceShapesCanceled Event (Visio)
InvisibleApp Object (Visio) | InvisibleApp.AfterReplaceShapes Event (Visio)
 | InvisibleApp.BeforeReplaceShapes Event (Visio)
 | InvisibleApp.QueryCancelReplaceShapes Event (Visio)
 | InvisibleApp.ReplaceShapesCanceled Event (Visio)
Page Object (Visio) | Page.AfterReplaceShapes Event (Visio)
 | Page.BeforeReplaceShapes Event (Visio)
 | Page.Comments Property (Visio)
 | Page.Duplicate Method (Visio)
 | Page.GetTheme Method (Visio)
 | Page.GetThemeVariant Method (Visio)
 | Page.QueryCancelReplaceShapes Event (Visio)
 | Page.ReplaceShapesCanceled Event (Visio)
 | Page.SetTheme Method (Visio)
 | Page.SetThemeVariant Method (Visio)
 | Page.ShapeComments Property (Visio)
Pages Object (Visio) | Pages.AfterReplaceShapes Event (Visio)
 | Pages.BeforeReplaceShapes Event (Visio)
 | Pages.QueryCancelReplaceShapes Event (Visio)
 | Pages.ReplaceShapesCanceled Event (Visio)
Selection Object (Visio) | Selection.ReplaceShape Method (Visio)
 | Selection.SetQuickStyle Method (Visio)
Shape Object (Visio) | Shape.ChangePicture Method (Visio)
 | Shape.Comments Property (Visio)
 | Shape.ReplaceShape Method (Visio)
 | Shape.SetQuickStyle Method (Visio)

New objects and enumerations

The following objects have been added to the Visio object model.

Table 2. Visio object model additions

Object | Properties | Methods
CoauthMergeEvent Object (Visio) | CoauthMergeEvent.BaseDocument Property (Visio) CoauthMergeEvent.DownloadDocument Property (Visio) CoauthMergeEvent.ObjectType Property (Visio) CoauthMergeEvent.Stat Property (Visio) CoauthMergeEvent.WorkingDocument Property (Visio) | None
Comment Object (Visio) | Comment.AssociatedObject Property (Visio) Comment.AuthorInitials Property (Visio) Comment.AuthorName Property (Visio) Comment.AuthorSipAddress Property (Visio) Comment.AuthorSMTPAddress Property (Visio) Comment.Collapsed Property (Visio) Comment.CreateDate Property (Visio) Comment.Document Property (Visio) Comment.EditDate Property (Visio) Comment.ObjectType Property (Visio) Comment.Stat Property (Visio) Comment.Text Property (Visio) | Comment.Delete Method (Visio)
Comments Object (Visio) | Comments.Count Property (Visio) Comments.Document Property (Visio) Comments.Item Property (Visio) Comments.ObjectType Property (Visio) Comments.Stat Property (Visio) | Comments.Add Method (Visio) Comments.DeleteAll Method (Visio)
ReplaceShapesEvent Object (Visio) | ReplaceShapesEvent.ObjectType Property (Visio) ReplaceShapesEvent.ReplaceFlags Property (Visio) ReplaceShapesEvent.ReplacementMaster Property (Visio) ReplaceShapesEvent.SelectionSource Property (Visio) ReplaceShapesEvent.Stat Property (Visio) | None

The following table lists the new enumerations and constants introduced in Visio 2013.

Table 3. Visio enumeration additions

Enumeration | Description
VisQuickStyleColors Enumeration (Visio) | Specifies designated names for colors contained within a theme.
VisQuickStyleMatrixIndices Enumeration (Visio) | Specifies designated names for the themes and variations provided with Visio 2013.
VisReplaceFlags Enumeration (Visio) | Specifies behaviors for a Change Shape operation.
VisSVGExportFormat Enumeration (Visio) | Specifies the inclusion or exclusion of Visio markup when exporting a diagram to SVG.

Deprecated objects and members

The following table lists the deprecated objects and members introduced in Visio 2013. Only deprecated object members are listed in the Deprecated members column.

Table 4. Visio object model deprecations

Object or collection | Deprecated members
Window object | PageTabWidth property

Additional resources

  • Visio for developers

  • What's new for ShapeSheet developers in Visio 2013

  • Visio Services in SharePoint 2013

  • What's new in Visio (Office.com)

  • Visio Developer Center


Welcome to the Visio 2013 Automation reference

 Copy code hover
[image]

Welcome to the Visio 2013 Automation reference
Send feedback

This reference contains conceptual overviews, programming tasks, samples, and references to guide you in developing solutions based on Visio 2013.

We welcome your comments or questions about this content. You can send feedback to docthis@microsoft.com.

Initial publication: July 2012 | Updated: October 2012

This documentation includes the following:

  • An overview of using Automation with Visio.

  • Details on Visio objects, properties, methods, enumerations, and events.

  • Information about the Visio object model, the Visio type library, and extending the functionality of Visio with macros, add-ons, and COM (Component Object Model) add-ins.

  • A sample Visual Basic for Applications (VBA) macro.

  • Information about common Automation tasks, such as starting the Visual Basic Editor; viewing Visio object, property, method, enumeration, and event descriptions in the Object Browser; connecting to data sources, linking shapes to data, and displaying shape data graphically; and running macros and add-ons.

  • Information about using the Visio Drawing Control to integrate Visio into third-party applications.

For information about working with the cells, rows, and sections of a Visio ShapeSheet, either in the ShapeSheet window or by using Automation, see the Visio 2013 ShapeSheet Reference.

This documentation contains the following sections:

  • Concepts: Provides important concepts for developing custom Visio solutions.

  • Common tasks: Describes common automation tasks for developing custom Visio solutions.

  • Reference: Provides reference materials for the Visio object model.

Additional resources

  • Visio Developer Center

  • Accessibility in Microsoft Products

  • Document Conventions

  • Microsoft Visio 2013 SDK Copyright Notice

  • Microsoft Online Privacy Notice


Concepts (Visio 2013 Automation)

 Copy code hover
[image]

Concepts (Visio 2013 Automation)
Send feedback

This navigation page contains contains links to overview topics about programmability in Visio. Click the links below or use the TOC to navigate to the following topics:

  • About Automation

  • About Connecting to Data in Visio

  • About Displaying Data Graphically

  • About Extending the Functionality of Visio

  • About Linking Shapes to Data

  • About Security Settings and Running Code in Visio

  • About the ThisDocument Object

  • About the Visio Drawing Control

  • About the Visio Type Library

  • About Units of Measurement

  • About Using the Visio Drawing Control in Your Application

  • DoCmd/DOCMD Commands

  • Event Codes

  • Sample VBA Macro


About Automation (Visio)

 Copy code hover
[image]

About Automation (Visio)
Send feedback

You can write programs to control Microsoft Visio in Microsoft Visual Basic for Applications (VBA), Microsoft Visual Basic, Microsoft Visual C++, any of the Microsoft Visual Studio .NET languages, or in any programming language that supports Automation.

A program can use Automation to incorporate Visio drawing and diagramming capabilities or to automate simple repetitive tasks in Visio. For example, a program might generate an organization chart from a list of names and positions or print all of the masters on a stencil.

How a program uses automation to control Visio

A program controls Visio by accessing its objects and then using their properties, methods, and events.

  • Objects represent items you work with in the Visio application, such as documents, drawing pages, shapes, and cells containing formulas.

  • Properties are attributes that determine the appearance or behavior of objects. For example, a Shape object has a Name property, which represents the name of that shape.

  • Methods are actions provided by an object. For instance, a program can perform the Add method on a Page object. This is the same as adding a page to a document by clicking Blank Page on the Insert tab.

  • Events trigger code or entire programs. For example, an event can programmatically trigger code when a document is opened or trigger a program when a shape is double-clicked.

The VBA programming environment in Visio

Visio includes the Visual Basic for Applications (VBA) programming environment. To create, view, debug, and run programs in this environment, use the Visual Basic Editor:

  • Create VBA programs by inserting modules, class modules, and user forms into your VBA project and by writing code.

  • View VBA project items by choosing the project of an open Visio document in the Project Explorer. To view the Code window for individual items, open the appropriate folder in the Project Explorer and double-click the project item, or right-click the item and click View Code on the shortcut menu.

  • Debug VBA programs by adding breakpoints, including watch expressions, and stepping through code as it runs.

  • Run VBA macros in the following ways:

In the Visual Basic Editor: On the Run menu, click Run Macro.

In Visio: In the Code group on the Developer tab, click Macros.


About Connecting to Data in Visio

 Copy code hover
[image]

About Connecting to Data in Visio
Send feedback
Note Note

Data-connectivity features are available only to licensed users of Microsoft Visio Professional 2013.

There are four aspects of data connectivity in Visio:

  • Connecting to a data source

  • Linking shapes to data

  • Displaying linked data graphically

  • Refreshing linked data that has changed in the data source, updating linked shapes, and resolving any subsequent conflicts that may arise

Typically, you approach these aspects in the order in which they are listed; that is, you first connect your Visio drawing to a data source, then link shapes in your drawing to data in the data source, display the data in linked shapes graphically, and refresh the linked data when necessary.

Each of these aspects has new objects and members associated with it in the Visio object model. This topic deals with the first of these aspects, connecting your Visio drawing to a data source. For more information about the other aspects of data connectivity, see the following topics:

  • About Linking Shapes to Data

  • About Displaying Data Graphically

To connect your Visio drawing to a data source programmatically, you can use the Visio API for data connectivity, which includes the following objects and their associated members:

  • DataRecordsets collection

  • DataRecordset object

  • DataConnection object

  • DataRecordsetChangedEvent object

  • DataColumns collection

  • DataColumn object

About Data Recordsets and Data Connections

Each Visio Document object has a DataRecordsets collection, which is empty until you make a connection to a data source. To connect a Visio document to a data source, you add a DataRecordset object to the DataRecordsets collection of the document. A DataRecordset object in turn has a DataColumns collection of DataColumn objects, each of which is mapped to a corresponding column (field) in the data source.

Data sources you can connect to include Microsoft Excel spreadsheets, Microsoft Access and Microsoft SQL Server databases, Microsoft SharePoint lists, and other OLEDB or ODBC data sources, such as an Oracle database. When you add a DataRecordset object by connecting to one of these data sources, Visio abstracts the connection in a DataConnection object, and the DataRecordset object is said to be connected.

You can also add a DataRecordset object by using an XML file that conforms to the ADO Classic (ADO version 2.x) Data Recordset XML schema as the data source. The resulting DataRecordset object is said to be connection-less. The connection between a data source and a DataRecordset object only goes one way—from the data source to the Visio drawing. If data in the source changes, you can refresh the data in the drawing to reflect those changes. You cannot, however, make changes in the data in the drawing and then push those changes back to the data source.

Adding DataRecordset Objects

To add a DataRecordset object to the DataRecordsets collection, you can use one of the following three methods, depending on the data source you want to connect to and whether you want to pass the method a connection string and query command string or a saved Office Data Connection (ODC) file that contains the connection and query information:

  • DataRecordsets.Add

  • DataRecordsets.AddFromConnectionFile

  • DataRecordsets.AddFromXML

The following Microsoft Visual Basic for Applications (VBA) sample macro shows how you might use the Add method to connect a Visio drawing to data in an Excel worksheet, in this case, in the ORGDATA.XLS sample workbook that is included with Visio:

Copy code Copy code
Public Sub AddDataRecordset()

    Dim strConnection As String
    Dim strCommand As String
    Dim strOfficePath As String
    Dim vsoDataRecordset As Visio.DataRecordset
    strOfficePath = Visio.Application.Path
    strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" _
                       & "User ID=Admin;" _
                       & "Data Source=" + strOfficePath + "SAMPLES\1033\ORGDATA.XLS;" _
                       & "Mode=Read;" _
                       & "Extended Properties=""HDR=YES;IMEX=1;MaxScanRows=0;Excel 12.0;"";" _
                       & "Jet OLEDB:Engine Type=34;"
    strCommand = "SELECT * FROM [Sheet1$]"
    Set vsoDataRecordset = ActiveDocument.DataRecordsets.Add(strConnection, strCommand, 0, "Data")

End Sub
Note Note

If you run this code on non-English builds of Visio, the path to the file ORGDATA.XLS, shown here as "Samples\1033\ORGDATA.XLS," will be different. Substitute the correct path for your version of Visio in your code.

The Add method returns a DataRecordset object and takes four parameters:

  • ConnectionIDOrString The ID of an existing DataConnection object or the connection string to specify a new data-source connection. If you pass the ID of an existing DataConnection object that is currently being used by one or more other data recordsets, the data recordsets become a transacted group recordset. All data recordsets in the group are refreshed whenever a data-refresh operation occurs. You can determine an appropriate connection string by first using the Data Selector Wizard in the Visio user interface (UI) to make the same connection, recording a macro while running the wizard, and then copying the connection string from the macro code.

  • CommandString The string that specifies the database table or Excel worksheet and specifies the fields (columns) within the table or worksheet that contain the data you want to query. The command string is also passed to the DataRecordset.Refresh method when the data in the recordset is refreshed.

  • AddOptions A combination of one or more values from the VisDataRecordsetAddOptions enumeration. These values specify certain data recordset behaviors, and make it possible, for example, to prevent the queried data in the recordset from appearing in the External Data window in the Visio UI or from being refreshed by user actions. Afteryou assign this value, you cannot change it for the duration of the DataRecordset object.

  • Name An optional string that gives the data recordset a display name. If you specify for data from the recordset to be displayed in the External Data window in the Visio UI, the name you pass appears on the tab of that window that corresponds to the data recordset. In our example, there is no existing data connection, so for the first parameter of the Add method, we pass strConnection, the connection string we defined. For the second parameter, we pass strCommand, the command string we defined, which directs Visio to select all columns from the worksheet we specified. For the third parameter of the Add method, we pass zero to specify default behavior of the data recordset, and for the last parameter, we pass Org Data, the display name we defined for the data recordset.

The following sample code shows how to get the DataConnection object that was created when we added a DataRecordset object to the DataRecordsets collection. It prints the connection string associated with the DataConnection object in the Immediate window by accessing the ConnectionString property of the DataConnection object.

VBA Copy code Copy code
Public Sub GetDataConnectionObject(vsoDataRecordset As Visio.DataRecordset)

    Dim vsoDataConnection As DataConnection
    Set vsoDataConnection = vsoDataRecordset.DataConnection
    Debug.Print vsoDataConnection.ConnectionString

End Sub

Just as you can get the connection string associated with a DataConnection object by accessing its ConnectionString property, you can get the command string associated with a DataRecordset object by accessing its CommandString property. Both of these properties are assignable, so you can change the data source associated with a DataRecordset object or the query associated with a DataConnection object at any time, although changes are not reflected in your drawing until you refresh the data. For more information about refreshing data, see About Linking Shapes to Data.

Accessing Data in Data Recordsets Programmatically

When you import data, Visio assigns integer row IDs, starting with the number 1, to each data row in the resulting data recordset, based upon the order of rows in the original data source. Visio uses data row IDs to track the rows when they are linked to shapes and when data is refreshed. If you want to access data rows programmatically, you must use these data row IDs. For information about how data-refresh operations affect row order, see About Linking Shapes to Data.

You can use the DataRecordset.GetDataRowIDs method to get an array of the IDs of all the rows in a data recordset, where each row represents a single data record. The GetDataRowIDs method takes as its parameter a criteria string, which is a string that conforms to the guidelines specified in the Microsoft ActiveX Data Object (ADO) API for setting the ADO.Filter property. By specifying appropriate criteria and using AND and OR operators to separate clauses, you can filter the information in the data recordset to return only certain data recordset rows selectively. To apply no filter (that is, to get all the rows), pass an empty string (""). For more information about criteria strings, see the Filter Property topic in the ADO 2.x API Reference. After you retrieve the data-row IDs, you can use the DataRecordset.GetRowData method to get all the data stored in each column in the data row. For more information about data columns, see About Linking Shapes to Data.

The following sample code shows how to use the GetDataRowIDs and GetRowData methods to return the row ID of each row and then get the data stored in each column in every row of the data recordset passed in. It uses two nested For…Next loops to iterate through all the rows in the recordset and then, for each row, iterate through all the columns in that row. The code displays the information returned in the Immediate window. Note that you pass an empty string to the GetDataRowIDs method to bypass filtering and get all the rows in the recordset. After you call the procedure, note that the first set of data shown (corresponding to the first data row) contains the headings for all the data columns in the data recordset.

Copy code Copy code
Public Sub GetDataRecords(vsoDataRecordset As Visio.DataRecordset)

    Dim lngRowIDs() As Long
    Dim lngRow As Long
    Dim lngColumn As Long
    Dim varRowData As Variant

    'Get the row IDs of all the rows in the recordset
    lngRowIDs = vsoDataRecordset.GetDataRowIDs("")

    'Iterate through all the records in the recordset.
    For lngRow = LBound(lngRowIDs) To UBound(lngRowIDs)
        varRowData = vsoDataRecordset.GetRowData(lngRow)

        'Print a separator between rows
        Debug.Print "------------------------------"

       'Print the data stored in each column of a particular data row.
        For lngColumn = LBound(varRowData) To UBound(varRowData)
            Debug.Print vsoDataRecordset.DataColumns(lngColumn + 1) .Name _
               & Trim(Str(lngColumn)) &amp; " = " VarRowData(lngColumn)
        Next lngColumn
    Next lngRow

End Sub


About Displaying Data Graphically (Visio)

 Copy code hover
[image]

About Displaying Data Graphically (Visio)
Send feedback
Note Note

Data-connectivity features are available only to licensed users of Microsoft Visio Professional 2013.

There are four aspects of data connectivity in Visio:

  • Connecting to a data source

  • Linking shapes to data

  • Displaying linked data graphically

  • Refreshing linked data that has changed in the data source, updating linked shapes, and resolving any subsequent conflicts that may arise

Typically, you approach these aspects in the order in which they are listed; that is, you first connect your Visio drawing to a data source, then link shapes in your drawing to data in the data source, display the data in linked shapes graphically, and refresh the linked data when necessary.

Each of these aspects has new objects and members associated with it in the Visio object model. This topic deals with the third and fourth of these aspects, displaying linked data graphically in shapes in your Visio, and refreshing data. For more information about the other aspects of data connectivity, see the following topics:

  • About Connecting to Data in Visio

  • About Linking Shapes to Data

To display linked data programmatically, you can use the Visio API for data display, which includes the following objects and their associated members:

  • GraphicItems collection

  • GraphicItem object

After you link shapes in your Visio drawing to rows in a data recordset, you can graphically display the linked data programmatically. For example, say that your drawing contains several data-linked shapes, each of which represents a project at a particular stage of completion. You may associate a progress bar with a particular item of shape data, such as the percentage of project completion. You could then apply the progress bar to a selection of project shapes and show each project's progress toward completion visually.

Overview of Data Graphics and Graphic Items

To make it easier to display data graphically, Visio introduces the concept of data graphics and a type of Master object called a data graphic master, which is represented in the VisMasterTypes enumeration by the value visTypeDataGraphic. To add a Master object of type visTypeDataGraphic to the Masters collection, you must use the Masters.AddEx method.

Visio includes several types of masters, including shape masters. When you create an instance of a shape master, it becomes a shape. Visio also includes fill pattern, line pattern, and line-end masters, for which you cannot create instances. You apply these masters to shapes to impart the master pattern to the shape. Data graphic masters are more like pattern masters, because you do not create instances of them. Instead, you apply them to shapes as you do line pattern and fill pattern masters.

Data graphic masters correspond to the data graphics that appear in the Data Graphics task pane in the Visio UI. A data graphic master consists of one or more graphic items. Graphic items are Visio shapes designed to be ready-made visual components that you can associate with shape data to display that data graphically, based on rules that you define, and at a position relative to the shape that you specify.

Visio provides graphic items of the following types:

  • Text Displays data as text in a callout, at a specified position relative to the shape.

  • Color by Value Changes the color of the shape based on a comparison between shape data and a particular value or range of values.

  • Data Bar Uses bar charts and graphs to display data, at a specified position relative to the shape.

  • Icon Set Displays one of a set of icons that represents a data value or condition, at a specified position relative to the shape.

Visio provides a variety of standard data graphics that are already populated with graphic items. If you want to apply a data graphic to your shapes that has a different combination of graphic items, you can create a custom data graphic. We recommend that you use the Visio UI to create a data graphic and add graphic items to it.

To create data graphics in the UI:

  1. On the Data tab, click Data Graphics.

  2. Click Create New Data Graphic, and then in the New Data Graphic dialog box, click New Item.

  3. In the dialog box that opens, customize the item, and then use the same method to add custom items.

You can also create data graphic masters and populate them with existing graphic items programmatically. You cannot create graphic items programmatically, but you can customize the behavior of existing data graphics. In addition, you can use code to change the behavior and position of graphic items, as well as the rules, called expressions, that define how individual graphic items display data. Expressions can be ShapeSheet formulas or any other legal ShapeSheet expressions, or shape-data (custom property) labels. To set an expression that is a shape-data label, you must enclose the label in curly braces ({}) and then pass it as the second (Expression) parameter of the GraphicItem.SetExpression method.

After you create a data graphic that contains a custom combination of graphic items and define the behavior of those graphic items, you can apply the data graphic to data-linked shapes programmatically.

Data Graphics Objects and Members

Besides the Master objects of type visTypeDataGraphic described in the previous section, Visio provides the following objects and their associated members in the data graphics API:

  • GraphicItems collection

  • GraphicItem object

In addition to these specifically data-graphic-related objects and their members, several members of other, more conventional Visio objects constitute part of the data graphics API. For example, the Shape.DataGraphic and Selection.DataGraphic properties allow you to apply data graphics to shapes and selections respectively. The read-only Shape.IsDataGraphicCallout property indicates whether a specific shape is functioning as a data graphic item in your drawing.

Applying Data Graphics to Data-linked Shapes

The following example shows how to use the Selection.DataGraphic property to apply an existing custom data graphic that you create in the UI to a selection of shapes in your drawing. For this code to work, the existing custom data graphic must be named "MyCustomDataGraphic." Alternatively, you can substitute the name of an existing data graphic in your drawing for "MyCustomDataGraphic" in the code.

VBA Copy code Copy code
Public Sub ApplyDataGraphic()
    Dim vsoSelection As Visio.Selection
    ActiveWindow.SelectAll
    Set vsoSelection = ActiveWindow.Selection
    Set vsoSelection.DataGraphic = ActiveDocument.Masters("MyCustomDataGraphic")
End Sub

Customizing the Behavior of Data Graphic Masters

You can use the Master.DataGraphicHidden and Master.DataGraphicHidesText properties to customize certain aspects of the behavior of data graphic masters.

The DataGraphicHidden property determines whether a data graphic master appears in the Data Graphics gallery in the Visio UI. When you set the value of this property to True for a given master, the master does not appear in the list of data graphics in the gallery. The default value of the property is False.

The DataGraphicsHidesText property determines whether applying a data graphic master hides the text of the shape to which it is applied (the primary shape in the case of a group shape.) The default value of this property also is False.

The GraphicItem.UseDataGraphicPosition property determines whether to use the current default callout position for graphic items of the data graphic master to whose GraphicItems collection a graphic item belongs. The default callout position for graphic items in the GraphicItems collection of a Master object of type visTypeDataGraphic is specified by the settings of the Master.DataGraphicVerticalPosition and Master.DataGraphicHorizontalPosition properties. If UseDataGraphicPosition is True, the graphic item is positioned according to the default setting. If UseDataGraphicPosition is False, its position is determined by the settings of the Graphic Item.VerticalPosition and GraphicItem.HorizontalPosition properties.

In addition, if the HorizontalPosition and VerticalPosition property values of a graphic item are equal to the DataGraphicHorizontalPosition and DataGraphicVerticalPosition property values, the value of the UseDataGraphicPosition property for that graphic item is automatically set to True.

Note, however, that you can manually re-position a data graphic that has been applied to a shape by using the control handle of the data graphic. A position set in this manner takes precedence over the position specified by property settings.

The Master.DataGraphicShowBorder property determines whether a border is displayed around graphic items that are in default positions relative to the shape to which a data graphic is applied. By default, the border is hidden.

Assembling Data Graphics Programmatically

The following example shows how to create a data graphic master, add an existing graphic item to it, and then modify the graphic item. This example uses the Masters.AddEx method to add a new data graphic master to the Masters collection of the current document.

Next, it uses the Master.Open method to get a copy of an existing data graphic master to edit. For more information about why it is necessary to edit a copy of a master, instead of the master itself, see Open Method. Next, it uses the GraphicItems.AddCopy method to add a copy of an existing graphic item to the GraphicItems collection of the new master, and the GraphicItem.SetExpression method to modify the data field that the graphic item represents. It also sets the GraphicItem.PositionHorizontal property to modify the horizontal position of the graphic item relative to the shape to which it is applied.

Finally, it sets the Master.DataGraphicHidesText property to True to hide the text of the shape, and closes the copy of the master, which applies the changes to existing shapes to which this data graphic master is applied. You can then apply the new data graphic master to additional shapes.

VBA Copy code Copy code
Public Sub AddNewDataGraphicMaster()

    Dim vsoMaster As Visio.Master
    Dim vsoMasterCopy As Visio.Master
    Dim vsoMaster_Old As Visio.Master
    Dim vsoGraphicItem As GraphicItem
    Dim vsoGraphicItem_Old As Visio.GraphicItem

    Set vsoMaster = ActiveDocument.Masters.AddEx(visTypeDataGraphic)
    Set vsoMasterCopy = vsoMaster.Open
    Set vsoMaster_Old = ActiveDocument.Masters("old_master_name")
    Set vsoGraphicItem_Old = vsoMaster_Old.GraphicItems(1)
    Set vsoGraphicItem = vsoMasterCopy.GraphicItems.AddCopy(vsoGraphicItem_Old)

    vsoGraphicItem.SetExpression visGraphicExpression, "new_data_field_name"
    vsoGraphicItem.PositionHorizontal = visGraphicLeft
    vsoMasterCopy.DataGraphicHidesText = True;
    vsoMasterCopy.Close

End Sub

The preceding code sample assumes that you know the name of the existing data graphic master that contains one or more graphic items you want to add to the new master, as well as the IDs of one or more graphic items you want to add to the master. You can determine the name of an existing data graphic master by moving your mouse over the master in the Data Graphics task pane. You can also determine master names and IDs by iterating through the Masters collection in the current document, as shown in the following code.

VBA Copy code Copy code
For intCounter = 1 To ActiveDocument.Masters.Count
        If ActiveDocument.Masters(intCounter).Type = visTypeDataGraphic Then
            Debug.Print ActiveDocument.Masters(intCounter).Name, ActiveDocument.Masters(intCounter).ID
        End If
    Next

Similarly, you can iterate through the GraphicItems collection of a master to determine the values of the ID and Tag properties of an existing graphic item, as shown in the following example. The Tag property is a string that Visio does not use. It is empty by default. However, you can set its value to make it easier to identify individual graphic items programmatically.

VBA Copy code Copy code
For intCounter = 1 To (vsoMaster_Old.GraphicItems.Count)
        Debug.Print vsoMaster_Old.GraphicItems(intCounter).ID, oldMaster.GraphicItems(intCounter).Tag
    Next

To see a code sample that shows how to customize data graphics programmatically, download the Visio SDK and refer to the Code Samples Library.


About Extending the Functionality of Visio

 Copy code hover
[image]

About Extending the Functionality of Visio
Send feedback

Published: July 16, 2012

You can extend the functionality of Microsoft Visio in the following ways:

  • Create Visio-specific macros and add-ons.

  • Create COM (Component Object Model) add-ins.

Macros and add-ons

Macros and add-ons are programs that extend the functionality of Visio. Exactly how you run a macro or add-on depends on the context for which it was designed.

You can run a macro or add-on from the Visio application in several ways. Here are a few of the most common:

  • Choose a macro or add-on from the Macros dialog box. (In the Code group on the Developer tab, click Macros.) If your program is an EXE file, before it can appear in the Macros dialog box, it must be located in a folder along the Add-ons path in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.)

    Note Note

    Starting with Microsoft Office Visio 2003, instead of specifying file paths to your Visio add-ons, you can publish your add-ons by using a Microsoft Windows Installer package. By doing so, you can take advantage of Microsoft Office application features such as language switching, installation on demand, and repair. For more information about using a Windows Installer package to publish your add-ons, search for "Microsoft Windows Installer" on MSDN, the Microsoft Developer Network Web site.

  • Double-click a shape associated with an add-on or macro. The program you want to run must be selected in the Run macro list on the Double-Click tab in the Behavior dialog box for that shape. (Select the shape, and then, on the Developer tab, click Behavior).

  • Right-click a shape, and then click a custom menu item for an add-on or macro on the shortcut menu. The program associated with the custom menu item must be entered in the Actions section of the ShapeSheet window for the shape.

If an add-on is designed to be run outside the Visio application, you run it like any Microsoft Windows-based program (for example, by double-clicking an icon on the desktop). For details, see your Windows documentation.

COM add-ins

Beginning with Visio 2002, you can use COM add-ins in the same standardized way as in other Microsoft Office applications. The COM add-in must be registered with the Visio application and can work in multiple applications. For example, you can build a COM add-in that performs the same task in Visio and Microsoft Excel, or any of the Microsoft Office applications. You can create COM add-ins with Microsoft Visual Basic 5.0 and higher, Microsoft C++, Microsoft Office 2000 Developer Edition and higher, or any of the Microsoft Visual Studio .NET applications.

For more information about building COM add-ins, see MSDN.


About Linking Shapes to Data

 Copy code hover
[image]

About Linking Shapes to Data
Send feedback
Note Note

Data-connectivity features are available only to licensed users of Microsoft Visio Professional 2013.

There are four aspects of data connectivity in Visio:

  • Connecting to a data source

  • Linking shapes to data

  • Displaying linked data graphically

  • Refreshing linked data that has changed in the data source, updating linked shapes, and resolving any subsequent conflicts that may arise

Typically, you approach these aspects in the order in which they are listed; that is, you first connect your Visio drawing to a data source, then link shapes in your drawing to data in the data source, display the data in linked shapes graphically, and refresh the linked data when necessary.

Each of these aspects has objects and members associated with it in the Visio object model. This topic deals with the second of these aspects, linking shapes in your Visio drawing to data. For more information about the other aspects of data connectivity, see the following topics:

  • About Connecting to Data in Visio

  • About Displaying Data Graphically

To connect your Microsoft Visio drawing to a data source programmatically, you can use the Visio API for data connectivity, which includes the following objects and their associated members:

  • DataRecordsets collection

  • DataRecordset object

  • DataConnection object

  • DataRecordsetChangedEvent object

  • DataColumns collection

  • DataColumn object

After you connect your Visio drawing to an external data source, you can link the shapes in the drawing to data from that source programmatically. You can link one or more shapes to a single row of data in a data recordset or to multiple rows of data in different data recordsets. However, you cannot link shapes to multiple rows of data in the same recordset.

You can link existing shapes to data, one shape at a time or as a group; or, you can create shapes and link them to data simultaneously. You can specify the correspondence between shapes and data rows, if you know it, or you can let Microsoft Visio determine the correspondence automatically, based on a comparison between existing shape data and data in the data recordset.

After you link shapes to data, you can display that data graphically by adding data graphics to shapes. For more information about data graphics, see About Displaying Data Graphically.

The DataRecordset and DataColumn objects and the DataColumns collection expose several properties, methods, and events that facilitate data linking. In addition, several members of other objects in the Visio object model, including the Application, Document, Page, Selection, Shape, and Window objects, are related to data-linking.

Data-linking and Shape Data

Linking shapes to data relies on the fact that you can assign shape data to all Visio shapes. In versions of Visio earlier than Visio 2007, shape data were called custom properties.

To access and assign shape data in the Visio UI, right-click a shape, point to Data, and then click Shape Data. Alternatively, you can access and assign shape data manually or programmatically in the Visio ShapeSheet spreadsheet. To display the ShapeSheet spreadsheet (ShapeSheet) for a selected shape, right-click the shape and click Show ShapeSheet. To see this command, you must be running Visio in developer mode. To run Visio in developer mode, click the File tab, click Options, click Advanced, and then, under General, select Run in developer mode.

Within the ShapeSheet, shape data is contained in the Shape Data section (previously called the Custom Properties section). To maintain backwards-compatibility, existing object members retain "custom property" or "custom properties" in their name. If you do not assign shape data for a given shape, no Shape Data section appears in the ShapeSheet. You can add a Shape Data section to a ShapeSheet by displaying the ShapeSheet as described previously, right-clicking anywhere in the ShapeSheet window and clicking Insert Section, selecting Shape Data, and then clicking OK.

After you link shapes to data, many of the columns of the Shape Data section correspond closely to the properties of the DataColumn object. For example, the Label column in the Shape Data section, which provides the label that appears for a particular shape data item in the Shape Data dialog box, corresponds to the DataColumn.DisplayName property, which controls the name that appears for the associated data column in the External Data window. For more information about working with the DataColumn object, see Getting and Setting Data-column Properties.

Identifying Shapes, Data Recordsets, and Data Rows

Visio uses unique ID numbers to identify shapes, recordsets, and data rows. Shape IDs are unique only within the scope of the page they are on. After you determine these numbers, you can pass them to methods of the Visio data-related objects to specify exactly how the shapes in your diagram should link to data rows in the available data recordsets.

To determine the ID for a shape, get the Shape.ID property value. In addition, Visio also gives shapes unique IDs or GUIDs. The Page.ShapeIDsToUniqueIDs method takes an array of shape IDs, as well as an enumeration value from VisUniqueIDArgs specifying whether to get, get or make, or delete shape GUIDs. The Page.ShapeIDsToUniqueIDs method also returns an array of unique IDs for the shapes passed in. Conversely, if you know the unique IDs of a set of shapes, you can use the Page.UniqueIDsToShapeIDs method to obtain the shape IDs for those shapes. For a selection of shapes, use the Selection.GetIDs method to get the shape IDs of the shapes.

To determine the ID for a DataRecordset object you add to the DataRecordsets collection, get the DataRecordset.ID property value. To determine the IDs for each of the rows in a data recordset, call the DataRecordset.GetDataRowIDs method, which returns an array of row IDs. For more information, see the section "Accessing Data in Data Recordsets Programmatically," in About Connecting to Data in Visio.

Creating Shapes Linked to Data

When you want to create shapes, already linked to data, on a drawing page that either does not contain any shapes or contains shapes other than the ones you want to link, you can use the Page.DropLinked and Page.DropManyLinkedU methods to create one or more additional shapes already linked to data. These methods resemble the Page.Drop and Page.DropManyU methods in that they create additional shapes at a specified location on the page; but in addition, they create links between the new shapes and specified data rows in a specified data recordset.

The DropLinked method returns the new, linked Shape object and takes the following parameters:

  • ObjectToDrop The particular shape (a Rectangle shape, for example) you want to create.

  • x The x-coordinate of the center of the new shape on the page.

  • y The y-coordinate of the center of the new shape on the page.

  • DataRecordsetID The value of the ID property of the DataRecordset object that contains the data row to link to.

  • DataRowID The value of the ID property of the data row to link to.

  • ApplyDataGraphicAfterLink A Boolean value specifying whether to apply the shape's data graphic automatically if it already has one, or if not, whether to apply the most recently used data graphic. The default is not to apply a data graphic. For more information on data graphics, see About Displaying Data Graphically.

The following sample code shows how to use the DropLinked method to create a shape on the active drawing page, centered at page coordinates (2, 2), and linked to a data row. It takes the DataRecordset object passed in, gets its ID, and then passes that ID, along with ID of the data row to link to, to the DropLinked method. The dropped shape is a simple rectangle from the Basic_U.VSS stencil, which the code opens, docked in the Visio drawing window.

In this example, the ID of the data row is set to 1; before running the code, ensure that a row with that ID exists, or change the ID value in the code.

VBA Copy code Copy code
Public Sub DropLinkedShape(vsoDataRecordset As Visio.DataRecordset)

    Dim vsoShape As Visio.Shape
    Dim vsoMaster As Visio.Master
    Dim dblX As Double
    Dim dblY As Double
    Dim lngRowID As Long
    Dim lngDataRecordsetID As Long

    lngDataRecordsetID = vsoDataRecordset.ID
    Set vsoMaster = Visio.Documents.OpenEx("Basic_U.VSS", 0).Masters("Rectangle")
    x = 2
    y = 2
    lngRowID = 1
    Set vsoShape = ActivePage.DropLinked(vsoMaster, dblX, dblY, lngDataRecordsetID, lngRowID, True)

End Sub

The DropManyLinkedU method similarly creates a set of linked shapes, returned as an array of shape IDs. It takes as parameters arrays of shapes to drop, coordinates, and data rows to link to. Entries at corresponding array-index positions determine how shapes and data rows are related and where on the page individual shapes are dropped.

Linking Existing Shapes to Data

When you know exactly how one or more existing shapes in a Visio drawing and one or more rows in a data recordset correspond to one another, you can link the existing shapes to data in the following ways:

  • Link a single shape to a single data row

  • Link a selection of shapes to one or more data rows

  • Link multiple shapes to multiple data rows

In addition, if you do not know the exact shape to data mapping, you can direct Visio to make the best match possible, based on limited matching information that you provide.

Linking a Single Shape to a Data Row

To link a single shape to a single data row, use the Shape.LinkToData method. This method takes a data recordset ID and data row ID as well as an optional Boolean flag specifying whether to display the linked data in a data graphic. The default is to display the data graphic.

Linking Multiple Shapes to Data

Two members of the Selection object, the Selection.LinkToData and Selection.AutomaticLink methods, as well as the Page.LinkShapesToDataRows method, make it possible to link one or more existing shapes in a selection to data.

The Selection.LinkToData method functions much like the same method of the Shape object, except that it links a selection of shapes, instead of a single shape, to a single data row.

If you are unsure about the correspondence between shapes and data rows, but know a match exists between a specific attribute of every shape and the data in one column in the data recordset, the Selection.AutomaticLink method provides a means to link a selection of existing shapes to multiple rows of data. Note that it must be the same attribute for all shapes. For more information about this method, see Linking to Data Automatically.

The Page.LinkShapesToDataRows method is similar to the Selection.LinkToData method in that it links multiple shapes. However, you use this method to link shapes on the same page, rather than shapes in a selection, to data. The LinkShapesToDataRows method links shapes to multiple data rows, whereas the LinkToData method links multiple shapes to a single row. To link shapes, pass the LinkShapesToDataRows method a pair of arrays: one for shapes, and one for data rows. Note that the matching array positions must correspond. As a result, for example, the shape at position 1 in the shape array is linked to the data at position 1 in the data row array. Once again, when you call the method, you can optionally specify whether to apply an existing data graphic to linked shapes.

Linking to Data Automatically

You can use the Selection.AutomaticLink method to link shape data values in selected shapes—that is, shapes assigned to a Selection object—to data rows in a data recordset automatically—that is, without specifying the exact correspondence of all shapes and data rows. To provide Visio with enough information to create the links, however, you must supply at least one set of matching data: the name of a column in the database, a shape attribute type, and, if necessary, a shape value, all at the same index position of the corresponding arrays you pass to the method.

The shape attribute type indicates the attribute of the shape to base the matching upon. The attribute can be the value of a shape data item (formerly known as a custom property value), shape text, or another of the values specified in the VisAutoLinkFieldTypes enumeration.

Note Note

For example, say that your drawing contains a selection of shapes representing different employees. Their shape text identifies the shapes, which in this case would be the respective employee's names. (You could use some of the employee names from the OrgData.xls workbook that ships with Visio, and then connect to that data source. By default, OrgData.xls is installed at the following path: C:\Program Files\Microsoft Office\Office15\Visio Content\[langID], where langID varies by country or region.) On some computers, the path might include "Program Files (x86)" instead of "Program Files."

To connect these shapes to a database where each employee's data constitutes a row in the database, you pass the following parameters to the AutomaticLink method:

  • DataRecordsetID The value of the ID property of the DataRecordset object that contains the data rows to link to. In the example that follows, we pass an existing data recordset to the procedure and get its ID.

  • ColumnNames() A string array consisting of names of columns in the database. At least one position in the array must have a value that corresponds to the values in the same position in the AutoLinkFieldTypes and FieldNames arrays. In the following example, we pass an array that contains the "Name" column name at array position 0.

  • AutoLinkFieldTypes() An array of Long values from the VisAutoLinkFieldTypes enumeration, consisting of shape attribute types. At least one position in the array must have a value that corresponds to the values in the same position in the ColumnNames and FieldNames arrays. In the following example, we pass the enumeration value visAutoLinkShapeText at array position 0.

  • FieldNames() A string array consisting of shape values. At least one position in the FieldNames array must have a value that corresponds to the values in the same position in the ColumnNames and AutoLinkFieldTypes arrays.

  • For most values of AutoLinkFieldTypes, for example, visAutoLinkShapeText, it is not necessary to specify the FieldNames value; you can pass the null value instead. That is the case in our example, so we pass an empty string. However, when you pass the visAutoLinkCustPropsLabel, visAutoLinkUserRowName, visAutoLinkPropRowNameU, or visAutoLinkUserRowNameU values of AutoLinkFieldTypes, you must pass a value for FieldNames to fully specify the shape data item to compare to the data column name.

  • AutoLinkBehavior A value from the VisAutoLinkBehaviors enumeration. These enumerated values provide options to customize the method, for example, to replace existing links with new ones. The following example passes the default value, 0.

  • ShapeIDs() An array that the method fills with the IDs of linked shapes when it returns.

The following sample shows one way to use the AutomaticLink method to link shapes and data automatically. The sample assumes that you have connected your drawing to data in the OrgData.xls sample workbook, as explained above. Note that the code requires that the first column of data be named "Name," as is the case in OrgData.xls. Note also that the shape text of each of the shapes in your drawing that you want to link to data must match one of the names in the "Name" column in OrgData.xls.

VBA Copy code Copy code
Public Sub LinkToDataAutomatically(vsoDataRecordset As Visio.DataRecordset)

    Dim vsoSelection As Visio.Selection
    Dim columnNames(1) As String
    Dim fieldTypes(1) As Long
    Dim fieldNames(1) As String
    Dim shapesLinked() As Long

    columnNames(0) = "Name"
    fieldTypes(0) = Visio.VisAutoLinkFieldTypes.visAutoLinkShapeText
    fieldNames(0) = ""
    ActiveWindow.DeselectAll
    ActiveWindow.SelectAll
    Set vsoSelection = ActiveWindow.Selection
    vsoSelection.AutomaticLink vsoDataRecordset.ID, _
                    columnNames, _
                    fieldTypes, _
                    fieldNames, 0, shapesLinked

End Sub

Discovering Links between Shapes and Data

Use the following methods to determine which shapes are linked to data. Knowing how shapes are linked to data can help prevent conflicts and broken links:

  • Page.GetShapesLinkedToData

  • Page.GetShapesLinkedToDataRow

  • Shape.GetLinkedDataRow

  • Shape.GetCustomPropertyLinkedColumn

  • Shape.GetCustomPropertiesLinkedToData

  • Shape.IsCustomPropertyLinked

Breaking Links between Shapes and Data

As their names imply, you can use the Shape.BreakLinkToData and Selection.BreakLinkToData methods to break existing links between shapes and data programmatically. In addition, various changes made in the UI can break these links. For example, when users delete a data recordset, linked row, or linked shape, or when users click Unlink from Row on a shape's shortcut menu or Unlink on a row's shortcut menu, they can cause broken links.

Except when a user deletes a data recordset, row, or shape from the UI, all of these actions fire the Shape.ShapeLinkDeleted event. You can also use the methods listed in the previous section to determine link status.

Getting and Setting Data-column Properties

Every DataRecordset object contains a DataColumns collection of all the DataColumn objects associated with the DataRecordset object. These objects allow you to map data columns to cells in the Shape Data section of the ShapeSheet.

The following sample shows how to get the value of the Label cell in the Shape Data section for the first column in the data recordset passed to the method and display it in the Immediate window. Then it sets the value and displays the new value.

Changing this value changes the label of the shape data item in the Shape Data dialog box for all shapes linked to rows in the data recordset. To get and set the Label cell value, we pass the visDataColumnPropertyDisplayName value from the VisDataColumnProperties enumeration to the DataColumn.GetProperty and DataColumn.SetProperty methods.

VBA Copy code Copy code
Public Sub ChangeColumnProperties(vsoDataRecordset As Visio.DataRecordset)

    Dim strPropertyName As String
    Dim strNewName As String
    Dim vsoDataColumn As Visio.DataColumn

    strNewName = "New Property Name"
    Set vsoDataColumn = vsoDataRecordset.DataColumns(1)
    strPropertyName = vsoDataColumn.GetProperty(visDataColumnPropertyDisplayName)
    Debug.Print strPropertyName

    vsoDataColumn.SetProperty visDataColumnPropertyDisplayName, strNewName
    strPropertyName = vsoDataColumn.GetProperty(visDataColumnPropertyDisplayName)
    Debug.Print strPropertyName

End Sub

Refreshing Linked Data and Resolving Conflicts

When data changes in the data source to which your drawing is connected, you can refresh the data in your Visio drawing to reflect those changes. You can specify that Visio refresh data automatically at a specified interval by setting the DataRecordset.RefreshInterval property. You can refresh data programmatically by calling the DataRecordset.Refresh method.

In addition, you can resolve any conflicts in the relationship between shapes and rows of data. For example, conflicts can occur when you refresh the data recordset and some data rows to which shapes were linked before the refresh operation no longer exist, because of changes to the data source. Other conflicts are possible when two or more rows in the refreshed recordset have identical primary keys.

Refreshing Linked Data Automatically

When you create a DataRecordset object, its RefreshInterval property value is set to the default, 0. This setting indicates that data is not refreshed automatically. By setting DataRecordset.RefreshInterval to a positive Long value, you can specify the time in minutes between automatic refreshes. The minimum interval you can specify is one minute. This setting corresponds to the value a user can set in the Configure Refresh dialog box.

To determine the date and time of the last refresh operation, get the DataRecordset.TimeRefreshed property.

Additionally, the DataRecordset.RefreshSettings property allows you to customize automatic refreshes of data. By setting this property to a combination of the values in the VisRefreshSettings enumeration, you can specify that either or both of the following occur:

  • The UI for reconciling refresh conflicts (the Refresh Conflicts task pane) is disabled. (See the next section for more information.)

  • Refresh operations automatically overwrite changes to data made in the UI. The default value for this property is 0, meaning that neither of these events occur.

Identifying Data Recordset Rows for Refresh Operations

Because shapes are linked by their shape IDs to specific data rows, when Visio refreshes linked data, it must determine which rows in the linked data recordset or recordsets were added, changed, or removed since the last time the data was refreshed. To identify these rows, Visio uses the row IDs assigned to the rows in the data recordset. Visio can assign these row IDs two ways, depending on whether you designated primary keys for the data recordset when you created it.

Refreshing Data Recordsets that Do Not Have Primary Keys

When you create a data recordset, Visio assigns row IDs to all the rows in the recordset based on the existing order of the rows in the data source. Accordingly, the first row in the recordset is always assigned row ID 1, the second row ID 2 and so forth.

Subsequently, you can add or remove data rows from the original data source. Then, when you refresh the data, the data recordset reflects those changes. As a result, row order in the data recordset may change.

For example, in a five-row data recordset, if the fourth row in the data source is removed, when Visio refreshes the data recordset connected to that data source, the fifth row in the data recordset becomes the new fourth row and is assigned row ID 4. Row ID 5 is removed from the data recordset.

As a result, shapes linked to row ID 5 loose their links, and shapes linked to row ID 4 now get data from the row previously in the fifth position. As you can see, not assigning primary keys to data recordsets when you create them can result in broken links between shapes and data, or in Visio linking shapes to rows other than the ones to which you want them linked.

Refreshing Data Recordsets that Have Primary Keys

You can help prevent these broken or mismatched links by assigning primary keys to data recordsets. A primary key identifies the name of the data column or columns that contain unique identifiers for each row. The value in the primary key column for each row uniquely identifies that row in the data recordset. Primary keys are often ID values, but you can set any column or combination of columns to be the primary key. However, to get consistent results when you refresh data, it is essential that you make the primary key column value (or set of values for multiple primary key columns) unique for each row.

As a result, when you refresh or when Visio refreshes a data recordset that includes primary keys, its rows retain the same row IDs they had before the refresh operation. Because Visio links shapes to data rows by ID—shape ID to row ID—and because row IDs remain the same after a refresh operation, data-linked shapes remain linked to the correct row. Note that row IDs are never recycled for a given a data recordset.

You can use the DataRecordset.GetPrimaryKey method to determine the existing primary key for a data recordset, if one is specified. This method returns the primary key setting for the data recordset, as a value from the VisPrimaryKeySettings enumeration. You can use single or composite primary keys. A single key bases row identification on the values in a single column. A composite primary key uses two or more columns to identify a row uniquely.

If the primary key setting is visKeySingle or visKeyComposite, the method also returns an array of primary key column-name strings. If the primary key setting is visKeyRowOrder, the default, the method returns an empty array of primary keys.

Likewise, you can use the DataRecordset.SetPrimaryKey method to specify the primary key setting for the data recordset, as well as the name of the column or columns that you want to set as the primary key column or columns. Once again, when you set primary keys, make sure that the column or columns you pick to be primary key columns contain unique values (or value sets) for each row.

Refreshing Linked Data Programmatically

To refresh a connected data recordset programmatically, call the DataRecordset.Refresh method.

Calling this method executes the query string associated with the data recordset and then updates the linked shapes with the data returned by the query. Calling the Refresh method on a particular DataRecordset object results in refreshing all other DataRecordset objects associated with the same DataConnection object (that is, having the same value for their DataConnection property). DataRecordset objects sharing the same DataConnection property value are called transacted data recordsets.

If calling Refresh results in conflicts, Visio displays the Refresh Conflicts task pane in the UI, unless you set the RefreshSettings property to include the visRefreshNoReconciliationUI enumerated value.

Before you refresh linked data, if you want to change the query Visio uses to retrieve the data to query a different table in the same database, set the DataRecordset.CommandString property to a new value. To connect to an entirely new data source, set both the DataRecordset.CommandString and DataConnection.ConnectionString property values.

The DataRecordset.GetLastDataError method gets the Active X Data Objects (ADO) error code, ADO description, and data recordset ID associated with the most recent error that resulted from adding a new data recordset or refreshing the data in an existing one.

Identifying and Resolving Conflicts

When you or Visio refreshes data and a resulting conflict occurs, you can use the DataRecordset.GetAllRefreshConflicts and DataRecordset.GetMatchingRowsForRefreshConflict methods to determine why the conflict arose. The GetAllRefreshConflicts method returns an array of shapes for which a conflict exists between data in the shape and data in the data-recordset row to which the shape is linked. To determine which data-recordset rows produced the conflict, you can then pass each of these shapes to the GetMatchingRowsForRefreshConflict method, which returns an array of rows that are in conflict.

Rows in the data recordset can conflict when two or more of them have identical primary keys, and may link to the same shape. When this occurs, GetMatchingRowsForRefreshConflict returns an array containing at least two row IDs.

Conflicts can also occur when a previously data-linked row from the data recordset is removed. When this occurs, the method returns an empty array.

To remove the conflict, pass the shape to the DataRecordset.RemoveRefreshConflict method, which removes the conflicting information from the current document.


About Security Settings and Running Code in Visio

 Copy code hover
[image]

About Security Settings and Running Code in Visio
Send feedback

Creating secure applications is one of the primary challenges facing solution developers. Users, administrators, and developers are increasingly aware of the potential of unknowingly running code that can be harmful to their computers. It is more important than ever that you help to ensure the integrity of your applications.

Starting with Microsoft Office Visio 2007, all security settings are Office-wide and are set in the Trust Center (click the File tab, click Options, and then click Trust Center). Affected settings include the following:

  • Specifying trusted publishers

  • Specifying trusted locations

  • Loading COM add-ins

  • Loading published and path-discovered add-ons

  • Loading VBA macros

In previous versions of Visio, settings were made in the Security dialog box and the Security tab of the Options dialog box. As of Visio 2007, these dialog boxes have been eliminated.

For more information about settings in the Office Trust Center, see Security Notes for Microsoft Office Solution Developers.

For details about digitally signing code and trusted sources and publishers, search for "code signing" on MSDN, the Microsoft Developer Network Web site.

For more information about good security design practices and technologies, search for "security" on MSDN.

Additional Visio resources

  • To learn more about Visio add-ons and COM add-ins, see the MSDN article, Overview of Add-ons and COM Add-ins in Visio 2007.

  • To learn more about the RUNADDON function and the AddonName property, see the MSDN article Changes in the RUNADDON Function and the AddOnName Property for Visio 2002.


About the ThisDocument Object (Visio)

 Copy code hover
[image]

About the ThisDocument Object (Visio)
Send feedback

The Microsoft Visual Basic for Applications (VBA) project of every Visio document has a class module called ThisDocument. When referenced from code in the project, the ThisDocument object returns a reference to the project's Document object.

You can display the name of the VBA project's document in a message box by using the following statement, for example:

VBA Copy code Copy code
MsgBox ThisDocument.Name

You can get the first page of the VBA project's document by using the following code, for example:

VBA Copy code Copy code
Dim vsoPage As Visio.Page
Set vsoPage = ThisDocument.Pages.Item(1)

If you want to manipulate the document associated with your VBA project, use the ThisDocument object. If you want to manipulate a document, but not necessarily the document associated with your VBA project, get a Document object from the Documents collection.

The ActiveDocument property often, but not necessarily, returns a reference to the same document as the ThisDocument object. The ActiveDocument and ThisDocument objects are the same if the document shown in the Visio active window is the document containing the ThisDocument object's project. Whether your code uses the ActiveDocument or ThisDocument object depends on the purpose of your program.

Note Note

You can extend the set of properties and methods of a project's Document object by adding public properties and methods to that project's ThisDocument class module. The new methods and properties are exposed just like the built-in methods and properties implemented by Visio. The new methods and properties are not available when you reference other Document objects. The ThisDocument object is not available to code that is not part of the VBA project of a Visio document.


About the Visio Drawing Control

 Copy code hover
[image]

About the Visio Drawing Control
Send feedback

By using the Microsoft Visio Drawing Control, you can integrate the Visio drawing surface into your application.

The Visio Drawing Control is a Microsoft ActiveX control that provides full access to the Visio object model (API) and user interface so that you can integrate the Visio user interface, customize its appearance, and automate Visio in your applications. The Visio Drawing Control is provided with Microsoft Visio 2013, and is installed when you install Visio.

For more information about including the Visio Drawing Control in your application, see About Using the Visio Drawing Control in your Application in this Automation Reference.

Host container applications that support the Visio Drawing Control

You can embed the Visio Drawing Control in Microsoft Visual Basic 6.0, Microsoft Visual C++ 6.0, Microsoft Visual Studio, and other ActiveX control containers. However, you cannot embed the Visio Drawing Control in another Visio drawing, another ActiveX control, a Microsoft Visual Basic for Applications (VBA) form in Visio, or a Visio solution window.

Security considerations

The Visio Drawing Control is targeted for use in an intranet environment. The Visio Drawing Control does not support the IObjectSafety interface. Before it is run in any version of Internet Explorer, the control warns the user that it is an unsafe file (unless the end user's browser security level is set to Medium, Medium-Low, or Low).

Run-time requirements and distribution of your application

A version of Microsoft Visio that supports the Visio Drawing Control must be installed on any computer where the Visio Drawing Control will be used. When you distribute your application, all users must have licensed copies of a version of Visio that supports the Visio Drawing Control on their computers to use it.

Obtaining support

To obtain support for issues that you encounter while integrating the Visio Drawing Control into your application, contact Microsoft Product Support Services. For contact information, see the documentation that comes with the Visio product.


About the Visio Type Library

 Copy code hover
[image]

About the Visio Type Library
Send feedback

Microsoft Visio products include a type library that defines the objects, properties, methods, events, and constants that Visio exposes to Automation clients. To use the Visio type library, a development environment must reference it. The Microsoft Visual Basic for Applications (VBA) project of a Visio document automatically references the Visio type library. In other development environments you must take appropriate steps to reference the library.

The names of the libraries your VBA project references are displayed in the Project/Library list in the Object Browser in the Visual Basic Editor.

Benefits of using a type library

A type library is useful for the following reasons.

  • The information in a type library serves as input to object browsers supplied by VBA and other development environments. You can use object browsers to view descriptions of objects supplied by Automation servers (such as the Visio application) installed on your system. For example, you can view the syntax of a Visio property, method, or event and paste code shown by the browser into your program.

  • A type library allows development environments to bind your program's code to Automation server code at compile (design) time rather than dynamically at run time. The result is that your program often runs faster. For example, you can use Visio.Page, Visio.Shape, Visio.Document, and so on instead of Object.

Resolving object name ambiguities

Your Microsoft VBA project or Visual Basic program can reference many type libraries. Libraries sometimes declare items with the same name. For example, both Visio and Microsoft Excel expose an object called Application. When more than one library declares an item with the same name, VBA and Visual Basic bind the name to the library with the highest priority.

One way to resolve name ambiguities is to prefix object types with the corresponding library name. For example:

VBA Copy code Copy code
Dim vsoApplication As Visio.Application
Dim xlApplication As Excel.Application

If your code runs exclusively in the context of a VBA project of a Visio document, you don't have to prefix names of Visio object types with Visio, although it is a good idea. If you do this, the Visio type library has a higher priority than other libraries that may declare conflicting names. VBA does not let you change the priority of the Visio type library when you are using VBA within Visio, but in other development environments you can change the priority of the Visio type library.


About Units of Measure (Visio)

 Copy code hover
[image]

About Units of Measure (Visio)
Send feedback

When you insert fields into text or build formulas, you often specify units of measure for the values you type.

Microsoft Visio evaluates the result of a formula differently depending on the cell in which you enter the formula. In general, cells that represent shape position, a dimension, or an angle require a number-unit pair that consists of a number and the qualifying units needed to interpret the number. Many other cells don't require units and evaluate to a string, to TRUE or FALSE, or to an index. For example, the same formula that in the FillForegnd cell means color 5 from the drawing's color palette means TRUE (and locks the shape's width) in the LockWidth cell.

Always specify a unit of measure when you enter a formula in a cell that expects a dimensional value. If you do not specify a unit of measure, Visio uses the default unit for that cell, which can be page units, drawing units, type units, duration units, or angular units.

Units of measure

When indicating units of measure in ShapeSheet formulas, use the abbreviations listed in the following table.

To specify these units of measure | Use | Automation constant
Centimeters | cm | visCentimeters (69)
Ciceros | c | visCiceros (54)
Date or time | date | visDate (40)
Degrees | deg | visDegrees (81)
Didots | d | visDidots (53)
Elapsed weeks | ew | visElapsedWeek (43)
Elapsed days | ed | visElapsedDay (44)
Elapsed hours | eh | visElapsedHour (45)
Elapsed minutes | em | visElapsedMin (46)
Elapsed seconds | es | visElapsedSec (47)
Feet | ft | visFeet (66)
Inches | in | visInches (65)
Kilometers | km | visKilometers (72)
Meters | m | visMeters (71)
Miles | mi | visMiles (68)
Millimeters | mm | visMillimeters (70)
Minutes | ' | visMin (84)
Nautical miles | nm | visNautMiles (76)
Percent | % | visPercent (33)
Picas | p | visPicas (51)
Points | pt | visPoints (50)
Radians | rad | visRadians (83)
Seconds | " | visSec (85)
Yards | yd | visYards (75)

Compound units of measure

In formulas, you can express units of measure for compound numbers using the abbreviations in the following table. Visio simplifies the results and displays them in the compound units.

For example, if you enter 45.635°, Visio displays the equivalent value as 45° 38' 6".

To specify units | Use this abbreviation | Automation constant
Ciceros and didots | CICERO/DIDOT | visCicerosAndDidots (52)
Degrees, minutes, and seconds | ° | visDegreeMinSec (82)
Feet and inches | FEET/INCH | visFeetAndInches (67)
Picas and points | PICAPOINTS | visPicasAndPoints (49)

Fractional units of measure

You can specify fractional units of measure in the DrawingScale cell to affect the number of ruler subdivisions that Visio displays in the drawing window. By default, Visio divides distances into tenths when drawing its rulers. If you use fractional units of measure in the DrawingScale cell, Visio divides distance into the following:

  • Eighths for visInchFrac and visMileFrac

  • Twelfths for visFeetAndInches

Fractional units of measure have no effect in cells other than in the DrawingScale cell.

To specify fractional units | Use this abbreviation | Automation constant
Inches in fractions | IN_F | visInchFrac (73)
Miles in fractions | MI_F | visMileFrac (74)
Feet and inches | FEET/INCH | visFeetAndInches (67)

Multidimensional units of measure

In formulas, you can express units of measure for multidimensional numbers using the abbreviations in the following table. Visio simplifies the results and displays them in the multidimensional units.

To specify multidimensional units | Use this abbreviation | Automation constant
Acre | ACRE | visAcre (36)
Centimeters | SQ. CM., SQ CM, CM.^2, CM^2 | visCentimeters (69)
Feet | SQ. FT., SQ FT, FT.^2, FT^2 | visFeet (66)
Hectare | HECTARES, HECTARE, HA., HA | visHectare (37)
Inches | SQ. IN., SQ IN, IN.^2, IN^2 | visInches (65)
Kilometers | SQ. KM., SQ KM, KM.^2, KM ^2 | visKilometers (72)
Meters | SQ. M., SQ M, M.^2, M ^2 | visMeters (71)
Miles | SQ. MI., SQ MI, MI.^2, MI ^2 | visMiles (68)
Millimeters | SQ. MM., SQ MM, MM.^2, MM ^2 | visMillimeters (70)
Yards | SQ. YD., SQ YD, YD.^2, YD^2 | visYards (75)

Universal strings

In localized versions of Visio, the set of recognized strings changes with the language. If you want your program to work with multiple languages, use the universal strings for units of measure.

For | Use
Centimeters | CM
Ciceros | C
Ciceros and didots | CICERO/DIDOT
Date or time | DATE
Degrees | DEG
Degrees, minutes, seconds | °
Didots | D
Elapsed week | EW
Elapsed day | ED
Elapsed hour | EH
Elapsed minute | EM
Elapsed second | ES
Feet | FT
Feet and inches | FEET/INCH
Inches | IN
Inches in fractions | IN_F
Kilometers | KM
Meters | M
Miles | MI
Miles in fractions | MI_F
Millimeters | MM
Minutes | '
Nautical miles | NM
Percent | %
Picas | P
Picas and points | PICAPOINTS
Points | PT
Radians | RAD
Seconds | "
Yards | YD

Implicit units of measure

When Visio parses and stores a number-unit pair, it can use explicit units or implicit units. A number expressed in explicit units always is displayed in the units of measure that were originally entered. A number expressed in implicit units always converts to the equivalent value in the drawing, page, or angular units appropriate for the cell.

For example, suppose you enter the equivalent of 1 inch in cell A using explicit units and in cell B using implicit units, and that both cell A and cell B use drawing units. Next, you change the default units for the page to centimeters. Cell A still displays 1 in., because it uses explicit units that don't change with the defaults. Cell B now displays 2.54 cm, the equivalent value in the default units.

To enter units implicitly, use the following syntax.

VBA Copy code Copy code
                      number [unit, flag]
number | The original value, such as 3.7, 1.7E-4, or 5 1/2.
unit | The units in which number originally is expressed.
flag | The measurement system to use when the implicit-value unit is displayed. See below for values.

The element flag is one of the following letters (either uppercase or lowercase) indicating the measurement system that should be used when the implicit-value unit is displayed.

flag | Measurement system | Example
a, A | Angular | =5[deg,A]
d, D | Drawing | =5[in,D]
e, E | Duration | =5[eh,E]
p, P | Page | =5[in,P]
t, T | Type | =5[pt,T]

Additionally, you can use the implicit units DL, DP, DT, DA, DE for implicit drawing-, page-, text-, angular-, and time-units, respectively. These units assume the associated value is internal units. For example, if the current measurement system is centimeters, =2 DL would be interpreted as 2 internal units (inches) and displayed as 5.08 cm.

Using the implicit syntax described above, this expression (=2 DL) is equivalent to 2[in,d]. The implicit syntax gives you the choice of how to interpret the value, so you could also specify 2[ft,d], which would be interpreted as 2 feet, and displayed as 60.96 cm. The implicit units DL, DP, DT, DA, and DE are universal, and do not have localized counterparts.

Default units of measure

Following are the default units of measure along with their equivalent settings in the user interface.

Default unit of measure | User interface equivalent
visDrawingUnits | The units in the DrawingScale cell of the page or master containing the cell.
visPageUnits | The units selected in the Measurement units box on the Page Properties tab of the Page Setup dialog box (on the Design tab, click the Page Setup arrow).
visTypeUnits | The units selected in the Text box under Display on the Advanced tab of the Visio Options dialog box.
visAngleUnits | The units selected in the Angle box under Display on the Advanced tab of the Visio Options dialog box.
visDurationUnits | The units selected in the Duration box under Display on the Advanced tab of the Visio Options dialog box.


About Using the Visio Drawing Control in Your Application

 Copy code hover
[image]

About Using the Visio Drawing Control in Your Application
Send feedback

Microsoft Visio includes a Microsoft ActiveX control, the Microsoft Visio Drawing Control.

Using this control, you can embed the full functionality of the Visio drawing surface into your applications. You can take advantage of the full Visio object model (API) and you can pick the aspects of the Visio user interface you want to expose to better integrate Visio seamlessly into the user interface of your application.

Note Note

You can embed the Visio Drawing Control in Microsoft Visual Basic 6.0, Microsoft Visual C++ 6.0, Microsoft Visual Studio, and other ActiveX control containers. However, you cannot embed the Visio Drawing Control in another Visio drawing, another ActiveX control, a Microsoft Visual Basic for Applications (VBA) form in Visio, or a Visio solution window.

Getting started

To install the Visio Drawing Control, install Visio. When you install Visio, you can choose various installation options, including the Minimal Install option. If you want to minimize the installation file size of Visio on your computer, you can choose Minimal Install, which installs only the minimum required Visio components, including the Visio drawing application and the Visio Drawing Control. This installation option does not include Visio solutions or Microsoft Visio Help (which includes the Automation Reference and ShapeSheet Reference).

To add the Visio Drawing Control to the Toolbox in Visual Basic 6.0, on the Project menu, click Components, and then in the Controls list, select Microsoft Visio 15.0 Drawing Control Type Library. To make the control available in other development environments, consult the documentation that comes with your development product.

Once you have opened a Standard EXE project in Visual Basic and added the control to the Toolbox, double-click the control's icon to add an instance of the control to the form in your application. You can add multiple instances of the control, but they will share the same underlying Visio Application object. As a result, programmability objects and settings associated with one instance of the control will be reflected in other instances. For example, the Documents collection of the Application object will include the Document object associated with each instance of the control.

Opening a Visio drawing in the control

By default, the control opens a blank Visio document (drawing). However, you can specify, either at design time or at run time, that the control load an existing Visio document. The document you specify must be available to your users, either because you supply it along with your application, or because it exists on a network share they have access to, on an intranet site, or on the Web. To specify a document at design time, set the Src property in the Properties window in your Visual Basic project. This is the preferred method. To specify a drawing at run time, set the Src property in your code, usually in the Form_Load() procedure. More information about using the custom properties of the Visio Drawing Control is provided later in this topic, and in the Src property topic in this Automation Reference.

When you set the SRC property to load a file into the Visio Drawing Control, the control opens a copy of the file, but does not keep the original file open for writing. As a result, you cannot use the Document.Save method to save changes to a file loaded into the Visio Drawing Control. To save changes in a file, first use the SRC property to load the file into the Visio Drawing Control, and then set SRC to an empty string (""). To save the modified file to disk, use the Document.SaveAs method.

If you do not set the SRC property to an empty string after loading a drawing into the Visio Drawing Control, each time you close and reopen your application, the original drawing will be loaded, and any modifications you or your users have made will be lost.

By default, the control does not display the Visio startup screen or the Available Templates tab on startup. Furthermore, by default the control does not display a docked stencil pane on startup, but if you use the Src property to specify a drawing that already displays a docked stencil pane, that pane will be visible in the Visio Drawing Control window. To display the stencil pane in a blank drawing, use the Document.OpenStencilWindow method from the Visio object model.

By default, neither Visio menus nor Visio toolbars are displayed in the control (although shortcut menus are available). However, you can use the NegotiateMenus and NegotiateToolbars properties of the control to display these items. More information about using the custom properties of the Visio Drawing Control is provided later in this topic, and in the NegotiateMenus property and NegotiateToolbars property topics in this Automation Reference.

Note Note

Starting in Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You can insert multiple instances of the Visio Drawing Control in your application. However, each instance of the control can display only one drawing window and one document.

Gaining access to the Visio object model

To gain access to the Visio object model, use the Window or Document property of the Visio Drawing Control. Use the following code to get a Visio Window object:

Copy code Copy code
Dim vsoWindow As Visio.Window
Set vsoWindow = DrawingControl1.Window

Use the following code to get a Visio Document object:

Copy code Copy code
Dim vsoDocument As Visio.Document
Set vsoDocument = DrawingControl1.Document

Once you have either of these objects, you can use the Application property of either object to get the Visio Application object:

Copy code Copy code
vsoWindow.Application
vsoDocument.Application

With these objects you have access to all the rest of the Visio object model. For example, if you want to modify the Visio user interface to display only the white Visio drawing surface, without the grid, scrollbars, rulers, and page tabs, you can use the following code in the Form_Load() procedure:

Copy code Copy code
Dim vsoWindow As Visio.Window
Set vsoWindow = DrawingControl1.Window
vsoWindow.ShowGrid = False
vsoWindow.ShowPageTabs = False
vsoWindow.ShowRulers = False
vsoWindow.ShowScrollBars = False

Visio events, including keyboard and mouse events, are available directly as members of the DrawingControl object.

Once you have access to the Visio object model, you can use all the standard objects, methods, properties, and events of the model to automate and customize the control in your program. For more information about using the objects and members of the Visio object model, see the specific object or member topic in this Automation Reference.

Because it is intended to be embedded in another application, the Visio Drawing control does not expose the Visual Basic Editor in Visio. As a result, Visual Basic for Applications (VBA) macros in an existing Visio drawing that is opened in the control will not run.

In addition, the Visio Drawing Control does not expose the Visio ShapeSheet in the user interface. However, you can use Automation to get and set values and formulas in ShapeSheet cells.

Using the custom properties of the Visio Drawing Control

The following table describes the custom properties exposed by the Visio Drawing Control.

Property | Description
Document | Read-only. Returns the Visio Document object associated with the instance of the Visio Drawing Control.
HostID | Read/write. String. Returns or sets the GUID or other string assigned to the registry key that identifies the host container application (your executable program). The default is an empty string.
NegotiateMenus | Read/write. Boolean. Specifies whether the control can merge menus with those of the host container application. The default is False.
NegotiateToolbars | Read/write. Boolean. Specifies whether the control can merge toolbars with those of the host container application. The default is False.
PageSizingBehavior | Read/write. Enumerated type VisPageSizingBehavior. Specifies how pages are sized and how shapes are sized and positioned when existing Visio drawings are loaded into instances of the control.
Src | Read/write. String. Specifies the path to and file name of the existing Visio drawing that is loaded into an instance of the control at run time. The default is an empty string.
Window | Read-only. Returns the Visio Window object associated with the instance of the Visio Drawing Control. The Window property is accessible only when the control is in-place active.

For more information about any of these custom properties, and to view code examples that show how to use them, see the specific topics associated with these properties in this Automation Reference.

Using keyboard and mouse events with the Visio Drawing Control

Beginning with Visio 2003, new keyboard and mouse events added to the Visio object model give your program the ability to respond to user keyboard and mouse input in the control. For example, you can listen for mouse clicks specific shapes in the control and write code to handle them. (For more information about how to use these events to drive actions in your host application, see the next section in this topic.)

The following new events are available:

  • KeyDown

  • KeyPress

  • KeyUp

  • MouseDown

  • MouseMove

  • MouseUp

These events are similar to the Visual Basic events that have the same names, although they take different arguments. To view the syntax, and for additional information about these events, see the specific topics associated with them in this Automation Reference. For more information about the Visual Basic events, consult Visual Basic Help.

Integrating the Visio Drawing Control into the user interface of your application

You can use events or status changes in your host application to modify a drawing in the Visio Drawing Control. In addition, you can use events in the Visio Drawing Control to drive actions or changes in your host application. For example, you can use mouse events or keyboard events in the Visio Drawing Control to display user interface elements such as forms and message boxes in your host application. The following code shows how to handle a MouseDown event (a mouse click) in the Visio Drawing Control to display a message box in your Visual Basic 6.0 application.

Copy code Copy code
Private Sub DrawingControl1_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

  MsgBox "You have clicked the mouse.", , "Drawing Control Event"

End Sub


DoCmd/DOCMD Commands

 Copy code hover
[image]

DoCmd/DOCMD Commands
Send feedback

The following table contains the list of supported commands for use with the DOCMD function (ShapeSheet interface) and the DoCmd method (Automation interface), along with information about the contexts in which they are supported.

The DOCMD function takes a numeric argument only; the DoCmd method takes either a constant or numeric value.

Member of VisUICmds | Value | Automation | ShapeSheet
visCmdABarAutoHeight | 1684 | Yes | No
visCmdABarAutohide | 1652 | Yes | No
visCmdABarHide | 1650 | Yes | No
visCmdABarToggleFloat | 1651 | Yes | No
visCmdAcquireImages | 1868 | Yes | Yes
visCmdAddConnectPt | 1263 | Yes | No
visCmdAddControlPt | 1266 | Yes | No
visCmdAddDataRecordset | 1998 | Yes | No
visCmdAddMemberToContainer | 2173 | Yes | No
visCmdAddTextShape | 1181 | Yes | No
visCmdAddToAllContainers | 2251 | Yes | No
visCmdAddToNewContainer | 2268 | Yes | No
visCmdAlignBox | 1768 | Yes | No
visCmdAlignObjectBottom | 1201 | Yes | No
visCmdAlignObjectCenter | 1197 | Yes | No
visCmdAlignObjectLeft | 1196 | Yes | No
visCmdAlignObjectMiddle | 1200 | Yes | No
visCmdAlignObjectRight | 1198 | Yes | No
visCmdAlignObjectTop | 1199 | Yes | No
visCmdAllowThemes | 2056 | Yes | No
visCmdApplyDataGraphic | 2017 | Yes | No
visCmdApplyDataGraphicAfterLink | 2092 | Yes | No
visCmdApplyMainTheme | 2285 | Yes | No
visCmdApplyMainThemeToDocument | 2296 | Yes | No
visCmdApplyMainThemeToPage | 2289 | Yes | No
visCmdApplyThemeColors | 2188 | Yes | No
visCmdApplyThemeEffects | 2189 | Yes | No
visCmdApplyThemeToDoc | 2048 | Yes | No
visCmdApplyThemeToNewShapesToggle | 2297 | Yes | No
visCmdApplyThemeToPage | 2047 | Yes | No
visCmdAppMaximize | 1864 | Yes | No
visCmdAppMinimize | 1865 | Yes | No
visCmdAppRestore | 1904 | Yes | No
visCmdAssociateCallout | 2287 | Yes | No
visCmdAutoAlign | 2223 | Yes | No
visCmdAutoAlignAndSpace | 2222 | Yes | No
visCmdAutoConnectToggle | 2091 | Yes | No
visCmdAutoGenerateDataGraphics | 2105 | Yes | No
visCmdAutoSpace | 2224 | Yes | No
visCmdBreakOLELink | 1900 | Yes | No
visCmdBrowseSampleDrawings | 1645 | Yes | No
visCmdBullets | 1633 | Yes | No
visCmdCancelInPlaceEditing | 1602 | Yes | No
visCmdCenterDrawing | 1202 | Yes | No
visCmdCloseInkToolsRibbonTab | 2213 | Yes | No
visCmdCloseWindow | 1361 | Yes | No
visCmdCollapseShapesWindow | 2269 | Yes | No
visCmdConnectorEffectCurved | 1945 | Yes | No
visCmdConnectorEffectRightAngle | 1943 | Yes | No
visCmdConnectorEffectStraight | 1944 | Yes | No
visCmdConnPoints | 1774 | Yes | No
visCmdContainerNoHeadingToggle | 2315 | Yes | No
visCmdContainerAutoResizeExpandContract | 2349 | Yes | No
visCmdContainerAutoResizeExpandOnly | 2348 | Yes | No
visCmdContainerAutoResizeOff | 2347 | Yes | No
visCmdCreateEditMaster | 1899 | Yes | No
visCmdCreateNewDrawing | 1812 | Yes | No
visCmdCreateShortcut | 1791 | Yes | No
visCmdCropObject | 1192 | Yes | No
visCmdCropTool | 1449 | Yes | No
visCmdCustomPropertySets | 1675 | Yes | No
visCmdCustProp | 1658 | Yes | No
visCmdCustPropDefine | 1695 | Yes | No
visCmdDataAutoConnect | 2098 | Yes | No
visCmdDataAutoLink | 2046 | Yes | No
visCmdDataAutoLinkWiz | 2045 | Yes | No
visCmdDataColumnSettingsDlg | 2043 | Yes | Yes
visCmdDataExplorerWindow | 2044 | Yes | No
visCmdDataRecordsetProperties | 2072 | Yes | Yes
visCmdDataRecordsetSetCommand | 2037 | Yes | No
visCmdDataRecordsetSetPrimaryKey | 2038 | Yes | No
visCmdDataRefresh | 2021 | Yes | No
visCmdDataRefreshAddConflict | 2094 | Yes | No
visCmdDataRefreshConfigDlg | 2022 | Yes | No
visCmdDataRefreshDeleteConflict | 2095 | Yes | No
visCmdDataRefreshDlg | 2019 | Yes | Yes
visCmdDataRefreshResolveConflict | 2103 | Yes | No
visCmdDataSelectorDlg | 2011 | Yes | No
visCmdDataUnlinkRow | 2058 | Yes | No
visCmdDataUnlinkShape | 2057 | Yes | No
visCmdDecreaseIndent | 1093 | Yes | No
visCmdDecreaseParaSpacing | 1095 | Yes | No
visCmdDelConnectPt | 1265 | Yes | No
visCmdDeleteBackWord | 1905 | Yes | No
visCmdDeleteComment | 1920 | Yes | No
visCmdDeleteConnectors | 2199 | Yes | No
visCmdDeleteDataGraphic | 2067 | Yes | No
visCmdDeleteDataRecordset | 1999 | Yes | No
visCmdDeleteForwardWord | 2114 | Yes | No
visCmdDeleteTheme | 2052 | Yes | No
visCmdDeselectAll | 1213 | Yes | No
visCmdDesignMode | 1388 | Yes | No
visCmdDetectAndRepair | 1890 | Yes | No
visCmdDiagramFlipHorizontal | 2229 | Yes | No
visCmdDiagramFlipVertical | 2228 | Yes | No
visCmdDiagramGallery | 1982 | Yes | No
visCmdDiagramRotateLeft | 2227 | Yes | No
visCmdDiagramRotateRight | 2226 | Yes | No
visCmdDisbandContainer | 2204 | Yes | No
visCmdDistributeBottom | 1238 | Yes | No
visCmdDistributeCenter | 1233 | Yes | No
visCmdDistributeHSpace | 1231 | Yes | No
visCmdDistributeLeft | 1232 | Yes | No
visCmdDistributeMiddle | 1237 | Yes | No
visCmdDistributeRight | 1234 | Yes | No
visCmdDistributeTop | 1236 | Yes | No
visCmdDistributeVSpace | 1235 | Yes | No
visCmdDlgCustomFit | 1536 | Yes | No
visCmdDragDuplicate | 1184 | Yes | No
visCmdDrawFillStyle | 1123 | Yes | No
visCmdDrawGlue | 1125 | Yes | No
visCmdDrawAddGuide | 1180 | Yes | No
visCmdDrawingExplorer | 1721 | Yes | No
visCmdDrawingTools | 1946 | Yes | No
visCmdDrawLineStyle | 1122 | Yes | No
visCmdDrawOval | 1183 | Yes | No
visCmdDrawSnap | 1124 | Yes | No
visCmdDrawRect | 1182 | Yes | No
visCmdDrawRegion | 1742 | Yes | No
visCmdDrawTextStyle | 1121 | Yes | No
visCmdDrawZoom | 1126 | Yes | No
visCmdDRConnectionTool | 1226 | Yes | No
visCmdDRConnectorTool | 1225 | Yes | No
visCmdDRLineTool | 1221 | Yes | No
visCmdDropAndContain | 2172 | Yes | No
visCmdDropAndInsertIntoList | 2196 | Yes | No
visCmdDropCallout | 2286 | Yes | No
visCmdDropManyOnPage | 1869 | Yes | No
visCmdDropManyLinked | 2108 | Yes | No
visCmdDropOnPage | 1246 | Yes | No
visCmdDropOnStencil | 1244 | Yes | No
visCmdDropOnText | 1243 | Yes | No
visCmdDROvalTool | 1224 | Yes | No
visCmdDRPencilTool | 1220 | Yes | No
visCmdDRPointerTool | 1219 | Yes | No
visCmdDRQtrArcTool | 1222 | Yes | No
visCmdDRRectTool | 1223 | Yes | No
visCmdDRRotateTool | 1228 | Yes | No
visCmdDRSplineTool | 1311 | Yes | No
visCmdDRTextTool | 1227 | Yes | No
visCmdDuplicateDataGraphic | 2106 | Yes | No
visCmdDuplicateTheme | 2050 | Yes | No
visCmdEditUndoMultiple | 1682 | Yes | No
visCmdDynamicGrid | 1765 | Yes | No
visCmdDynConnReroute | 1829 | Yes | No
visCmdEditConvertObject | 1439 | Yes | Yes
visCmdEditFind | 1043 | Yes | Yes
visCmdEditInsertField | 1032 | Yes | Yes
visCmdEditInsertObject | 1031 | Yes | Yes
visCmdEditLinks | 1030 | Yes | Yes
visCmdEditOpenObject | 1029 | Yes | No
visCmdEditPasteLink | 1028 | Yes | No
visCmdEditPasteSpecial | 1027 | Yes | Yes
visCmdEditRedo | 1018 | Yes | No
visCmdEditRedoMultiple | 1683 | Yes | No
visCmdEditRedoOrRepeat | 2295 | Yes | No
visCmdEditRepeat | 1019 | Yes | No
visCmdEditReplace | 1179 | Yes | Yes
visCmdEditSelectSpecial | 1026 | Yes | Yes
visCmdEditTheme | 2049 | Yes | No
visCmdEditThemeColors | 2190 | Yes | No
visCmdEditThemeEffects | 2191 | Yes | No
visCmdEditUndo | 1017 | Yes | No
visCmdExportDatabaseAddon | 1891 | Yes | Yes
visCmdFileCheckin | 1787 | Yes | Yes
visCmdFileCheckout | 1788 | Yes | Yes
visCmdFileChooseTemplates | 1583 | Yes | Yes
visCmdFileClose | 1003 | Yes | No
visCmdFileExit | 1016 | Yes | No
visCmdFileImport | 1007 | Yes | Yes
visCmdFileLastFile1 | 1012 | Yes | No
visCmdFileLastFile10 | 2127 | Yes | No
visCmdFileLastFile11 | 2128 | Yes | No
visCmdFileLastFile12 | 2129 | Yes | No
visCmdFileLastFile13 | 2130 | Yes | No
visCmdFileLastFile14 | 2131 | Yes | No
visCmdFileLastFile15 | 2132 | Yes | No
visCmdFileLastFile16 | 2133 | Yes | No
visCmdFileLastFile17 | 2134 | Yes | No
visCmdFileLastFile18 | 2136 | Yes | No
visCmdFileLastFile19 | 1012 | Yes | No
visCmdFileLastFile2 | 1013 | Yes | No
visCmdFileLastFile20 | 2137 | Yes | No
visCmdFileLastFile3 | 1014 | Yes | No
visCmdFileLastFile4 | 1015 | Yes | No
visCmdFileLastFile5 | 1561 | Yes | No
visCmdFileLastFile6 | 1569 | Yes | No
visCmdFileLastFile7 | 1570 | Yes | No
visCmdFileLastFile8 | 1571 | Yes | No
visCmdFileLastFile9 | 1572 | Yes | No
visCmdFileNew | 1001 | Yes | No
visCmdFileNewBlankDrawing | 1579 | Yes | No
visCmdFileNewBlankDrawingMetric | 1671 | Yes | No
visCmdFileNewBlankDrawingUS | 1672 | Yes | No
visCmdFileNewBlankStencil | 1582 | Yes | No
visCmdFileNewBlankStencilMetric | 1673 | Yes | No
visCmdFileNewBlankStencilUS | 1674 | Yes | No
visCmdFileNewStencilDlg | 1580 | Yes | Yes
visCmdFileOpen | 1002 | Yes | Yes
visCmdFileOpenStencil | 1442 | Yes | Yes
visCmdFilePrint | 1010 | Yes | No
visCmdFileSave | 1004 | Yes | Yes
visCmdFileSaveAs | 1005 | Yes | Yes
visCmdFileSaveAsDrawing | 2306 | Yes | No
visCmdFileSaveAsDrawingPreviousFileFormat | 2298 | Yes | No
visCmdFileSaveAsDWG | 2305 | Yes | No
visCmdFileSaveAsEMF | 2302 | Yes | No
visCmdFileSaveAsJPG | 2301 | Yes | No
visCmdFileSaveAsPNG | 2300 | Yes | No
visCmdFileSaveAsSVG | 2303 | Yes | No
visCmdFileSaveAsTemplate | 2299 | Yes | No
visCmdFileSaveAsVDX | 2304 | Yes | No
visCmdFileSaveAsWebPage | 1785 | Yes | Yes
visCmdFileSummaryInfoDlg | 1009 | Yes | Yes
visCmdFileUndoCheckout | 2109 | Yes | No
visCmdFirstTile | 1515 | Yes | No
visCmdFitContainerToContents | 2195 | Yes | No
visCmdFitCurve | 1538 | Yes | No
visCmdFormatAllTextProps | 1642 | Yes | Yes
visCmdFormatBehavior | 1071 | Yes | Yes
visCmdFormatBlock | 1070 | Yes | Yes
visCmdFormatCorners | 1334 | Yes | Yes
visCmdFormatCustPropDef | 1687 | Yes | Yes
visCmdFormatCustPropEdit | 1312 | Yes | Yes
visCmdFormatDefineStyles | 1064 | Yes | Yes
visCmdFormatDoubleClick | 1118 | Yes | Yes
visCmdFormatFill | 1066 | Yes | Yes
visCmdFormatInkDlg | 1955 | Yes | Yes
visCmdFormatLine | 1065 | Yes | Yes
visCmdFormatPainter | 1271 | Yes | No
visCmdFormatParagraph | 1068 | Yes | Yes
visCmdFormatPictureAutobalance | 2205 | Yes | Yes
visCmdFormatPictureCompressionDlg | 2212 | Yes | Yes
visCmdFormatProtection | 1072 | Yes | Yes
visCmdFormatShadow | 1333 | Yes | Yes
visCmdFormatSpecial | 1073 | Yes | Yes
visCmdFormatStyle | 1063 | Yes | Yes
visCmdFormatTabs | 1069 | Yes | Yes
visCmdFormatText | 1067 | Yes | Yes
visCmdFullScreenMode | 1492 | Yes | No
visCmdGoToPageToolbar | 1635 | Yes | No
visCmdGrid | 1767 | Yes | No
visCmdGuides | 1771 | Yes | No
visCmdHeaderFooter | 1720 | Yes | No
visCmdHelpAboutVisio | 1100 | Yes | No
visCmdHelpContents | 1092 | Yes | No
visCmdHelpMode | 1386 | Yes | No
visCmdHelpSearch | 1809 | Yes | No
visCmdHelpShapeBasics | 1822 | Yes | No
visCmdHelpTemplates | 1586 | Yes | No
visCmdHideAllToolbars | 1726 | Yes | No
visCmdHideDocumentStencil | 1689 | Yes | No
visCmdHideMoreShapes | 2291 | Yes | No
visCmdHyperlinkHier | 1611 | Yes | No
visCmdHyperlinkList | 1719 | Yes | No
visCmdIconBucketTool | 1543 | Yes | No
visCmdIconLassoTool | 1544 | Yes | No
visCmdIconLeftColor | 1143 | Yes | No
visCmdIconPencilTool | 1145 | Yes | No
visCmdIconRightTool | 1144 | Yes | No
visCmdIconSelectNet | 1545 | Yes | No
visCmdIgnoreValidationIssue | 2254 | Yes | No
visCmdIgnoreValidationRule | 2256 | Yes | No
visCmdImageProperties | 1887 | Yes | No
visCmdImagePropertiesDlg | 1883 | Yes | Yes
visCmdIncreaseIndent | 1094 | Yes | No
visCmdIncreaseParaSpacing | 1096 | Yes | No
visCmdINETAddToFavorites | 1506 | Yes | No
visCmdINETCopyHyperlink | 1610 | Yes | No
visCmdINETDeleteHlink | 1609 | Yes | No
visCmdINETDiagrammingResources | 1606 | Yes | No
visCmdINETEditHyperlink | 1619 | Yes | Yes
visCmdINETGoBack | 1599 | Yes | No
visCmdINETGoForward | 1598 | Yes | No
visCmdINETKnowledgeBase | 1605 | Yes | No
visCmdINETOpenHLink | 1607 | Yes | No
visCmdINETOpenHLinkNewWnd | 1608 | Yes | No
visCmdINETPasteAsHyperlink | 1620 | Yes | No
visCmdINETUserSearchPage | 1595 | Yes | No
visCmdINETVisioHomePage | 1596 | Yes | No
visCmdINETVisioOnTheWeb | 1831 | Yes | No
visCmdINETVisioSolutionsLibrary | 1604 | Yes | No
visCmdInkEraser | 1970 | Yes | No
visCmdInkReviewPen | 1971 | Yes | No
visCmdInkStockPen0 | 1973 | Yes | No
visCmdInkStockPen1 | 1974 | Yes | No
visCmdInkTool | 1661 | Yes | No
visCmdInsertAutoCADAddOn | 1521 | Yes | Yes
visCmdInsertCheckBoxControl | 2150 | Yes | Yes
visCmdInsertClipArt | 1497 | Yes | Yes
visCmdInsertClipArtDlg | 2345 | Yes | Yes
visCmdInsertComboBoxControl | 2152 | Yes | Yes
visCmdInsertComment | 1501 | Yes | No
visCmdInsertControlDlg | 1522 | Yes | Yes
visCmdInsertDataMap | 1282 | Yes | Yes
visCmdInserTextBoxControl | 2145 | Yes | Yes
visCmdInsertHyperLink | 1585 | Yes | Yes
visCmdInsertImageControl | 2148 | Yes | Yes
visCmdInsertLabelControl | 2144 | Yes | Yes
visCmdInsertLegendHorizontal | 2331 | Yes | Yes
visCmdInsertLegendVertical1 | 2335 | Yes | Yes
visCmdInsertListBoxControl | 2153 | Yes | Yes
visCmdInsertMemberIntoList | 2174 | Yes | Yes
visCmdInsertMicrosoftGraph | 1499 | Yes | Yes
visCmdInsertNewBackgroundPage | 2165 | Yes | Yes
visCmdInsertPageTab | 2202 | Yes | Yes
visCmdInsertPushButtonControl | 2147 | Yes | Yes
visCmdInsertRadioButtonControl | 2151 | Yes | Yes
visCmdInsertScrollBarControl | 2149 | Yes | Yes
visCmdInsertSpinControl | 2146 | Yes | Yes
visCmdInsertTextBox | 2006 | Yes | Yes
visCmdInsertToggleButtonControl | 2154 | Yes | Yes
visCmdInsertVertTextBox | 2007 | Yes | Yes
visCmdInsertWordArt | 1498 | Yes | Yes
visCmdIntersect | 1453 | Yes | No
visCmdJoin | 1533 | Yes | No
visCmdLanguagePreferencesDlg | 2363 | Yes | No
visCmdLast | 65535 | Yes | No
visCmdLastTile | 1516 | Yes | No
visCmdLayerDlg | 1446 | Yes | Yes
visCmdLayerSetupDlg | 1448 | Yes | Yes
visCmdLayoutDynamic | 1493 | Yes | No
visCmdLinkRowToShape | 1997 | Yes | No
visCmdListInsertAfter | 2271 | Yes | No
visCmdListInsertBefore | 2270 | Yes | No
visCmdLockContainer | 2220 | Yes | No
visCmdMasterExplorer | 1916 | Yes | No
visCmdMasterSetup | 1343 | Yes | No
visCmdMDIMaximize | 1901 | Yes | No
visCmdMDIMinimize | 1902 | Yes | No
visCmdMDIRestore | 1903 | Yes | No
visCmdMinimizeRibbonToggle | 2232 | Yes | No
visCmdModConnectPt | 1264 | Yes | No
visCmdModControlPt | 1267 | Yes | No
visCmdMovConnectPt | 1269 | Yes | No
visCmdMove1D | 1186 | Yes | No
visCmdMove2D | 1187 | Yes | No
visCmdMoveComment | 1502 | Yes | No
visCmdMoveObject | 1185 | Yes | No
visCmdMsoAutoCorrect | 1872 | Yes | No
visCmdMsoAutoCorrectDlg | 1866 | Yes | Yes
visCmdMsoAutoFormat | 1873 | Yes | No
visCmdMsoCustomItem | 1896 | Yes | No
visCmdMSOInsertEquation | 1646 | Yes | Yes
visCmdMSOInsertSymbol | 1504 | Yes | No
visCmdMSOInsertSymbolDlg | 1505 | Yes | No
visCmdMsoMediaGallery | 1885 | Yes | No
visCmdMultipleFileImport | 2201 | Yes | No
visCmdNewDefDocBlankDrawing | 1906 | Yes | No
visCmdNewForegroundPage | 2361 | Yes | No
visCmdNewFromExisting | 1897 | Yes | No
visCmdNewThemeColors | 2065 | Yes | No
visCmdNewThemeEffects | 2064 | Yes | No
visCmdNextCommentMarkup | 2180 | Yes | No
visCmdNextMarkup | 1914 | Yes | No
visCmdNextTile | 1514 | Yes | No
visCmdNextWindow | 1886 | Yes | No
visCmdObjectAddToGroup | 1053 | Yes | No
visCmdObjectAlignObjects | 1049 | Yes | Yes
visCmdObjectBringForward | 1045 | Yes | Yes
visCmdObjectBringToFront | 1046 | Yes | Yes
visCmdObjectCombine | 1061 | Yes | No
visCmdObjectConnectObjects | 1050 | Yes | No
visCmdObjectConvertToGroup | 1055 | Yes | No
visCmdObjectDistributeDlg | 1230 | Yes | Yes
visCmdObjectFlipHorizontal | 1058 | Yes | Yes
visCmdObjectFlipVertical | 1057 | Yes | Yes
visCmdObjectFragment | 1062 | Yes | No
visCmdObjectGroup | 1051 | Yes | No
visCmdObjectHelp | 1428 | Yes | No
visCmdObjectInfoDlg | 1425 | Yes | Yes
visCmdObjectRemoveFromGroup | 1054 | Yes | No
visCmdObjectReverse | 1059 | Yes | No
visCmdObjectRotate90 | 1056 | Yes | Yes
visCmdObjectSendBackward | 1047 | Yes | Yes
visCmdObjectSendToBack | 1048 | Yes | Yes
visCmdObjectSwapEnds | 1870 | Yes | No
visCmdObjectUngroup | 1052 | Yes | Yes
visCmdObjectUnion | 1060 | Yes | No
visCmdOfficeCenterOptions | 2141 | Yes | No
visCmdOffsetDlg | 1387 | Yes | No
visCmdOfficeDiagnostics | 1890 | Yes | No
visCmdOpenActiveObject | 1601 | Yes | No
visCmdOpenCommentForEdit | 1503 | Yes | No
visCmdOpenInVisio | 1491 | Yes | No
visCmdOptionsColorPaletteDlg | 1082 | Yes | Yes
visCmdOptionsDeletePages | 1079 | Yes | Yes
visCmdOptionsEditBackground | 1075 | Yes | No
visCmdOptionsEditDrawing | 1074 | Yes | No
visCmdOptionsGoToDrawing | 1077 | Yes | Yes
visCmdOptionsNewPage | 1078 | Yes | Yes
visCmdOptionsPageSetup | 1076 | Yes | Yes
visCmdOptionsPreferences | 1081 | Yes | Yes
visCmdOptionsProtectDocument | 1083 | Yes | Yes
visCmdOptionsReorderPages | 1080 | Yes | Yes
visCmdOptionsSnapGlueSetup | 1084 | Yes | Yes
visCmdPageAutoSizeToggle | 2333 | Yes | Yes
visCmdPageMeasureUnitsDlg | 1274 | Yes | Yes
visCmdPageSizeDlg | 2176 | Yes | No
visCmdPageSizeToFitDrawing | 2332 | Yes | No
visCmdPagesList | 1654 | Yes | No
visCmdPanObject | 1193 | Yes | No
visCmdPanZoom | 1653 | Yes | No
visCmdPasteShortcut | 1790 | Yes | No
visCmdPasteToLocation | 2221 | Yes | No
visCmdPauseRecordingMacro | 1778 | Yes | No
visCmdPreviousCommentMarkup | 2179 | Yes | No
visCmdPreviousMarkup | 1915 | Yes | No
visCmdPreviousTile | 1513 | Yes | No
visCmdPrintPage | 1443 | Yes | No
visCmdPrintPreview | 1490 | Yes | No
visCmdProgRefHelp | 1584 | Yes | No
visCmdPublishToProcessRepository | 2294 | Yes | No
visCmdPublishToVisioServices | 2293 | Yes | No
visCmdRecalcObjectWH | 1146 | Yes | No
visCmdRecordNewMacro | 1775 | Yes | Yes
visCmdReinstateValidationIssue | 2255 | Yes | No
visCmdRelayoutShapes | 2068 | Yes | No
visCmdRemoveDataGraphicFromSel | 2107 | Yes | No
visCmdRemoveFromAllContainers | 2252 | Yes | No
visCmdRemoveMemberFromContainer | 2175 | Yes | No
visCmdRemoveMemberFromList | 2346 | Yes | No
visCmdRemoveThemeFromSel | 2119 | Yes | No
visCmdRemoveVBAFromActiveDoc | 1590 | Yes | No
visCmdReorderList | 2197 | Yes | No
visCmdRHI | 2009 | Yes | No
visCmdRHIDlg | 2010 | Yes | No
visCmdReOrderPage | 1795 | Yes | No
visCmdResearchLookUp | 1967 | Yes | No
visCmdResearchThesaurus | 2178 | Yes | No
visCmdResearchTranslate | 1968 | Yes | No
visCmdResumeRecordingMacro | 1779 | Yes | No
visCmdReviewerVisibilityAll | 1836 | Yes | No
visCmdReviewerVisibilityNone | 1919 | Yes | No
visCmdRightDragCancel | 1881 | Yes | No
visCmdRightDragCopy | 1879 | Yes | No
visCmdRightDragLink | 1880 | Yes | No
visCmdRightDragMove | 1878 | Yes | No
visCmdRotate90Clockwise | 1494 | Yes | No
visCmdRotateObject | 1190 | Yes | No
visCmdRulerGridDlg | 1318 | Yes | Yes
visCmdRulSub | 1766 | Yes | No
visCmdRunAddOnDlg | 1484 | Yes | Yes
visCmdRunAddonMenu | 1090 | Yes | No
visCmdSaveAsFixedFormatDlg | 2117 | Yes | Yes
visCmdSaveForAutoRecover | 1857 | Yes | No
visCmdSelectContainerMembers | 2219 | Yes | No
visCmdSelectionModeExtend | 1909 | Yes | No
visCmdSelectionModeLasso | 1908 | Yes | No
visCmdSelectionModeRect | 1907 | Yes | No
visCmdSendAsMail | 1292 | Yes | No
visCmdSetAddMarkup | 1744 | Yes | No
visCmdSetCharColor | 1404 | Yes | No
visCmdSetCharSizeDown | 1406 | Yes | No
visCmdSetCharSizeUp | 1405 | Yes | No
visCmdSetContainerProperties | 2181 | Yes | No
visCmdSetDynConnAppearanceCurved | 1895 | Yes | No
visCmdSetDynConnAppearanceDefault | 1893 | Yes | No
visCmdSetDynConnAppearanceStraight | 1894 | Yes | No
visCmdSetDynConnLineJumpStyle_2pt | 1713 | Yes | No
visCmdSetDynConnLineJumpStyle_3pt | 1714 | Yes | No
visCmdSetDynConnLineJumpStyle_4pt | 1715 | Yes | No
visCmdSetDynConnLineJumpStyle_5pt | 1716 | Yes | No
visCmdSetDynConnLineJumpStyle_6pt | 1717 | Yes | No
visCmdSetDynConnLineJumpStyle_Arc | 1709 | Yes | No
visCmdSetDynConnLineJumpStyle_Gap | 1710 | Yes | No
visCmdSetDynConnLineJumpStyle_Page | 1708 | Yes | No
visCmdSetDynConnLineJumpStyle_Square | 1711 | Yes | No
visCmdSetDynConnLineJumpStyle_Triangle | 1712 | Yes | No
visCmdSetDynConnRerouteAsNeeded | 1697 | Yes | No
visCmdSetDynConnRerouteFreely | 1696 | Yes | No
visCmdSetDynConnRerouteNever | 1698 | Yes | No
visCmdSetDynConnRerouteOnCrossover | 1837 | Yes | No
visCmdSetDynConnRoutingStyle | 1700 | Yes | No
visCmdSetFillColor | 1385 | Yes | No
visCmdSetFillPattern | 1399 | Yes | No
visCmdSetFillShadow | 1379 | Yes | No
visCmdSetHeaderFooter | 1858 | Yes | No
visCmdSetIndexInStencil | 1871 | Yes | No
visCmdSetLanguageDlg | 1888 | Yes | No
visCmdSetLineColor | 1359 | Yes | No
visCmdSetLineCornerStyle | 1358 | Yes | No
visCmdSetLineEnds | 1357 | Yes | No
visCmdSetLinePattern | 1356 | Yes | No
visCmdSetLineWeight | 1355 | Yes | No
visCmdSetPageLineJumpCode_D | 1703 | Yes | No
visCmdSetPageLineJumpCode_Horz | 1705 | Yes | No
visCmdSetPageLineJumpCode_Last | 1707 | Yes | No
visCmdSetPageLineJumpCode_None | 1704 | Yes | No
visCmdSetPageLineJumpCode_Vert | 1706 | Yes | No
visCmdSetPageOrientation | 2170 | Yes | No
visCmdSetPagePlow | 1699 | Yes | No
visCmdSetPageSize | 2171 | Yes | No
visCmdShapeActions | 1309 | Yes | No
visCmdShapeComment | 1686 | Yes | No
visCmdShapeCommentDelete | 1688 | Yes | No
visCmdShapeCommentDlg | 1685 | Yes | Yes
visCmdShapeExplorer | 1389 | Yes | No
visCmdShapeGalleryAddOn | 1867 | Yes | No
visCmdShapeGeo | 1769 | Yes | No
visCmdShapeHand | 1772 | Yes | No
visCmdShapeIntersect | 1830 | Yes | No
visCmdShapeLayerToolbar | 1634 | Yes | No
visCmdShapeSearchWindowToggle | 2344 | Yes | No
visCmdShapeStudioAddOn | 1985 | Yes | Yes
visCmdShapesWindow | 1669 | Yes | No
visCmdShapeTransparency | 1875 | Yes | No
visCmdShapeTransparencyDlg | 1874 | Yes | Yes
visCmdShapeVert | 1773 | Yes | No
visCmdShowIgnoredIssuesToggle | 2258 | Yes | No
visCmdShowLineJumpsToggle | 2231 | Yes | No
visCmdShowShapeSheetDocument | 2169 | Yes | No
visCmdShowShapeSheetPage | 2168 | Yes | No
visCmdShowShapeSheetShape | 2167 | Yes | No
visCmdSize1D | 1188 | Yes | No
visCmdSize2D | 1189 | Yes | No
visCmdSizeObjects | 1925 | Yes | No
visCmdSizePos | 1670 | Yes | No
visCmdSizeTextBlock | 1194 | Yes | No
visCmdSmartAlign | 2223 | Yes | No
visCmdSmartAlignAndSpace | 2222 | Yes | No
visCmdSmartSpace | 2224 | Yes | No
visCmdSpaceShapesAvoidPageBreaksToggle | 2340 | Yes | No
visCmdSpellingChange | 1889 | Yes | No
visCmdSpellingOptionsDlg | 2042 | Yes | No
visCmdSSWindowAddSection | 1384 | Yes | No
visCmdSSWindowChangeRowType | 1383 | Yes | No
visCmdSSWindowCollapse | 1250 | Yes | No
visCmdSSWindowDeselect | 1253 | Yes | No
visCmdSSWindowExpand | 1251 | Yes | No
visCmdSSWindowPasteFunction | 1382 | Yes | No
visCmdSSWindowPasteName | 1381 | Yes | No
visCmdSSWindowSelect | 1252 | Yes | No
visCmdSSWindowShowSection | 1380 | Yes | No
visCmdSSWindowShowTraceWindow | 1781 | Yes | No
visCmdStampTool | 1424 | Yes | No
visCmdStartRecordingMacro | 1776 | Yes | No
visCmdStenActivate | 1458 | Yes | No
visCmdStenAutoArrange | 1483 | Yes | No
visCmdStenCleanup | 1106 | Yes | No
visCmdStenClose | 1452 | Yes | No
visCmdStenDrawingExplorer | 1796 | Yes | No
visCmdStenEditDrawing | 1102 | Yes | No
visCmdStenEditIcon | 1101 | Yes | No
visCmdStenEditOff | 1681 | Yes | No
visCmdStenEditOn | 1680 | Yes | No
visCmdStenEditToggle | 1679 | Yes | No
visCmdStenIconAndDetail | 1892 | Yes | No
visCmdStenIconAndName | 1480 | Yes | No
visCmdStenIconOnly | 1481 | Yes | No
visCmdStenImageMaster | 1105 | Yes | No
visCmdStenNameMaster | 1103 | Yes | Yes
visCmdStenNameOnly | 1482 | Yes | No
visCmdStenNamesUnderIcons | 2005 | Yes | No
visCmdStenNewMaster | 1104 | Yes | No
visCmdStenProperties | 1678 | Yes | No
visCmdStenSave | 1676 | Yes | No
visCmdStenSaveAs | 1677 | Yes | No
visCmdStopIgnoringValidationRule | 2257 | Yes | No
visCmdStopRecordingMacro | 1777 | Yes | No
visCmdSubtract | 1454 | Yes | No
visCmdSWAccept | 1140 | Yes | No
visCmdSWAddSectionDlg | 1116 | Yes | No
visCmdSWCancel | 1139 | Yes | No
visCmdSWChangeRowTypeDlg | 1114 | Yes | No
visCmdSWDeleteRow | 1115 | Yes | No
visCmdSWDeleteSection | 1117 | Yes | No
visCmdSWExpandRow | 1718 | Yes | No
visCmdSWFormula | 1141 | Yes | No
visCmdSWInsertRow | 1112 | Yes | No
visCmdSWInsertRowAfter | 1113 | Yes | No
visCmdSWPasteFunctionDlg | 1111 | Yes | No
visCmdSWPasteNameDlg | 1110 | Yes | No
visCmdSWShapeActionDlg | 1444 | Yes | No
visCmdSWShowFormulas | 1108 | Yes | No
visCmdSWShowSectionsDlg | 1109 | Yes | No
visCmdSWShowToggle | 1142 | Yes | No
visCmdSWShowValues | 1107 | Yes | No
visCmdTaskPane | 1896 | Yes | No
visCmdTaskPaneDocumentManagement | 1972 | Yes | No
visCmdTaskPaneResearch | 1969 | Yes | No
visCmdTaskPaneReviewer | 1939 | Yes | No
visCmdTaskTogglePreviewSize | 2053 | Yes | Yes
visCmdTextAllCaps | 1862 | Yes | No
visCmdTextBlockTool | 1451 | Yes | No
visCmdTextBold | 1131 | Yes | No
visCmdTextDoubleStrikeThrough | 1951 | Yes | No
visCmdTextDoubleULine | 1863 | Yes | No
visCmdTextEditRuler | 1810 | Yes | No
visCmdTextEditState | 1214 | Yes | No
visCmdTextFont | 1129 | Yes | No
visCmdTextHAlignCenter | 1408 | Yes | No
visCmdTextHAlignDistribute | 1952 | Yes | No
visCmdTextHAlignJustify | 1412 | Yes | No
visCmdTextHAlignLeft | 1407 | Yes | No
visCmdTextHAlignRight | 1409 | Yes | No
visCmdTextItalic | 1132 | Yes | No
visCmdTextRotate90 | 1098 | Yes | No
visCmdTextSize | 1130 | Yes | No
visCmdTextSmallCaps | 1133 | Yes | No
visCmdTextStrikeThrough | 1741 | Yes | No
visCmdTextStyle | 1128 | Yes | No
visCmdTextSubscript | 1135 | Yes | No
visCmdTextSuperScript | 1134 | Yes | No
visCmdTextULine | 1136 | Yes | No
visCmdTextVAlignBottom | 1422 | Yes | No
visCmdTextVAlignMiddle | 1414 | Yes | No
visCmdTextVAlignTop | 1413 | Yes | No
visCmdToggleDocumentStencil | 1690 | Yes | No
visCmdToolsArrayShapesAddOn | 1354 | Yes | Yes
visCmdToolsInventory | 1335 | Yes | Yes
visCmdToolsLayoutShapesDlg | 1574 | Yes | Yes
visCmdToolsMacroDlg | 1577 | Yes | Yes
visCmdToolSnapLines | 1807 | Yes | No
visCmdToolsRunVBE | 1576 | Yes | No
visCmdToolsSpelling | 1270 | Yes | No
visCmdTranslateOptions | 2352 | Yes | No
visCmdTrim | 1534 | Yes | No
visCmdTrustCenterDlg | 2104 | Yes | Yes
visCmdTurnToNextPage | 1148 | Yes | No
visCmdTurnToPrevPage | 1147 | Yes | No
visCmdUFEditClear | 1023 | Yes | No
visCmdUFEditCopy | 1021 | Yes | No
visCmdUFEditCut | 1020 | Yes | No
visCmdUFEditDuplicate | 1024 | Yes | No
visCmdUFEditPaste | 1022 | Yes | No
visCmdUFEditSelectAll | 1025 | Yes | No
visCmdUpdateColumnsInLinkedShapes | 2061 | Yes | No
visCmdUpdateContentCache | 1241 | Yes | No
visCmdValidateDiagram | 2253 | Yes | No
visCmdValidationIssueNavigateToShape | 2236 | Yes | No
visCmdValidationIssuesArrangeByCategory | 2279 | Yes | No
visCmdValidationIssuesArrangeByIgnored | 2281 | Yes | No
visCmdValidationIssuesArrangeByPage | 2280 | Yes | No
visCmdValidationIssuesArrangeByRule | 2278 | Yes | No
visCmdValidationIssuesArrangeOriginalOrder | 2282 | Yes | No
visCmdValidationIssuesWindowToggle | 2263 | Yes | No
visCmdView100 | 1035 | Yes | No
visCmdView150 | 1036 | Yes | No
visCmdView200 | 1037 | Yes | No
visCmdView400 | 1280 | Yes | No
visCmdView50 | 1279 | Yes | No
visCmdView75 | 1034 | Yes | No
visCmdViewConnections | 1042 | Yes | No
visCmdViewCustom | 1038 | Yes | Yes
visCmdViewDirectionToggle | 2012 | Yes | No
visCmdViewFitInWindow | 1033 | Yes | No
visCmdViewGrid | 1040 | Yes | No
visCmdViewGuides | 1041 | Yes | No
visCmdViewLeftToRight | 2013 | Yes | No
visCmdViewPageBreaks | 1509 | Yes | No
visCmdViewRightToLeft | 2014 | Yes | No
visCmdViewRulers | 1039 | Yes | No
visCmdViewStatusBar | 1044 | Yes | No
visCmdWindowCascadeAll | 1086 | Yes | No
visCmdWindowNewWindow | 1085 | Yes | No
visCmdWindowShowDrawPage | 1091 | Yes | No
visCmdWindowShowMasterObjects | 1089 | Yes | No
visCmdWindowShowShapeSheet | 1088 | Yes | No
visCmdWindowTileAll | 1087 | Yes | No
visCmdZoomArea | 1218 | Yes | No
visCmdZoomIn | 1216 | Yes | No
visCmdZoomInIgnoreSel | 1917 | Yes | No
visCmdZoomLast | 1495 | Yes | No
visCmdZoomOut | 1217 | Yes | No
visCmdZoomOutIgnoreSel | 1918 | Yes | No
visCmdZoomPageWidth | 1496 | Yes | No
visCmdZoomPt | 1215 | Yes | No
visCmdZoomSingleTile | 1512 | Yes | No


Event Codes (Visio)

 Copy code hover
[image]

Event Codes (Visio)
Send feedback

When you are working with the Add or AddAdvise method, use the following table to find the event code for the event you want to create. This table lists each Microsoft Visio event and its corresponding event code and numeric code.

Note Note

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), you don't need to create your own events. See the event topic in this reference that corresponds to the event you want to use.

Table of events and corresponding event and numeric codes

Event | Event code | Numeric code
AfterModal | visEvtApp+visEvtAfterModal | &H1040 (4160)
AfterResume | visEvtCodeAfterResume | &H00D1 (209)
AfterResumeEvents | visEvtCodeAfterResumeEvents | &H00D5 (213)
AfterRemoveHiddenInformation | visEvtRemoveHiddenInformation | &H000A (11)
AppActivated | visEvtApp+visEvtAppActivate | &H1001 (4097)
AppDeactivated | visEvtApp+visEvtAppDeactivate | &H1002 (4098)
AppObjActivated | visEvtApp+visEvtObjActivate | &H1004 (4100)
AppObjDeactivated | visEvtApp+visEvtObjDeactivate | &H1008 (4104)
BeforeDataRecordsetDelete | visEvtDel+visEvtDataRecordset | &H4020 (16416)
BeforeDocumentClose | visEvtDel+visEvtDoc | &H4002 (16386)
BeforeDocumentSave | visEvtCodeBefDocSave | &H0007 (7)
BeforeDocumentSaveAs | visEvtCodeBefDocSaveAs | &H0008 (8)
BeforeMasterDelete | visEvtDel+visEvtMaster | &H4008 (16392)
BeforeModal | visEvtApp+visEvtBeforeModal | &H1020 (4128)
BeforePageDelete | visEvtDel+visEvtPage | &H4010 (16400)
BeforeQuit | visEvtApp+visEvtBeforeQuit | &H1010 (4112)
BeforeSelectionDelete | visEvtCodeBefSelDel | &H0385 (901)
BeforeShapeDelete | visEvtDel+visEvtShape | &H4040 (16448)
BeforeShapeTextEdit | visEvtCodeShapeBeforeTextEdit | &H0323 (803)
BeforeStyleDelete | visEvtDel+visEvtStyle | &H4004 (16388)
BeforeSuspend | visEvtCodeBeforeSuspend | &H00D0 (208)
BeforeSuspendEvents | visEvtCodeBeforeSuspendEvents | &H00D4 (212)
BeforeWindowClosed | visEvtDel+visEvtWindow | &H4001 (16385)
BeforeWindowPageTurn | visEvtCodeBefWinPageTurn | &H02BF (703)
BeforeWindowSelDelete | visEvtCodeBefWinSelDel | &H02BE (702)
CalloutRelationshipAdded | visEvtCodeCalloutRelationshipAdded | &H01F8 (504)
CalloutRelationshipDeleted | visEvtCodeCalloutRelationshipDeleted | &H01F9 (505)
CellChanged | visEvtMod+visEvtCell | &H2800 (10240)
ConnectionsAdded | visEvtAdd+visEvtConnect | &H8100 (33024)
ConnectionsDeleted | visEvtDel+visEvtConnect | &H4100 (16640)
ContainerRelationshipAdded | visEvtCodeContainerRelationshipAdded | &H01F6 (502)
ContainerRelationshipDeleted | visEvtCodeContainerRelationshipDeleted | &H01F7 (503)
ConvertToGroupCanceled | visEvtCodeCancelConvertToGroup | &H038C (908)
DataRecordsetAdded | visEvtAdd+visEvtDataRecordset | &H8020 (32800)
DataRecordsetChanged | visEvtMod+VisEvtDataRecordset | &H2020 (8224)
DesignModeEntered | visEvtCodeDocDesign | &H0006 (6)
DocumentAdded | visEvtAdd+visEvtDoc | &H8002 (32770)
DocumentChanged | visEvtMod+visEvtDoc | &H2002 (8194)
DocumentCloseCanceled | visEvtCodeCancelDocClose | &H0010 (10)
DocumentCreated | visEvtCodeDocCreate | &H0001 (1)
DocumentOpened | visEvtCodeDocOpen | &H0002 (2)
DocumentSaved | visEvtCodeDocSave | &H0003 (3)
DocumentSavedAs | visEvtCodeDocSaveAs | &H0004 (4)
EnterScope | visEvtCodeEnterScope | &H00CA (202)
ExitScope | visEvtCodeExitScope | &H00CB (203)
FormulaChanged | visEvtMod+visEvtFormula | &H3000 (12288)
GroupCanceled | visEvtCodeCancelSelGroup | &H038E (910)
KeyDown | visEvtCodeKeyDown | &H02C8 (712)
KeyPress | visEvtCodeKeyPress | &H02C9 (713)
KeyUp | visEvtCodeKeyUp | &H02CA (714)
MasterAdded | visEvtAdd+visEvtMaster | &H8008 (32776)
MarkerEvent | visEvtApp+visEvtMarker | &H1100 (4352)
MasterChanged | visEvtMod+visEvtMaster | &H2008 (8200)
MasterDeleteCanceled | visEvtCodeCancelMasterDel | &H0191 (401)
MouseDown | visEvtCodeMouseDown | &H02C5 (709)
MouseMove | visEvtCodeMouseMove | &H02C6 (710)
MouseUp | visEvtCodeMouseUp | &H02C7 (711)
MustFlushScopeBeginning | visEvtCodeBefForcedFlush | &H00C8 (200)
MustFlushScopeEnded | visEvtCodeAfterForcedFlush | &H00C9 (201)
NoEventsPending | visEvtApp+visEvtNonePending | &H1200 (4608)
OnKeystrokeMessageForAddon | visEvtCodeWinOnAddonKeyMSG | &H02C4 (708)
PageAdded | visEvtAdd+visEvtPage | &H8010 (32784)
PageChanged | visEvtMod+visEvtPage | &H2010 (8208)
PageDeleteCanceled | visEvtCodeCancelPageDel | &H01F5 (501)
QueryCancelConvertToGroup | visEvtCodeQueryCancelConvertToGroup | &H038B (907)
QueryCancelDocumentClose | visEvtCodeQueryCancelDocClose | &H0009 (9)
QueryCancelGroup | visEvtCodeQueryCancelSelGroup | &H038D (909)
QueryCancelMasterDelete | visEvtCodeQueryCancelMasterDel | &H0190 (400)
QueryCancelPageDelete | visEvtCodeQueryCancelPageDel | &H01F4 (500)
QueryCancelQuit | visEvtCodeQueryCancelQuit | &H00CC (204)
QueryCancelSelectionDelete | visEvtCodeQueryCancelSelDel | &H0387 (903)
QueryCancelStyleDelete | visEvtCodeQueryCancelStyleDel | &H012C (300)
QueryCancelSuspend | visEvtCodeQueryCancelSuspend | &H00CE (206)
QueryCancelSuspendEvents | visEvtCodeQueryCancelSuspendEvents | &H0528 (210)
QueryCancelUngroup | visEvtCodeQueryCancelUngroup | &H0389 (905)
QueryCancelWindowClose | visEvtCodeQueryCancelWinClose | &H02C2 (706)
QuitCanceled | visEvtCodeCancelQuit | &H00CD (205)
RunModeEntered | visEvtCodeDocRunning | &H0005 (5)
RuleSetValidated | visEvtCodeRuleSetValidated | &H000D (13)
SelectionAdded | visEvtCodeSelAdded | &H0386 (902)
SelectionChanged | visEvtCodeWinSelChange | &H02BD (701)
SelectionDeleteCanceled | visEvtCodeCancelSelDel | &H0388 (904)
SelectionMovedToSubprocess | visEvtCodeSelectionMovedToSubprocess | &H000B (12)
ShapeAdded | visEvtAdd+visEvtShape | &H8040 (32832)
ShapeChanged | visEvtMod+visEvtShape | &H2040 (8256)
ShapeDataGraphicChanged | visEvtShapeDataGraphicChanged | &H0327 (807)
ShapeExitedTextEdit | visEvtCodeShapeExitTextEdit | &H0324 (804)
ShapeLinkAdded | visEvtShapeLinkAdded | &H0325 (805)
ShapeLinkDeleted | visEvtShapeLinkDeleted | &H0326 (806)
ShapeParentChanged | visEvtCodeShapeParentChange | &H0322 (802)
ShapesDeleted | visEvtCodeShapeDelete | &H0321 (801)
StyleAdded | visEvtAdd+visEvtStyle | &H8004 (32772)
StyleChanged | visEvtMod+visEvtStyle | &H2004 (8196)
StyleDeleteCanceled | visEvtCodeCancelStyleDel | &H012D (301)
SuspendCanceled | visEvtCodeCancelSuspend | &H00CF (207)
SuspendEventsCanceled | visEvtCodeCancelSuspendEvents | &H00D3 (211)
TextChanged | visEvtMod+visEvtText | &H2080 (8320)
UngroupCanceled | visEvtCodeCancelUngroup | &H038A (906)
ViewChanged | visEvtCodeViewChanged | &H02C1 (705)
VisioIsIdle | visEvtApp+visEvtIdle | &H1400 (5120)
WindowActivated | visEvtApp+visEvtWinActivate | &H1080 (4224)
WindowCloseCanceled | visEvtCodeCancelWinClose | &H02C3 (707)
WindowOpened | visEvtAdd+visEvtWindow | &H8001 (32769)
WindowChanged | visEvtMod+visEvtWindow | &H2001 (8193)
WindowTurnedToPage | visEvtCodeWinPageTurn | &H02C0 (704)


Sample VBA Macro (Visio)

 Copy code hover
[image]

Sample VBA Macro (Visio)
Send feedback

For each drawing file that is open in the Microsoft Visio instance, the sample Microsoft Visual Basic for Applications (VBA) macro shown below does the following:

  • Logs the name and path of the drawing file in the Immediate window

  • Logs the name of each page in the Immediate window

VBA Copy code Copy code
Public Sub ShowNames()

    'Declare object variables as Visio object types.
    Dim vsoPage As Visio.Page
    Dim vsoDocument As Visio.Document
    Dim vsoDocuments As Visio.Documents
    Dim vsoPages As Visio.Pages

    'Iterate through all open documents.
    Set vsoDocuments  = Application.Documents
    For Each vsoDocument In vsoDocuments

        'Print the drawing name in the Visual Basic Editor
        'Immediate window.
        Debug.Print vsoDocument.FullName

        'Iterate through all pages in a drawing.
        Set vsoPages = vsoDocument.Pages
        For Each vsoPage In vsoPages

            'Print the page name in the Visual Basic Editor
            'Immediate window.
            Debug.Print Tab(5); vsoPage.Name

        Next

    Next

End Sub
Note Note

Here is an example of the program's output, assuming drawings named Office.vsd and Recycle.vsd are open and have been saved in the specified locations. The locations shown are not those in which Visio saves drawings by default.

Sample output

Description
VBA Copy code Copy code
C:\documents\drawings\Office.vsd

The name of the first drawing

VBA Copy code Copy code
Background-1

The name of page 1
VBA Copy code Copy code
Background-2

The name of page 2
VBA Copy code Copy code
C:\documents\drawings\Recycle.vsd

The name of the second drawing
VBA Copy code Copy code
Page-1

The name of page 1
VBA Copy code Copy code
Page-2

The name of page 2
VBA Copy code Copy code
Page-3

The name of page 3

You can find more information about writing a program in the VBA environment and about the Visual Basic Editor in Microsoft Visual Basic Help (in the Visual Basic Editor window, on the Help menu, click Microsoft Visual Basic Help).

You can find details about using a specific Visio object, property, method, enumeration, or event in this reference.


Common tasks (Visio 2013 Automation)

 Copy code hover
[image]

Common tasks (Visio 2013 Automation)
Send feedback

This navigation page contains links to topics describing common automation tasks. Click the links below or use the TOC to navigate to the following topics:

  • Add Macros or Add-ons to Shape's Shortcut Menus

  • Associate Macros or Add-ons with the Double-Click Behavior of Shapes

  • Change the Macro Security Settings for Visio

  • Run Macros or Add-ons from the Macros Dialog Box

  • Run Visio in Developer Mode

  • Start the Visual Basic Editor

  • View Visio Object, Property, Method, Event, and Constant Descriptions


Add Macros or Add-ons to a Shape's Shortcut Menu

 Copy code hover
[image]

Add Macros or Add-ons to a Shape's Shortcut Menu
Send feedback

  1. Select the shape.

  2. On the Developer tab, click Show ShapeSheet.

  3. Click in an Action cell in an Actions section. If you don't see an Actions section, insert one by clicking Insert in the Sections group on the ShapeSheet Tools tab and then selecting the Actions check box in the Insert Section dialog box.

  4. In the Editing group, click Shape Actions.

  5. In the Action dialog box, in the Menu box, enter the custom command you want to add to the shape's shortcut menu.

  6. Click Run macro, and then select the program you want to run from the Run macro list. Click OK.

  7. On the drawing page, right-click the shape, and then click the custom menu command on the shortcut menu to run the program.

Note Note

You also can associate a macro or add-on with a shape by entering a formula that uses the RUNADDON function in any ShapeSheet cell.


Associate Macros or Add-ons with the Double-Click Behavior of Shapes

 Copy code hover
[image]

Associate Macros or Add-ons with the Double-Click Behavior of Shapes
Send feedback

  1. Select the shape with which you want to associate the macro or add-on.

  2. On the Developer tab, click Behavior.

  3. In the Behavior dialog box, click Double-Click, and then click Run macro.

  4. From the Run macro list, select the macro or add-on you want to run.

  5. Click OK.

  6. Double-click the shape to run the macro or add-on.


Change the Macro Settings for Microsoft Visio

 Copy code hover
[image]

Change the Macro Settings for Microsoft Visio
Send feedback

  1. Click the File tab, and then click Options

  2. Click Trust Center.

  3. ClickTrust Center Settings, and then click Macro Settings.

  4. Set the options you want, and then click OK.

Because macros can contain viruses, be careful about running them. Take the following precautions: run up-to-date antivirus software on your computer; on the Add-ins tab, check the Require Application Add-ins to be signed by Trusted Publisher box; use digital signatures; and maintain a list of trusted publishers.


Run Macros or Add-ons from the Macros Dialog Box

 Copy code hover
[image]

Run Macros or Add-ons from the Macros Dialog Box
Send feedback

  1. In Microsoft Visio, on the View tab, click Macros.

  2. In the Macros dialog box, select the macro or add-on you want to run, and then click Run.

Note Note

If you have more than one Visio drawing open and the macro you want to run does not appear in the Macros dialog box, make sure that in the Macros in list, you have selected the Visio document in which the macro is stored.


Run Visio in Developer Mode

 Copy code hover
[image]

Run Visio in Developer Mode
Send feedback

  • Click the File tab, click Options, click Advanced, and then, under General, select Run in developer mode.


Start the Visual Basic Editor (Visio)

 Copy code hover
[image]

Start the Visual Basic Editor (Visio)
Send feedback

In the Code group on the Developer tab, click Visual Basic. Or press ALT+F11.


View Visio Object, Property, Method, Event, and Constant Descriptions

 Copy code hover
[image]

View Visio Object, Property, Method, Event, and Constant Descriptions
Send feedback

  1. In the Microsoft Visual Basic Editor, on the View menu, click Object Browser. The Object Browser initially displays items declared by all libraries referenced by your project.

  2. In the Project/Library list, select Visio.

Note Note

You also can view additional information about an item by selecting the item and pressing F1 for Help.


Visio Object Model Reference

 Copy code hover
[image]

Visio Object Model Reference
Send feedback

Published: July 16, 2012

This section of the Visio 2013 Automation reference contains documentation for all the objects, properties, methods, and events contained in the Visio object model. You can use the table of contents to navigate through the documentation.


AccelItem Object (Visio)

 Copy code hover
[image]

AccelItem Object (Visio)
Send feedback

Published: July 16, 2012

Represents a single accelerator used by Microsoft Visio.

Version Information

Version Added: Visio 4.0

Remarks

An AccelItem object consists of a key, modifiers to the key, and the Visio command or add-on that the accelerator executes when the user presses the accelerator. A key is any ASCII key code, and is not case-sensitive. The modifiers are ALT, CTRL, and SHIFT. Command identifiers are declared by the Visio type library and prefixed with visCMD.


AccelItem Members (Visio)

 Copy code hover
[image]

AccelItem Members (Visio)
Send feedback

Published: July 16, 2012

Represents a single accelerator used by Microsoft Visio.

Methods

Name | Description
Delete | Deletes an object.

Properties

Name | Description
AddOnArgs | Gets or sets the argument string that you send to the add-on associated with a particular accelerator key. Read/write.
AddOnName | Gets or sets the name of an add-on or procedure that is run when its associated accelerator key is pressed. Read/write.
Alt | Determines whether the ALT key is a modifier for an accelerator. Read/write.
CmdNum | Gets or sets the command ID associated with an accelerator. Read/write.
Control | Determines whether the CTRL key modifies the accelerator key in an AccelItem object. Read/write.
Key | Gets or sets the ASCII key code value for an accelerator. Read/write.
Parent | Determines the parent of an object. Read-only.
Shift | Determines whether the SHIFT key is a modifier for an AccelItem object. Read/write.


AccelItem Properties (Visio)

 Copy code hover
[image]

AccelItem Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AddOnArgs | Gets or sets the argument string that you send to the add-on associated with a particular accelerator key. Read/write.
AddOnName | Gets or sets the name of an add-on or procedure that is run when its associated accelerator key is pressed. Read/write.
Alt | Determines whether the ALT key is a modifier for an accelerator. Read/write.
CmdNum | Gets or sets the command ID associated with an accelerator. Read/write.
Control | Determines whether the CTRL key modifies the accelerator key in an AccelItem object. Read/write.
Key | Gets or sets the ASCII key code value for an accelerator. Read/write.
Parent | Determines the parent of an object. Read-only.
Shift | Determines whether the SHIFT key is a modifier for an AccelItem object. Read/write.


AccelItem.AddOnArgs Property (Visio)

 Copy code hover
[image]

AccelItem.AddOnArgs Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the argument string that you send to the add-on associated with a particular accelerator key. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddOnArgs

expression An expression that returns a AccelItem object.

Return Value

String

Remarks

An argument's string can be anything appropriate for the add-on. However, the arguments are packaged together with other information into a command string, which cannot exceed 127 characters. For best results, limit arguments to 50 characters.

An object's AddOnName property indicates the name of the add-on to which the arguments are sent.

Beginning with Visio 2002, the AddOnName property used in the following example cannot execute a string that contains arbitrary Microsoft Visual Basic code. To call code that in previous versions of Visio you would have passed to the AddOnName property, move it to a procedure in a document's Visual Basic project that is called from the AddOnName property, as shown in the following example.


AccelItem.AddOnName Property (Visio)

 Copy code hover
[image]

AccelItem.AddOnName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of an add-on or procedure that is run when its associated accelerator key is pressed. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddOnName

expression A variable that represents an AccelItem object.

Return Value

String

Remarks

Assuming that the name of the add-on in the Addons collection is string, if the project of the currently active document (or another project if it is referenced) does not have a procedure named string, or if the arguments passed in string do not match those specified in the procedure, Microsoft Visio runs the add-on named string. If no add-on named string can be found, Visio does nothing and reports no error. (You can use the TraceFlags property to monitor the procedures and add-ons that Visio attempts to run.)

If string is an add-on, use the AddOnArgs property to specify arguments to send to the add-on when it is run.

If string is a procedure, specify arguments using procname(arguments) or procname arguments.

When calling a procedure in a standard module it is recommended that you prefix the string with the module name that contains the procedure (for example, moduleName.procName) because more than one module can have a procedure with the same name.

To call a procedure in a project other than the project of the active document, use the syntax projName.modName.procName (you must have explicitly set a reference to projName in your Visual Basic project).

If the AddOnName property is set, Visio ignores the object's CmdNum property.

Note Note

Beginning with Visio 2002, the AddOnName property cannot execute a string that contains arbitrary VBA code. To call code that in previous versions of Visio you would have passed to the AddOnName property, move the code to a procedure in a document's VBA project that is called from the AddOnName property.


AccelItem.Alt Property (Visio)

 Copy code hover
[image]

AccelItem.Alt Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the ALT key is a modifier for an accelerator. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Alt

expression A variable that represents an AccelItem object.

Return Value

Integer


AccelItem.CmdNum Property (Visio)

 Copy code hover
[image]

AccelItem.CmdNum Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the command ID associated with an accelerator. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CmdNum

expression A variable that represents an AccelItem object.

Return Value

Integer

Remarks

The CmdNum property should never be zero for an AccelItem object.

Valid command IDs are declared by the Visio type library in VisUICmds. They have the prefix visCmd.


AccelItem.Control Property (Visio)

 Copy code hover
[image]

AccelItem.Control Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the CTRL key modifies the accelerator key in an AccelItem object. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .Control

expression A variable that represents an AccelItem object.

Return Value

Integer

Remarks

Set the Control property to True to use the CTRL key as a modifier for an accelerator, for example, CTRL+BACKSPACE.


AccelItem.Key Property (Visio)

 Copy code hover
[image]

AccelItem.Key Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the ASCII key code value for an accelerator. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Key

expression A variable that represents an AccelItem object.

Return Value

Integer

Remarks

For a list of ASCII key code values, search for "Virtual-Key Codes" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


AccelItem.Parent Property (Visio)

 Copy code hover
[image]

AccelItem.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a AccelItem object.

Return Value

AccelItems

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it.


AccelItem.Shift Property (Visio)

 Copy code hover
[image]

AccelItem.Shift Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the SHIFT key is a modifier for an AccelItem object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Shift

expression A variable that represents an AccelItem object.

Return Value

Integer


AccelItem Methods (Visio)

 Copy code hover
[image]

AccelItem Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.


AccelItem.Delete Method (Visio)

 Copy code hover
[image]

AccelItem.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents an AccelItem object.

Return Value

Nothing


AccelItems Object (Visio)

 Copy code hover
[image]

AccelItems Object (Visio)
Send feedback

Published: July 16, 2012

Includes an AccelItem object for each accelerator in a Microsoft Visio window context.

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

To retrieve an AccelItems collection, use the AccelItems property of an AccelTable object.

The default property for an AccelItems collection is Item.

Unlike other Visio collections, the AccelItems collection is indexed starting with zero (0) rather than 1.


AccelItems Members (Visio)

 Copy code hover
[image]

AccelItems Members (Visio)
Send feedback

Published: July 16, 2012

Includes an AccelItem object for each accelerator in a Microsoft Visio window context.

Methods

Name | Description
Add | Adds a new object to a collection.

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only.
Parent | Determines the parent of an object. Read-only.


AccelItems Properties (Visio)

 Copy code hover
[image]

AccelItems Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only.
Parent | Determines the parent of an object. Read-only.


AccelItems.Count Property (Visio)

 Copy code hover
[image]

AccelItems.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents an AccelItems object.

Return Value

Long


AccelItems.Item Property (Visio)

 Copy code hover
[image]

AccelItems.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(lIndex)

expression A variable that represents a AccelItems collection.

Parameters

Name | Required/Optional | Data Type | Description
lIndex | Required | Long | Contains the index of the object to retrieve.

Return Value

AccelItem

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


AccelItems.Parent Property (Visio)

 Copy code hover
[image]

AccelItems.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a AccelItems object.

Return Value

AccelTable

Remarks

Note Note

In general, an object's parent is the object that contains it.


AccelItems Methods (Visio)

 Copy code hover
[image]

AccelItems Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.


AccelItems.Add Method (Visio)

 Copy code hover
[image]

AccelItems.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents an AccelItems collection.

Return Value

AccelItem

Remarks

Note Note

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.


AccelTable Object (Visio)

 Copy code hover
[image]

AccelTable Object (Visio)
Send feedback

Published: July 16, 2012

Represents a Microsoft Windows accelerator table.

Version Information

Version Added: Visio 4.0

Remarks

You can create one AccelTable object for each Microsoft Visio window context (drawing window, stencil window, ShapeSheet window, and so on).


AccelTable Members (Visio)

 Copy code hover
[image]

AccelTable Members (Visio)
Send feedback

Published: July 16, 2012

Represents a Microsoft Windows accelerator table.

Methods

Name | Description
Delete | Deletes an object.

Properties

Name | Description
AccelItems | Returns the AccelItems collection of an AccelTable object. Read-only.
Parent | Determines the parent of an object. Read-only.
SetID | Returns the set ID of an AccelTable object in its collection. Read-only.
TableName | Gets or sets the name of an AccelTable object. Read/write.


AccelTable Properties (Visio)

 Copy code hover
[image]

AccelTable Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AccelItems | Returns the AccelItems collection of an AccelTable object. Read-only.
Parent | Determines the parent of an object. Read-only.
SetID | Returns the set ID of an AccelTable object in its collection. Read-only.
TableName | Gets or sets the name of an AccelTable object. Read/write.


AccelTable.AccelItems Property (Visio)

 Copy code hover
[image]

AccelTable.AccelItems Property (Visio)
Send feedback

Published: July 16, 2012

Returns the AccelItems collection of an AccelTable object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .AccelItems

expression A variable that represents an AccelTable object.

Return Value

AccelItems

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AccelItems property to delete an accelerator key from a built-in menu.

To restore the built-in menus in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub AccelItems_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoAccelTable As Visio.AccelTable
 Dim vsoAccelItems As Visio.AccelItems
 Dim vsoAccelItem As Visio.AccelItem
 Dim intCounter As Integer

 'Retrieve the UIObject object for the copy of the built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Set vsoAccelTable to the drawing menu set.
 Set vsoAccelTable = vsoUIObject.AccelTables.ItemAtID(visUIObjSetDrawing)

 'Retrieve the accelerator items collection.
 Set vsoAccelItems = vsoAccelTable.AccelItems

 'Retrieve the accelerator item for the Visual Basic Editor.
 'To do this, we must iterate through the collection
 'and locate the item we want to manipulate.
 'The item can be identified either by checking
 'the CmdNum property or by checking for the specific key.
 'Because checking for the key requires looking at the Alt,
 'Control, Shift, and Key properties, it is better to use the
 'CmdNum property. Because we retrieved the built-in menus,
 'we know that we can find the accelerator.
 For intCounter = 0 To vsoAccelItems.Count - 1

 Set vsoAccelItem = vsoAccelItems.Item(intCounter)
 If vsoAccelItem.CmdNum = Visio.visCmdToolsRunVBE Then

 Exit For

 End If

 Next intCounter

 'Delete the accelerator.
 vsoAccelItem.Delete

 'Tell Visio to use the new UI.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


AccelTable.Parent Property (Visio)

 Copy code hover
[image]

AccelTable.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a AccelTable object.

Return Value

AccelTables

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it.


AccelTable.SetID Property (Visio)

 Copy code hover
[image]

AccelTable.SetID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the set ID of an AccelTable object in its collection. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .SetID

expression A variable that represents an AccelTable object.

Return Value

Long

Remarks

Each AccelTable object has a set ID that corresponds to a Microsoft Visio window context.

You can retrieve an object from its collection by passing the object's set ID to the ItemAtID property. You can also set the set ID of an object by using the AddAtID method.

Valid set ID values are declared by the Visio type library in VisUIObjSets.


AccelTable.TableName Property (Visio)

 Copy code hover
[image]

AccelTable.TableName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of an AccelTable object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TableName

expression A variable that represents an AccelTable object.

Return Value

String

Remarks

This property is not currently used.


AccelTable Methods (Visio)

 Copy code hover
[image]

AccelTable Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.


AccelTable.Delete Method (Visio)

 Copy code hover
[image]

AccelTable.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents an AccelTable object.

Return Value

Nothing


AccelTables Object (Visio)

 Copy code hover
[image]

AccelTables Object (Visio)
Send feedback

Published: July 16, 2012

Includes an AccelTable object for each Microsoft Visio window context that has accelerators.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

To retrieve an AccelTables collection, use the AccelTables property of a UIObject object.

The default property of AccelTables is Item.

Unlike other Visio collections, the AccelTables collection is indexed starting with zero (0) rather than 1.

An AccelTable object is identified in the AccelTables collection by its SetID property, which corresponds to a Visio window context. For a list of SetID values that identify AccelTable objects, see the SetID property.


AccelTables Members (Visio)

 Copy code hover
[image]

AccelTables Members (Visio)
Send feedback

Published: July 16, 2012

Includes an AccelTable object for each Microsoft Visio window context that has accelerators.

Methods

Name | Description
Add | Adds a new object to a collection.
AddAtID | Creates a new object with a specified ID in a collection.

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only.
ItemAtID | Returns the AccelTable object for an ID within a collection. Read-only.
Parent | Determines the parent of an object. Read-only.


AccelTables Properties (Visio)

 Copy code hover
[image]

AccelTables Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only.
ItemAtID | Returns the AccelTable object for an ID within a collection. Read-only.
Parent | Determines the parent of an object. Read-only.


AccelTables.Count Property (Visio)

 Copy code hover
[image]

AccelTables.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents an AccelTables object.

Return Value

Long


AccelTables.Item Property (Visio)

 Copy code hover
[image]

AccelTables.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(lIndex)

expression A variable that represents a AccelTables collection.

Parameters

Name | Required/Optional | Data Type | Description
lIndex | Required | Long | Contains the index of the object to retrieve.

Return Value

AccelTable

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


AccelTables.ItemAtID Property (Visio)

 Copy code hover
[image]

AccelTables.ItemAtID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the AccelTable object for an ID within a collection. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemAtID(lID)

expression A variable that represents an AccelTables object.

Parameters

Name | Required/Optional | Data Type | Description
lID | Required | Long | The Visio context ID of the object to retrieve.

Return Value

AccelTable


AccelTables.Parent Property (Visio)

 Copy code hover
[image]

AccelTables.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a AccelTables object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it.


AccelTables Methods (Visio)

 Copy code hover
[image]

AccelTables Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.
AddAtID | Creates a new object with a specified ID in a collection.


AccelTables.Add Method (Visio)

 Copy code hover
[image]

AccelTables.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents an AccelTables collection.

Return Value

AccelTable

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.


AccelTables.AddAtID Method (Visio)

 Copy code hover
[image]

AccelTables.AddAtID Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new object with a specified ID in a collection.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddAtID(lID)

expression A variable that represents an AccelTables object.

Parameters

Name | Required/Optional | Data Type | Description
lID | Required | Long | The window context for the new object.

Return Value

AccelTable

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The ID corresponds to a window or context menu. If the collection already contains an object at the specified ID, the AddAtID method returns an error.

Valid IDs are declared by the Visio type library in member VisUIObjSets. Not all collections include an object for every possible ID.


Addon Object (Visio)

 Copy code hover
[image]

Addon Object (Visio)
Send feedback

Published: July 16, 2012

Represents an installed Microsoft Visio add-on.

Version Information

Version Added: Visio 4.0

Remarks

To retrieve an Addon object, use the Addons collection of an Application object.

The default property of an Addon object is Name.


Addon Members (Visio)

 Copy code hover
[image]

Addon Members (Visio)
Send feedback

Published: July 16, 2012

Represents an installed Microsoft Visio add-on.

Methods

Name | Description
Run | Runs the add-on represented by an Addon object.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Enabled | Determines whether or not an Addon object is currently enabled. Read/write.
Index | Gets the ordinal position of an Addon object in the Addons collection. Read-only.
Name | Specifies the locale-specific name of an Addon object. Read-only.
NameU | Specifies the universal name of an Addon object. Read-only.
ObjectType | Returns an object's type. Read-only.


Addon Properties (Visio)

 Copy code hover
[image]

Addon Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Enabled | Determines whether or not an Addon object is currently enabled. Read/write.
Index | Gets the ordinal position of an Addon object in the Addons collection. Read-only.
Name | Specifies the locale-specific name of an Addon object. Read-only.
NameU | Specifies the universal name of an Addon object. Read-only.
ObjectType | Returns an object's type. Read-only.


Addon.Application Property (Visio)

 Copy code hover
[image]

Addon.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents an Addon object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Addon.Enabled Property (Visio)

 Copy code hover
[image]

Addon.Enabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether or not an Addon object is currently enabled. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Enabled

expression A variable that represents an Addon object.

Return Value

Integer

Remarks

An add-on implemented by an executable (EXE) file always reports itself as enabled. An add-on implemented by a Visio Solutions Library (VSL) file reports itself as enabled or disabled according to the enabling policy that the VSL file has registered for that add-on.

You cannot tell an add-on to enable or disable itself. Visio will not send a run message to a disabled add-on. If an add-on is disabled, its name appears unavailable in the Visio user interface.


Addon.Index Property (Visio)

 Copy code hover
[image]

Addon.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of an Addon object in the Addons collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Addon object.

Return Value

Integer

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Addon.Name Property (Visio)

 Copy code hover
[image]

Addon.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the locale-specific name of an Addon object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Name

expression A variable that represents an Addon object.

Return Value

String

Remarks

You can get, but not set, the Name property of an Addon object.


Addon.NameU Property (Visio)

 Copy code hover
[image]

Addon.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of an Addon object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .NameU

expression A variable that represents an Addon object.

Return Value

String

Remarks

You can get, but not set, the NameU property of an Addon object.


Addon.ObjectType Property (Visio)

 Copy code hover
[image]

Addon.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents an Addon object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Addon Methods (Visio)

 Copy code hover
[image]

Addon Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Run | Runs the add-on represented by an Addon object.


Addon.Run Method (Visio)

 Copy code hover
[image]

Addon.Run Method (Visio)
Send feedback

Published: July 16, 2012

Runs the add-on represented by an Addon object.

Version Information

Version Added: Visio 4.0

Syntax

expression .Run(ArgString)

expression An expression that returns a Addon object.

Parameters

Name | Required/Optional | Data Type | Description
ArgString | Required | String | The argument string to pass to the add-on.

Return Value

Nothing

Remarks

If the add-on is implemented by an EXE file, the arguments are passed in the command line string. If the add-on is implemented by a VSL file, the arguments are passed in a member of the argument structure that accompanies the run message sent to the VisioLibMain procedure of the VSL.

Security note Security Note
Use caution when running executable files or code in macros or applications. Executable files or code can be used to carry out actions that might compromise the security of your computer and data.


Addons Object (Visio)

 Copy code hover
[image]

Addons Object (Visio)
Send feedback

Published: July 16, 2012

Represents the set of installed add-ons known to an Application object.

Version Information

Version Added: Visio 4.0

Remarks

To retrieve an Addons collection, use the Addons property of an Application object.

The default property of an Addons collection is Item.

Installed add-ons are those Microsoft Visio finds in its Addons or StartUp paths, those that were installed during the initial setup of Visio, those you have installed by using a Microsoft Windows Installer package, or those that other add-ons have dynamically installed by using the Add method of the Addons collection.


Addons Members (Visio)

 Copy code hover
[image]

Addons Members (Visio)
Send feedback

Published: July 16, 2012

Represents the set of installed add-ons known to an Application object.

Methods

Name | Description
Add | Adds a new Addon object to an Addons collection.
GetNames | Returns the names of all items in a collection.
GetNamesU | Returns the universal names of all items in an Addons collection.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.


Addons Properties (Visio)

 Copy code hover
[image]

Addons Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.


Addons.Application Property (Visio)

 Copy code hover
[image]

Addons.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents an Addons object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Addons.Count Property (Visio)

 Copy code hover
[image]

Addons.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents an Addons object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Addons.Item Property (Visio)

 Copy code hover
[image]

Addons.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameOrIndex)

expression A variable that represents an Addons collection.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

Addon

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.


Addons.ItemU Property (Visio)

 Copy code hover
[image]

Addons.ItemU Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ItemU(NameOrIndex)

expression A variable that represents an Addons object.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the universal name, unique ID, or index of the object to retrieve.

Return Value

Addon

Remarks

You can retrieve an object in an Addons, Hyperlinks, Layers, Masters, MasterShortcuts, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

If you retrieve a Shape object by name, the ItemU property searches all shapes in the Shapes collection's containing page or containing master, in addition to the collection's containing shape. Therefore, the Shape object returned by the ItemU property can be a shape that is not in the Shapes collection.

You can also pass the unique ID string of a Master or Shape object to the ItemU property. For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

If such a string is passed to the ItemU property of a Shapes collection, all the shapes contained in the collection are searched. Shapes within the group shapes in the containing shape are not searched.

To search all shapes in the collection, plus the shapes inside groups and the containing shape of the collection, prefix the unique ID string with an asterisk (*). For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")
Note Note

  • In Visio 2000 only, vsoShapes.ItemU("{guid}") examined the Shapes collection's containing shape and all descendants, and vsoShapes.ItemU("*{guid}") examined all shapes in the Shapes collection's containing page or containing master.

  • Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

    As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

Example

This Microsoft Visual Basic macro shows how to use the ItemU property of the Pages collection to get the Shapes collection. Then it uses the ItemU property of the Shapes collection to print the universal names of all shapes on Page-1 in the Immediate window.

To run this macro, make sure the active document has shapes on Page-1.

VBA Copy code Copy code

Public Sub ItemU_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.ItemU(1).Shapes

    Debug.Print "Shapes in Document: "; ActiveDocument.Name
    Debug.Print "          on  Page: "; ActiveDocument.Pages.ItemU(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then

        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.ItemU(intCounter).Name
        Next intCounter

    Else

        Debug.Print " No Shapes On Page"

    End If

End Sub


Addons.ObjectType Property (Visio)

 Copy code hover
[image]

Addons.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents an Addons object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Addons Methods (Visio)

 Copy code hover
[image]

Addons Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new Addon object to an Addons collection.
GetNames | Returns the names of all items in a collection.
GetNamesU | Returns the universal names of all items in an Addons collection.


Addons.Add Method (Visio)

 Copy code hover
[image]

Addons.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new Addon object to an Addons collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add(FileName)

expression A variable that represents an Addons object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the add-on.

Return Value

Addon

Remarks

The Add method adds an EXE or VSL file to the collection and returns an Addon object if the string expression specifies an EXE file, or Nothing if the string expression specifies a VSL file.

Example

The following macro shows how to add an Addon object to the Addons collection.

Before running this macro, replace path\filename with a valid path and file name for an add-on in your Visio project.

VBA Copy code Copy code
Public Sub AddAddon_Example()

 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Add an add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add("path\filename")

End Sub


Addons.GetNames Method (Visio)

 Copy code hover
[image]

Addons.GetNames Method (Visio)
Send feedback

Published: July 16, 2012

Returns the names of all items in a collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNames(NameArray())

expression A variable that represents an Addons collection.

Parameters

Name | Required/Optional | Data Type | Description
NameArray() | Required | String | Out parameter. An array that receives the names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNames method succeeds, NameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. NameArray() is an out parameter that is allocated by the GetNames method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.


Addons.GetNamesU Method (Visio)

 Copy code hover
[image]

Addons.GetNamesU Method (Visio)
Send feedback

Published: July 16, 2012

Returns the universal names of all items in an Addons collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNamesU(NameArray())

expression A variable that represents an Addons collection.

Parameters

Name | Required/Optional | Data Type | Description
NameArray() | Required | String | Out parameter. An array that receives the names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNamesU method succeeds, NameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. NameArray() is an out paramter that is allocated by the GetNamesU method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.


Application Object (Visio)

 Copy code hover
[image]

Application Object (Visio)
Send feedback

Published: July 16, 2012

Represents an instance of Visio. An external program typically creates or retrieves an Application object before it can retrieve other Visio objects from that instance. Use the Microsoft Visual Basic CreateObject function or the New keyword to run a new instance, or use the GetObject function to retrieve an instance that is already running. You can also use the CreateObject function with the InvisibleApp object to run a new instance that is invisible. Set the value of the InvisibleApp object's Visible property to True to show it.

Remarks

Use the Documents, Windows, and Addons properties of an Application object to retrieve the Document, Window, and Addon collections of the instance.

Use the ActiveDocument, ActivePage, or ActiveWindow property to retrieve the currently active Document, Page, or Window object.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Use the BuiltInMenus, BuiltInToolbars, CustomMenus, CustomToolbars, or CommandBars property to access the Application object's menus and toolbars.

ActiveDocument is the default property of an Application object.

Note Note

Code in the Microsoft Visual Basic for Applications project of a Visio document can use the Visio global object instead of a Visio Application object to retrieve other objects.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this object maps to the following types:

  • Microsoft.Office.Interop.Visio.ApplicationClass (to access the Application object.)

  • Microsoft.Office.Interop.Visio.ApplicationClass.Application (to construct the Application object.)

  • Microsoft.Office.Interop.Visio.EApplication_Event (to access events on the Application object.


Application Members (Visio)

 Copy code hover
[image]

Application Members (Visio)
Send feedback

Published: July 16, 2012

Represents an instance of Visio. An external program typically creates or retrieves an Application object before it can retrieve other Visio objects from that instance. Use the Microsoft Visual Basic CreateObject function or the New keyword to run a new instance, or use the GetObject function to retrieve an instance that is already running. You can also use the CreateObject function with the InvisibleApp object to run a new instance that is invisible. Set the value of the InvisibleApp object's Visible property to True to show it.

Events

Name | Description
AfterModal | Occurs after the Microsoft Visio instance leaves a modal state.
AfterRemoveHiddenInformation | Occurs when hidden information is removed from the document.
AfterReplaceShapes | Occurs after a shape-replacement operation.
AfterResume | Occurs when the operating system resumes normal operation after having been suspended.
AfterResumeEvents | Occurs after firing of events is resumed.
AppActivated | Occurs after a Microsoft Visio instance becomes active.
AppDeactivated | Occurs after a Microsoft Visio instance becomes inactive.
AppObjActivated | Occurs after a Microsoft Visio instance becomes active.
AppObjDeactivated | Occurs after a Microsoft Visio instance becomes inactive.
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
BeforeDocumentClose | Occurs before a document is closed.
BeforeDocumentSave | Occurs before a document is saved.
BeforeDocumentSaveAs | Occurs just before a document is saved by using the Save As command.
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforeModal | Occurs before a Microsoft Visio instance enters a modal state.
BeforePageDelete | Occurs before a page is deleted.
BeforeQuit | Occurs before a Microsoft Visio instance terminates.
BeforeReplaceShapes | Occurs just before a shape-replacement operation.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
BeforeStyleDelete | Occurs before a style is deleted.
BeforeSuspend | Occurs before the operating system enters a suspended state.
BeforeSuspendEvents | Occurs before firing of events is suspended.
BeforeWindowClosed | Occurs before a window is closed.
BeforeWindowPageTurn | Occurs before a window is about to show a different page.
BeforeWindowSelDelete | Occurs before the shapes in the selection of a window are deleted.
CalloutRelationshipAdded | Occurs when a new callout relationship is added to the application.
CalloutRelationshipDeleted | Occurs when a callout relationship is deleted from the application.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ContainerRelationshipAdded | Occurs when a new container relationship is added to the document.
ContainerRelationshipDeleted | Occurs when a container relationship is deleted from the document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
DataRecordsetAdded | Occurs when a DataRecordset object is added to a DataRecordsets collection.
DataRecordsetChanged | Occurs when a data recordset changes as a result of being refreshed.
DesignModeEntered | Occurs before a document enters design mode.
DocumentChanged | Occurs after certain properties of a document are changed.
DocumentCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.
DocumentCreated | Occurs after a document is created.
DocumentOpened | Occurs after a document is opened.
DocumentSaved | Occurs after a document is saved.
DocumentSavedAs | Occurs after a document is saved by using the Save As command.
EnterScope | Queued when an internal command begins, or when an Automation client opens a scope by using the BeginUndoScope method.
ExitScope | Queued when an internal command ends, or when an Automation client exits a scope by using the EndUndoScope method.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
KeyDown | Occurs when a keyboard key is pressed.
KeyPress | Occurs when a keyboard key is pressed.
KeyUp | Occurs when a keyboard key is released.
MarkerEvent | Caused by calling the QueueMarkerEvent method.
MasterAdded | Occurs after a new master is added to a document.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
MouseDown | Occurs when a mouse button is clicked.
MouseMove | Occurs when the mouse is moved.
MouseUp | Occurs when a mouse button is released.
MustFlushScopeBeginning | Occurs before the Microsoft Visio instance is forced to flush its event queue.
MustFlushScopeEnded | Occurs after the Microsoft Visio instance is forced to flush its event queue.
NoEventsPending | Occurs after the Microsoft Visio instance flushes its event queue.
OnKeystrokeMessageForAddon | Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.
PageAdded | Occurs after a new page is added to a document.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelDocumentClose | Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelQuit | Occurs before the application terminates in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelReplaceShapes | Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSuspend | Occurs before the operating system enters a suspended state. If any event handler returns True, the Microsoft Visio instance will deny the operating system's request.
QueryCancelSuspendEvents | Occurs before the application suspends events in response to client code. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelWindowClose | Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QuitCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelQuit event.
ReplaceShapesCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.
RuleSetValidated | Occurs when a rule set is validated.
RunModeEntered | Occurs after a document enters run mode.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionChanged | Occurs after a set of shapes selected in a window changes.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
StyleAdded | Occurs after a new style is added to a document.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.
SuspendCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSuspend event.
SuspendEventsCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSuspendEvents event. .
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.
ViewChanged | Occurs when the zoom level or scroll position of a drawing window changes.
VisioIsIdle | Occurs after the application empties its message queue.
WindowActivated | Occurs after the active window changes in a Microsoft Visio instance.
WindowChanged | Occurs when the size or position of a window changes.
WindowCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.
WindowOpened | Occurs after a window is opened.
WindowTurnedToPage | Occurs after a window shows a different page.

Methods

Name | Description
AddUndoUnit | Adds an object that supports the IOleUndoUnit or IVBUndoUnit interface to the Microsoft Visio undo queue.
BeginUndoScope | Starts a transaction with a unique scope ID for an instance of Microsoft Visio.
ClearCustomMenus | Restores the built-in Microsoft Visio user interface.
ClearCustomToolbars | Restores the built-in Microsoft Visio user interface.
ConvertResult | Converts a string or number into an equivalent number in different measurement units.
DoCmd | Performs the command that has the indicated command ID.
EndUndoScope | Ends or cancels a transaction that has a unique scope.
EnumDirectories | Returns an array naming the folders Microsoft Visio would search, given a list of paths.
FormatResult | Formats a string or number into a string according to a format picture. Uses specified units for scaling and formatting.
FormatResultEx | Formats a string or number into a string according to a format picture, using specified units for scaling and formatting. Optionally, for date or time strings, sets the language and calendar type of the string.
GetBuiltInStencilFile | Returns the file path to the specified built-in, hidden stencil used to populate certain galleries in the Microsoft Visio user interface.
GetCustomStencilFile | Returns the path to the specified custom stencil used to populate certain galleries in the Microsoft Visio user interface.
GetPreviewEnabled | Returns a value that indicates whether preview is enabled for the specified gallery in the Microsoft Visio user interface.
InvokeHelp | Performs operations that involve the Microsoft Visio Help system.
OnComponentEnterState | Informs a Microsoft Visio instance that client code is causing the instance to enter or exit a particular state.
PurgeUndo | Empties the Microsoft Visio queue of undo actions.
QueueMarkerEvent | Queues a MarkerEvent event that fires after all other queued events.
Quit | Closes the indicated instance of Microsoft Visio.
Redo | Reverses the most recent undo unit.
RegisterRibbonX | Registers the IRibbonExtensibility interface that is implemented by the specified add-on to populate the custom user interface (UI).
RenameCurrentScope | Renames the top-level open undo scope.
SetCustomMenus | Replaces the current built-in or custom menus of an application or document.
SetCustomToolbars | Replaces the current built-in or custom toolbars of an application or document.
SetPreviewEnabled | Turns preview on or off for a gallery in the Microsoft Visio user interface.
Undo | Reverses the most recent undo unit, if the undo unit can be reversed.
UnregisterRibbonX | Unregisters a previouly registered IRibbonExtensiblity interface that a Microsoft Visio add-in implements.

Properties

Name | Description
Active | Indicates whether the instance of Microsoft Visio represented by the Application object is the active application on the Microsoft Windows desktop—the application that has the highlighted title bar. Read-only.
ActiveDocument | Returns the active Document object, which is the document shown in the active window. Read-only.
ActivePage | Returns the active Page object. Read-only.
ActivePrinter | Specifies the printer that all Microsoft Visio documents print to. Read/write.
ActiveWindow | Returns the active Window object. Read-only.
AddonPaths | Gets or sets the paths where Microsoft Visio looks for third-party or user add-ons. Read/write.
Addons | Returns the Addons collection of an Application or InvisibleApp object. Read-only.
AlertResponse | Determines whether Microsoft Visio shows alerts and modal dialog boxes to the user. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Assistance | Gets a reference to the Microsoft Office (MSO) IAssistance object, which provides a means for developers to create a customized help experience for users within Microsoft Office. Read-only.
AutoLayout | Allows you to temporarily disable automatic layout functionality in Microsoft Visio and then re-enable it after you are finished with an action. Read/write.
AutoRecoverInterval | Represents the time interval (in minutes) for how often you want to save copies of open documents that have unsaved changes in case of a power failure or an application error. Read/write.
AvailablePrinters | Returns a list of installed printers. Read-only.
Build | Returns the build number of the running instance. Read-only.
BuiltInMenus | Returns a UIObject object that represents a copy of the built-in Microsoft Visio menus and accelerators. Read-only.
BuiltInToolbars | Returns a UIObject object that represents a copy of the built-in Microsoft Visio toolbars. Read-only.
COMAddIns | Returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently registered in Microsoft Visio. Read-only.
CommandBars | Returns a reference to the CommandBars collection that represents the command bars in the container application. Read-only.
CommandLine | Determines how Microsoft Visio was started. Read-only.
ConnectorToolDataObject | Returns an IDataObject interface representing the active Connector tool used in the Microsoft Visio user interface. Read-only.
CurrentEdition | Returns an enumerated value that represents the edition of the current instance of Microsoft Visio. Read-only.
CurrentScope | Determines the ID of the scope that causes an event to fire. Read-only.
CustomMenus | Gets a UIObject object that represents the current custom menus and accelerators of an Application object. Read-only.
CustomMenusFile | Gets or sets the name of the file that defines custom menus and accelerators for an Application object. Read/write.
CustomToolbars | Gets a UIObject object that represents the current custom toolbars and status bars of an Application object. Read-only.
CustomToolbarsFile | Returns or sets the name of the file that defines custom toolbars and status bars for an Application object. Read/write.
DataFeaturesEnabled | Gets whether the data features in Microsoft Visio are enabled for the current instance of Visio. Read-only.
DefaultAngleUnits | Determines the default unit of measure for quantities that represent angles. Read/write.
DefaultDurationUnits | Determines the default unit of measure for quantities that represent durations. Read/write.
DefaultRectangleDataObject | Returns an IDataObject interface that represents the Rectangle tool used in the Microsoft Visio user interface. Read-only.
DefaultTextUnits | Determines the default unit of measure for quantities that represent text metrics. Read/write.
DefaultZoomBehavior | Determines the zoom behavior for all new Microsoft Visio documents and drawing windows. Read/write.
DeferRecalc | Determines whether the application recalculates cell formulas during a series of actions. Read/write.
DeferRelationshipRecalc | Determines whether Microsoft Visio defers recalculating shape sizes and relationships when a member of the relationship pair is moved or resized. Read/write.
DialogFont | Returns information about the fonts that Microsoft Visio uses in its dialog boxes. Read-only.
Documents | Returns the Documents collection for a Microsoft Visio instance. Read-only.
DrawingPaths | Gets or sets the paths where Microsoft Visio looks for drawings. Read/write.
EventInfo | Gets additional information associated with an event, if any exists. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
EventsEnabled | Determines whether a Microsoft Visio instance fires events. Read/write.
FullBuild | Returns the full build number of the running instance. Read-only.
HelpPaths | Gets or sets the paths where Microsoft Visio looks for Help files. Read/write.
InhibitSelectChange | Determines whether shapes added to the drawing page by Automation are selected. Read/write.
InstanceHandle32 | Gets the instance handle of the Application object for a 32-bit version of Microsoft Visio. Read-only.
InstanceHandle64 | Gets the instance handle of the Application object for a 64-bit version of Microsoft Visio. Read-only.
IsInScope | Determines whether a call to an event handler is between an EnterScope event and an ExitScope event for a scope. Read-only.
IsUndoingOrRedoing | Determines whether the current event handler is being called as a result of an Undo or Redo action in the application. Read-only.
IsVisio32 | Returns True if the current instance of Microsoft Visio is 32-bit. Returns False if the current instance is 64-bit. Read-only.
Language | Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.
LanguageHelp | Represents the language ID of the Help in the version of the Microsoft Visio instance represented by the parent object. Read-only.
LanguageSettings | Returns a reference to the Microsoft Office (MSO) LanguageSettings interface. Read-only.
LiveDynamics | Controls whether Microsoft Visio recalculates shape properties during drag operations on every mouse move or only after the mouse button is released. Read/write.
MyShapesPath | Gets or sets where Microsoft Visio looks for the My Shapes folder on the user's hard disk. Read/write.
Name | Specifies the name of an object. Read-only.
ObjectType | Returns an object's type. Read-only.
OnDataChangeDelay | Gets or sets how long the Microsoft Visio instance waits before advising a container application that a Visio document being shown by the container has changed and should be redisplayed. Read/write.
Path | Returns the drive and folder path of the Microsoft Visio application. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
ProcessID | Returns the unique identity of the current Microsoft Visio process. Read-only.
PromptForSummary | Determines whether Microsoft Visio prompts for document properties when it saves a document. Read/write.
SaveAsWebObject | Returns a reference to the IDispatch interface of a VisSaveAsWeb object. Read-only.
ScreenUpdating | Determines whether the screen is updated (redrawn) during a series of actions. Read/write.
Settings | Returns an ApplicationSettings object, which you can use to set Microsoft Visio application properties. Read-only.
ShowChanges | Determines whether the screen is updated (redrawn) during a series of actions. Read/write.
ShowProgress | Determines whether a progress indicator is shown while performing certain operations. Read/write.
ShowStatusBar | Determines whether the status bar is shown. Read/write.
ShowToolbar | Determines whether toolbars and menu bars are visible. Read/write.
StartupPaths | Gets or sets the paths where Microsoft Visio looks for third-party and user add-ons to run when the application is started. Read/write.
Stat | Returns status information for an object. Read-only.
StencilPaths | Gets or sets the paths where Microsoft Visio looks for stencils. Read/write.
TemplatePaths | Gets or sets the paths where Microsoft Visio looks for templates. Read/write.
TraceFlags | Gets or sets events logged during a Microsoft Visio instance. Read/write.
TypelibMajorVersion | Returns the major version number of the Microsoft Visio type library. Read-only.
TypelibMinorVersion | Returns the minor version number of the Microsoft Visio type library. Read-only.
UndoEnabled | Determines whether undo information is maintained in memory. Read/write.
UserName | Gets or sets the user name of an Application object. Read/write.
VBAEnabled | Specifies whether Microsoft Visual Basic for Applications (VBA) is enabled in the application. Read-only.
Vbe | Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Visio documents. Read-only.
Version | Returns the version of a running Microsoft Visio instance. Read-only.
Visible | Determines whether an object is visible. Read/write.
Window | Returns the window associated with the current instance of Microsoft Visio. Read-only.
WindowHandle32 | Returns the 32-bit handle of a Microsoft Visio window. Read-only.
Windows | Returns the Windows collection for a Microsoft Visio instance or window. Read-only.


Application Properties (Visio)

 Copy code hover
[image]

Application Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Active | Indicates whether the instance of Microsoft Visio represented by the Application object is the active application on the Microsoft Windows desktop—the application that has the highlighted title bar. Read-only.
ActiveDocument | Returns the active Document object, which is the document shown in the active window. Read-only.
ActivePage | Returns the active Page object. Read-only.
ActivePrinter | Specifies the printer that all Microsoft Visio documents print to. Read/write.
ActiveWindow | Returns the active Window object. Read-only.
AddonPaths | Gets or sets the paths where Microsoft Visio looks for third-party or user add-ons. Read/write.
Addons | Returns the Addons collection of an Application or InvisibleApp object. Read-only.
AlertResponse | Determines whether Microsoft Visio shows alerts and modal dialog boxes to the user. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Assistance | Gets a reference to the Microsoft Office (MSO) IAssistance object, which provides a means for developers to create a customized help experience for users within Microsoft Office. Read-only.
AutoLayout | Allows you to temporarily disable automatic layout functionality in Microsoft Visio and then re-enable it after you are finished with an action. Read/write.
AutoRecoverInterval | Represents the time interval (in minutes) for how often you want to save copies of open documents that have unsaved changes in case of a power failure or an application error. Read/write.
AvailablePrinters | Returns a list of installed printers. Read-only.
Build | Returns the build number of the running instance. Read-only.
BuiltInMenus | Returns a UIObject object that represents a copy of the built-in Microsoft Visio menus and accelerators. Read-only.
BuiltInToolbars | Returns a UIObject object that represents a copy of the built-in Microsoft Visio toolbars. Read-only.
COMAddIns | Returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently registered in Microsoft Visio. Read-only.
CommandBars | Returns a reference to the CommandBars collection that represents the command bars in the container application. Read-only.
CommandLine | Determines how Microsoft Visio was started. Read-only.
ConnectorToolDataObject | Returns an IDataObject interface representing the active Connector tool used in the Microsoft Visio user interface. Read-only.
CurrentEdition | Returns an enumerated value that represents the edition of the current instance of Microsoft Visio. Read-only.
CurrentScope | Determines the ID of the scope that causes an event to fire. Read-only.
CustomMenus | Gets a UIObject object that represents the current custom menus and accelerators of an Application object. Read-only.
CustomMenusFile | Gets or sets the name of the file that defines custom menus and accelerators for an Application object. Read/write.
CustomToolbars | Gets a UIObject object that represents the current custom toolbars and status bars of an Application object. Read-only.
CustomToolbarsFile | Returns or sets the name of the file that defines custom toolbars and status bars for an Application object. Read/write.
DataFeaturesEnabled | Gets whether the data features in Microsoft Visio are enabled for the current instance of Visio. Read-only.
DefaultAngleUnits | Determines the default unit of measure for quantities that represent angles. Read/write.
DefaultDurationUnits | Determines the default unit of measure for quantities that represent durations. Read/write.
DefaultRectangleDataObject | Returns an IDataObject interface that represents the Rectangle tool used in the Microsoft Visio user interface. Read-only.
DefaultTextUnits | Determines the default unit of measure for quantities that represent text metrics. Read/write.
DefaultZoomBehavior | Determines the zoom behavior for all new Microsoft Visio documents and drawing windows. Read/write.
DeferRecalc | Determines whether the application recalculates cell formulas during a series of actions. Read/write.
DeferRelationshipRecalc | Determines whether Microsoft Visio defers recalculating shape sizes and relationships when a member of the relationship pair is moved or resized. Read/write.
DialogFont | Returns information about the fonts that Microsoft Visio uses in its dialog boxes. Read-only.
Documents | Returns the Documents collection for a Microsoft Visio instance. Read-only.
DrawingPaths | Gets or sets the paths where Microsoft Visio looks for drawings. Read/write.
EventInfo | Gets additional information associated with an event, if any exists. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
EventsEnabled | Determines whether a Microsoft Visio instance fires events. Read/write.
FullBuild | Returns the full build number of the running instance. Read-only.
HelpPaths | Gets or sets the paths where Microsoft Visio looks for Help files. Read/write.
InhibitSelectChange | Determines whether shapes added to the drawing page by Automation are selected. Read/write.
InstanceHandle32 | Gets the instance handle of the Application object for a 32-bit version of Microsoft Visio. Read-only.
InstanceHandle64 | Gets the instance handle of the Application object for a 64-bit version of Microsoft Visio. Read-only.
IsInScope | Determines whether a call to an event handler is between an EnterScope event and an ExitScope event for a scope. Read-only.
IsUndoingOrRedoing | Determines whether the current event handler is being called as a result of an Undo or Redo action in the application. Read-only.
IsVisio32 | Returns True if the current instance of Microsoft Visio is 32-bit. Returns False if the current instance is 64-bit. Read-only.
Language | Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.
LanguageHelp | Represents the language ID of the Help in the version of the Microsoft Visio instance represented by the parent object. Read-only.
LanguageSettings | Returns a reference to the Microsoft Office (MSO) LanguageSettings interface. Read-only.
LiveDynamics | Controls whether Microsoft Visio recalculates shape properties during drag operations on every mouse move or only after the mouse button is released. Read/write.
MyShapesPath | Gets or sets where Microsoft Visio looks for the My Shapes folder on the user's hard disk. Read/write.
Name | Specifies the name of an object. Read-only.
ObjectType | Returns an object's type. Read-only.
OnDataChangeDelay | Gets or sets how long the Microsoft Visio instance waits before advising a container application that a Visio document being shown by the container has changed and should be redisplayed. Read/write.
Path | Returns the drive and folder path of the Microsoft Visio application. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
ProcessID | Returns the unique identity of the current Microsoft Visio process. Read-only.
PromptForSummary | Determines whether Microsoft Visio prompts for document properties when it saves a document. Read/write.
SaveAsWebObject | Returns a reference to the IDispatch interface of a VisSaveAsWeb object. Read-only.
ScreenUpdating | Determines whether the screen is updated (redrawn) during a series of actions. Read/write.
Settings | Returns an ApplicationSettings object, which you can use to set Microsoft Visio application properties. Read-only.
ShowChanges | Determines whether the screen is updated (redrawn) during a series of actions. Read/write.
ShowProgress | Determines whether a progress indicator is shown while performing certain operations. Read/write.
ShowStatusBar | Determines whether the status bar is shown. Read/write.
ShowToolbar | Determines whether toolbars and menu bars are visible. Read/write.
StartupPaths | Gets or sets the paths where Microsoft Visio looks for third-party and user add-ons to run when the application is started. Read/write.
Stat | Returns status information for an object. Read-only.
StencilPaths | Gets or sets the paths where Microsoft Visio looks for stencils. Read/write.
TemplatePaths | Gets or sets the paths where Microsoft Visio looks for templates. Read/write.
TraceFlags | Gets or sets events logged during a Microsoft Visio instance. Read/write.
TypelibMajorVersion | Returns the major version number of the Microsoft Visio type library. Read-only.
TypelibMinorVersion | Returns the minor version number of the Microsoft Visio type library. Read-only.
UndoEnabled | Determines whether undo information is maintained in memory. Read/write.
UserName | Gets or sets the user name of an Application object. Read/write.
VBAEnabled | Specifies whether Microsoft Visual Basic for Applications (VBA) is enabled in the application. Read-only.
Vbe | Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Visio documents. Read-only.
Version | Returns the version of a running Microsoft Visio instance. Read-only.
Visible | Determines whether an object is visible. Read/write.
Window | Returns the window associated with the current instance of Microsoft Visio. Read-only.
WindowHandle32 | Returns the 32-bit handle of a Microsoft Visio window. Read-only.
Windows | Returns the Windows collection for a Microsoft Visio instance or window. Read-only.


Application.Active Property (Visio)

 Copy code hover
[image]

Application.Active Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether the instance of Microsoft Visio represented by the Application object is the active application on the Microsoft Windows desktop—the application that has the highlighted title bar. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .Active

expression A variable that represents an Application object.

Return Value

Integer

Remarks

The active application on the Windows desktop is distinct from the active Visio instance, which is returned by a call to the OLE GetActiveObject method (GetObject method in Microsoft Visual Basic). The GetObject method retrieves the instance of Visio that was most recently activated, which may or may not be the active application on the desktop at that moment. Of all instances of Visio that are currently running, only one is the active Visio instance.

For example, suppose you start one instance of Visio and one of another application, such as Microsoft Excel.

  • If the instance of Visio is the active application on your desktop, GetObject(, "visio.application") retrieves that instance, and its Active property is True.

  • If you activate the instance of Microsoft Excel, GetObject(, "visio.application") retrieves the same instance of Visio, but its Active property is False.

If an Application object's Active property is True, you can assume that the corresponding instance of Visio is the active instance of Visio unless the InPlace property is also True. If an instance of Visio is activated for in-place editing in a container application, that instance may not necessarily report itself as the active instance of Visio.

Example

The following Visual Basic program shows how to get the active instance of Visio.

VBA Copy code Copy code

Public Sub Active_Example()

 Dim vsoApplication1 As Visio.Application
 Dim vsoApplication2 As Visio.Application

 'Create two new instances of Visio.
 Set vsoApplication1 = CreateObject("visio.application")
 Set vsoApplication2 = CreateObject("visio.application")

 'Use the Active property to determine whether
 'the instance of Visio is active. 'Result = False. Prints "0" in the Immediate window
 Debug.Print vsoApplication1.Active

 'Result = True. Prints "-1" in the Immediate window.
 Debug.Print vsoApplication2.Active

End Sub


Application.ActiveDocument Property (Visio)

 Copy code hover
[image]

Application.ActiveDocument Property (Visio)
Send feedback

Published: July 16, 2012

Returns the active Document object, which is the document shown in the active window. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ActiveDocument

expression A variable that represents an Application object.

Return Value

Document

Remarks

When no documents are open, there is no active document and the ActiveDocument property returns the value Nothing and does not raise an exception.

If your code is in the Microsoft Visual Basic project of a Visio document, the ActiveDocument property often, but not necessarily, returns a reference to the ThisDocument object, a class module in the Visual Basic project of every Microsoft Visio document. If the ThisDocument object is shown in the active window, the ActiveDocument object and the ThisDocument object refer to the same document. When the ThisDocument object is referenced from code in a project, it returns a reference to the project's Document object.

Whether you use the ActiveDocument object or the ThisDocument object depends on the purpose of your code.

You can compare the result returned by the ActiveDocument property with the value Nothing to determine if a document is active. If the value of the Application.Documents.Count property is greater than zero, at least one document is open and active.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.ActiveDocument

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows two safe ways to get an active document (if one exists). In each case, it prints the name of the active document in the Immediate window. The code gets the active document without qualification from the Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document.

VBA Copy code Copy code

Public Sub ActiveDocument_Example()

    Dim vsoDocument As Document

    'First method
    If Documents.Count > 0 Then
        Set vsoDocument = ActiveDocument
        Debug.Print vsoDocument.Name
    Else
        Debug.Print "No active document."
    End If

    'Second method
    If Not(ActiveDocument Is Nothing)  Then
        Set vsoDocument = ActiveDocument
        Debug.Print vsoDocument.Name
    Else
        Debug.Print "No active document."
    End If

End Sub


Application.ActivePage Property (Visio)

 Copy code hover
[image]

Application.ActivePage Property (Visio)
Send feedback

Published: July 16, 2012

Returns the active Page object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ActivePage

expression A variable that represents an Application object.

Return Value

Page

Remarks

The ActivePage property returns a Page object only when the active window displays a drawing page; otherwise, it returns Nothing. To verify that a page is active, use the Is operator to compare the ActivePage property with Nothing.

It is possible to get the active window without qualification from the Microsoft Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document. For example, you can use this code:

VBA Copy code Copy code
Set vsoPage = ActivePage

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.ActivePage

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the active page without qualification from the Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document.

VBA Copy code Copy code

Public Sub ActivePage_Example()

    Dim vsoPage As Page

    'Find out if a page exists, and if it does, get the page.
    If Not(ActivePage Is Nothing)  Then
        Set vsoPage = ActivePage
        Debug.Print vsoPage.Name
    Else
        Debug.Print "No active page."
    End If

End Sub


Application.ActivePrinter Property (Visio)

 Copy code hover
[image]

Application.ActivePrinter Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the printer that all Microsoft Visio documents print to. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .ActivePrinter

expression A variable that represents an Application object.

Return Value

String

Remarks

The ActivePrinter property is initially set to the default printer.


Application.ActiveWindow Property (Visio)

 Copy code hover
[image]

Application.ActiveWindow Property (Visio)
Send feedback

Published: July 16, 2012

Returns the active Window object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ActiveWindow

expression A variable that represents an Application object.

Return Value

Window

Remarks

The active window can be one of the following window types: Drawing, Stencil, ShapeSheet, Edit Icon, or a Drawing or Stencil window created by an add-on. The application's active window can only be an MDI frame window—it cannot be one of the floating, docked, or anchored windows. For a complete list of window types, see the Type property.

If a window in an instance of Microsoft Visio is not active, the ActiveWindow property returns Nothing.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.ActiveWindow

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to get the active window without qualification from the Microsoft Office Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document.

VBA Copy code Copy code

Public Sub ActiveWindow_Example()

    Dim vsoWindow As Visio.Window

    'Get the active window.
    Set vsoWindow = ActiveWindow

    'To verify that we got the active window, print its caption.
    Debug.Print vsoWindow.Caption

End Sub


Application.AddonPaths Property (Visio)

 Copy code hover
[image]

Application.AddonPaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for third-party or user add-ons. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddonPaths

expression A variable that represents an Application object.

Return Value

String

Remarks

The AddonPaths property is set to an empty string ("") by default.

To indicate more than one folder in the path where you want Visio to look for third-party or user add-ons, use semicolons to separate individual items in the path string.

The string passed to and received from the AddonPaths property is the same string shown in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\AddonsPath subkey.

When Visio looks for third-party and user add-ons, it looks in all paths named in the AddonPaths property, as well as at the paths of any add-ons installed at setup, and all the subfolders of those paths. If you pass the AddonPaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Starting with Microsoft Office Visio 2003, instead of specifying file paths to your Visio add-ons, you can publish your add-ons by using a Microsoft Windows Installer package. By doing so, you can take advantage of Microsoft Office features such as language switching, installation on demand, and repair. For more information about using a Windows Installer package to publish your add-ons, search for "Microsoft Windows Installer" on MSDN.

Note Note

Modifying the registry in any manner, whether through the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).


Application.Addons Property (Visio)

 Copy code hover
[image]

Application.Addons Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Addons collection of an Application or InvisibleApp object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Addons

expression A variable that represents an Application object.

Return Value

Addons

Remarks

The Addons collection includes an Addon object for each add-on in the folders specified by the AddonPaths property and for each add-on that is added dynamically to the collection by other add-ons.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the Addons collection and add an add-on to it.

Before running this macro, replace path\filename with a valid path and file name for an add-on in your Visio project.

VBA Copy code Copy code

Public Sub Addons_Example()

 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Add an add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add("path\filename")

End Sub


Application.AlertResponse Property (Visio)

 Copy code hover
[image]

Application.AlertResponse Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio shows alerts and modal dialog boxes to the user. Read/write.

Version Information

Version Added: Visio 4.1

Syntax

expression .AlertResponse

expression A variable that represents an Application object.

Return Value

Integer

Remarks

Certain operations, such as closing a document that has unsaved modifications, cause Visio to display an alert or modal dialog box requesting the user to supply a response such as OK, Yes, No, or Cancel. To prevent Visio from displaying an alert or modal dialog box when a program performs such an action, set the AlertResponse property to a default value for the response. In this case, Visio does not display the alert or modal dialog box; instead, Visio behaves as if the user responded to the alert or modal dialog box with the value of the AlertResponse property.

If the AlertResponse property is 0 (its default value), alerts and modal dialog boxes are displayed.

The values you supply for the AlertResponse property correspond to the standard Windows constants IDOK, IDCANCEL, and so forth.

Constant | Value
IDOK | 1
IDCANCEL | 2
IDABORT | 3
IDRETRY | 4
IDIGNORE | 5
IDYES | 6
IDNO | 7


Application.Application Property (Visio)

 Copy code hover
[image]

Application.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents an Application object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Application.Assistance Property (Visio)

 Copy code hover
[image]

Application.Assistance Property (Visio)
Send feedback

Published: July 16, 2012

Gets a reference to the Microsoft Office (MSO) IAssistance object, which provides a means for developers to create a customized help experience for users within Microsoft Office. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .Assistance

expression An expression that returns a Application object.

Return Value

Object

Remarks

The IAssistance object exposes methods that allow developers to display Help topics in the Office Help Viewer or to display Help topics that ship with Microsoft Office in the Visio Help window.


Application.AutoLayout Property (Visio)

 Copy code hover
[image]

Application.AutoLayout Property (Visio)
Send feedback

Published: July 16, 2012

Allows you to temporarily disable automatic layout functionality in Microsoft Visio and then re-enable it after you are finished with an action. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .AutoLayout

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

Using the AutoLayout property helps to improve the performance of add-ons that execute many operations in connected drawings that use Visio automatic layout functionality.


Application.AutoRecoverInterval Property (Visio)

 Copy code hover
[image]

Application.AutoRecoverInterval Property (Visio)
Send feedback

Published: July 16, 2012

Represents the time interval (in minutes) for how often you want to save copies of open documents that have unsaved changes in case of a power failure or an application error. Read/write.

Version Information

Version Added: Visio 2000 SR-1

Syntax

expression .AutoRecoverInterval

expression A variable that represents an Application object.

Return Value

Integer

Remarks

Must be an integer value from zero (0) to 120, representing the interval in minutes. The default is 0. If the value of the AutoRecoverInterval property is less than or equal to 0, no automatic recovery copies are created.

If the value of the AutoRecoverInterval property is greater than 0, automatic recovery is enabled for all documents in the Microsoft Visio instance. To disable automatic recovery for a particular document, set its AutoRecover property to False.

Example

The following Microsoft Visual Basic for Applications (VBA) macros show how to set the AutoRecoverInterval property and how to use it to disable automatic recovery.

VBA Copy code Copy code

Public Sub AutoRecoverInterval_Example()

    'Save automatic recovery copies of unsaved files
    'every 10 minutes.
    Application.AutoRecoverInterval = 10

End Sub

Public Sub DisableAutoRecover_Example()

    'Tell Visio not to save automatic recovery copies of unsaved files.
    Application.AutoRecoverInterval = 0

End Sub


Application.AvailablePrinters Property (Visio)

 Copy code hover
[image]

Application.AvailablePrinters Property (Visio)
Send feedback

Published: July 16, 2012

Returns a list of installed printers. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .AvailablePrinters

expression A variable that represents an Application object.

Return Value

String()

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AvailablePrinters property to get a list of available printers.

VBA Copy code Copy code
Public Sub AvailablePrinters_example()

 Dim aStrPrinters() As String
 Dim strPrinter As Variant

 aStrPrinters = Application.AvailablePrinters

 For Each strPrinter In aStrPrinters

 Debug.Print strPrinter

 Next

End Sub


Application.Build Property (Visio)

 Copy code hover
[image]

Application.Build Property (Visio)
Send feedback

Published: July 16, 2012

Returns the build number of the running instance. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .Build

expression A variable that represents an Application object.

Return Value

Long

Remarks

The format of the build number is described in the following table.

Bits | Description
0 - 15 | Internal build number

The build number of the running instance is written to the BuildNumberCreated property when a new document is created, and to the BuildNumberEdited property when a document is edited.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Build property to get the build number of the running instance of Visio.

VBA Copy code Copy code

Public Sub Build_Example()

 Debug.Print Application.Build

End Sub


Application.BuiltInMenus Property (Visio)

 Copy code hover
[image]

Application.BuiltInMenus Property (Visio)
Send feedback

Published: July 16, 2012

Returns a UIObject object that represents a copy of the built-in Microsoft Visio menus and accelerators. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .BuiltInMenus

expression A variable that represents an Application object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You can use the BuiltInMenus property to obtain a UIObject object and modify its menus and accelerators. You can then use the SetCustomMenus method of an Application or Document object to add your customized menus and accelerators to the built-in Visio user interface.

You can also use the SaveToFile method of the UIObject object to store its menus in a file and reload them as custom menus by setting the CustomMenusFile property of an Application or Document object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the BuiltInMenus property. It adds a menu and menu item to the Add-ins tab and sets the menu and menu item's Caption properties.

To restore the built-in user interface in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub BuiltInMenus_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a new menu before the Window menu.
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "MyNewMenu"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the Caption property for the new menu item.
 vsoMenuItem.Caption = "&MyNewMenuItem"

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


Application.BuiltInToolbars Property (Visio)

 Copy code hover
[image]

Application.BuiltInToolbars Property (Visio)
Send feedback

Published: July 16, 2012

Returns a UIObject object that represents a copy of the built-in Microsoft Visio toolbars. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .BuiltInToolbars(fIgnored)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
fIgnored | Required | Integer | Required Integer. Required for backward compatibility, but ignored. It is suggested that you pass zero (0).

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You can use the BuiltInToolbars property to obtain a UIObject object and modify its toolbars. You can then use the SetCustomToolbars method of an Application or Document object to substitute your customized toolbars for the built-in Visio toolbars.

You can also use the SaveToFile method of the UIObject object to store its toolbars in a file and reload them as custom toolbars by setting the CustomToolbarsFile property of an Application or Document object.

Prior to Visio 5.0, the argument for this property was (fWhichToolbars), which designated the type of toolbar to get (MSOffice or LotusSS). Beginning with Visio 5.0, the application no longer supports different types of toolbars and the current argument, (fIgnored), is ignored.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the BuiltInToolbars property to get a copy of the built-in Visio toolbars, add a toolbar button, set the button icon, and replace the built-in toolbar set with the custom set.

Before running this macro, replace (path\filename) in the code below with the full path to and file name of an icon file (.ico) on your computer.

To restore the built in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub BuiltInToolbars_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.'NOTE: Use ItemAtID to get the toolbar sets.'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON

 'Set the caption for the new toolbar button.
 vsoToolbarItem.Caption = "MyButton"

 'Set the icon for the new toolbar button.
 vsoToolbarItem.IconFileName "(path\filename)"'Tell Visio to actually use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


Application.COMAddIns Property (Visio)

 Copy code hover
[image]

Application.COMAddIns Property (Visio)
Send feedback

Published: July 16, 2012

Returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently registered in Microsoft Visio. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .COMAddIns

expression A variable that represents an Application object.

Return Value

Object

Remarks

The COM add-ins that are currently registered are listed in the COM Add-Ins dialog box (click the File tab, click Options, click Add-Ins, and then click Go).

To get information about the object returned by the COMAddIns property:

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click Office.

  4. Under Classes, examine the class named COMAddIns.

Example

This macro shows how to use the COMAddIns property to list the COM add-ins registered with Visio.

VBA Copy code Copy code

Public Sub COMAddIns_Example()

    Dim vsoCOMAddIns As COMAddIns
    Dim vsoCOMAddIn As COMAddIn

    'Get the set of COM add-ins.
    Set vsoCOMAddIns = Application.COMAddIns

    'List each COM add-in in the Immediate window.
    For Each vsoCOMAddIn In vsoCOMAddIns
        Debug.Print vsoCOMAddIn.Description
    Next

End Sub


Application.CommandBars Property (Visio)

 Copy code hover
[image]

Application.CommandBars Property (Visio)
Send feedback

Published: July 16, 2012

Returns a reference to the CommandBars collection that represents the command bars in the container application. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .CommandBars

expression A variable that represents an Application object.

Return Value

CommandBars

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Beginning with Microsoft Visio 2002, a program can manipulate menus and toolbars in the Visio user interface by manipulating the CommandBars collection returned by the CommandBars property. The CommandBars collection has an interface identical to the CommandBars collection exposed by the suite of Microsoft Office applications such as Microsoft Word and Microsoft Excel.

Alternatively, since Visio version 4.0, Visio has exposed application and document properties that return a UIObject object that provides similar functionality to CommandBars. Consequently, programs can use either the CommandBars collection or UIObject objects to manipulate the Visio menus and toolbars.

To get information about the object returned by the CommandBars property:

  1. On the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click Office.

  4. If you do not see the Office type library in the Project/Library list, on the Tools menu, click References, select the Microsoft Office 14.0 Object Library check box, and then click OK.

  5. Under Classes, examine the class named CommandBars.

Note Note

Each CommandBarControl object in a CommandBars collection has an OnAction property, and each CommandBar object in a CommandBars collection has a Context property. The values of these properties are determined by the container application. In Microsoft Visio:

  • The OnAction property is a String value that is interpreted either as a COM add-in, as a Microsoft Visual Basic for Applications (VBA) macro, as VBA code, or as a Visio add-on name.

  • The Context property determines in which menu context a command bar appears. The menu context number is a String value (for example visUIObjSetDrawing or "2"), which is followed by an asterisk if the command bar is visible by default (for example, visUIObjSetShapeSheet & "*" or "4*"). Valid menu contexts are visUIObjSetDrawing (2), visUIObjSetStencil (3), visUIObjSetShapeSheet (4), visUIObjSetIcon(5), or visUIObjSetPrintPreview (7). Attempting to set the Context property to any other value will fail.

For more information about using the OnAction and Context properties in Visio, see Developing Microsoft Visio Solutions on MSDN, the Microsoft Developer Network.

Example

This macro shows how to use the CommandBars property to list the command bars.

VBA Copy code Copy code

Public Sub CommandBars_Example()

 Dim vsoCommandBars As CommandBars
 Dim vsoCommandBar As CommandBar

 'Get the set of CommandBars
 'for the application.
 Set vsoCommandBars = Application.CommandBars

 'List each CommandBar in the Immediate window.
 For Each vsoCommandBar In vsoCommandBars
 Debug.Print vsoCommandBar.Name
 Next

End Sub


Application.CommandLine Property (Visio)

 Copy code hover
[image]

Application.CommandLine Property (Visio)
Send feedback

Published: July 16, 2012

Determines how Microsoft Visio was started. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .CommandLine

expression A variable that represents an Application object.

Return Value

String

Remarks

When you double-click a drawing, template, or stencil icon to start the application, the name of the file appears in the string returned by the CommandLine property. When you use a CreateObject call to start the application, "/Automation" appears in the string. When you double-click a Visio embedded object in an OLE container application, "/Embedding" appears in the string.

The following table includes other command line switches you can use to start the application.

Command line switch | Description
/nonew | The New tab is not shown on startup.
/nologo | The startup screen is not shown on startup.
/p filename | The Print dialog box is shown, so that you can quickly print a file.
filename | Opens a Visio file. Either the file has to be in the Drawings file path in the File Locations dialog box (click the File tab, click Options, click Advanced, and then, under General, click File Locations), or you must name an absolute path.
/1, /2, /3,.../9 | Opens one of the last-opened files.
/noreg | Prevents Visio from registering itself.
/u | Unregisters Visio.
/r | Registers Visio.
/s | Silently registers Visio.
/pt filename,[printername, drivername, portname] | Directs the file to print on a particular printer. (Added in Visio version 5.0c.)
::ODMA | Visio uses ODMA to open a file.


Application.ConnectorToolDataObject Property (Visio)

 Copy code hover
[image]

Application.ConnectorToolDataObject Property (Visio)
Send feedback

Published: July 16, 2012

Returns an IDataObject interface representing the active Connector tool used in the Microsoft Visio user interface. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ConnectorToolDataObject

expression A variable that represents an Application object.

Return Value

IDataObject

Remarks

By default, ConnectorToolDataObject returns the built-in Visio Connector tool. If a master from a stencil is the active connector, ConnectorToolDataObject returns a data object for that master. If Visio fails to retrieve the internal IDataObject, it raises an exception.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ConnectorToolDataObject property to connect two shapes. It drops two masters on the page and connects them with a Dynamic Connector shape, using dynamic glue. Before running this macro, open the Basic Shapes stencil, if it is not already open.

VBA Copy code Copy code
Public Sub ConnectorToolDataObject_Example()

 Dim vsoSquareShape As Visio.Shape
 Dim vsoCircleShape As Visio.Shape
 Dim vsoConnectorShape As Visio.Shape

 Dim vsoCell1 As Visio.Cell
 Dim vsoCell2 As Visio.Cell
 Dim vsoCell3 As Visio.Cell
 Dim vsoCell4 As Visio.Cell

 Set vsoSquareShape = ActiveWindow.Page.Drop(Documents("BASIC_U.VSS").Masters.ItemU("Square"), 4, 9)
 Set vsoCircleShape = ActiveWindow.Page.Drop(Documents("BASIC_U.VSS").Masters.ItemU("Circle"), 4#, 6)
 Set vsoConnectorShape = Application.ActiveWindow.Page.Drop(Application.ConnectorToolDataObject, 2, 2)

 Set vsoCell1 = ActivePage.Shapes(3).Cells("BeginX")
 Set vsoCell2 = ActivePage.Shapes(1).CellsSRC(7, 0, 0)
 vsoCell1.GlueTo vsoCell2

 Set vsoCell3 = ActivePage.Shapes(3).Cells("EndX")
 Set vsoCell4 = ActivePage.Shapes(2).CellsSRC(7, 1, 0)
 vsoCell3.GlueTo vsoCell4

End Sub


Application.CurrentEdition Property (Visio)

 Copy code hover
[image]

Application.CurrentEdition Property (Visio)
Send feedback

Published: July 16, 2012

Returns an enumerated value that represents the edition of the current instance of Microsoft Visio. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .CurrentEdition

expression An expression that returns an Application object.

Return Value

VisEdition

Remarks

The CurrentEdition property returns a constant from the VisEdition enumeration.


Application.CurrentScope Property (Visio)

 Copy code hover
[image]

Application.CurrentScope Property (Visio)
Send feedback

Published: July 16, 2012

Determines the ID of the scope that causes an event to fire. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .CurrentScope

expression A variable that represents an Application object.

Return Value

Long

Remarks

Returns visScopeIDInvalid (-1) if a scope isn't open. The scope ID could be an internal Microsoft Visio scope ID that corresponds to a Visio command or an external scope ID passed to an Automation client by the BeginUndoScope method.

The recipients of an event consider a scope open if the EnterScope event has fired but the ExitScope event has not fired.

To determine if the event queue firing is related to a particular scope internal to the application or one opened and closed by an Automation client, use the IsInScope property.

Example

This example shows how to use the CurrentScope property to determine the ID of the current scope.

VBA Copy code Copy code
Private WithEvents vsoApplication As Visio.Application
Private lngScopeID As Long

Public Sub ScopeActions()

 Dim vsoShape As Visio.Shape

 'Set the module level application variable to
 'trap Application level events.
 Set vsoApplication = Application

 'Begin a scope, set the module level variable.
 lngScopeID = Application.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell (which would trigger a cell changed event).
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 Application.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering current scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal strDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting current scope " & nScopeID
 Else
 Debug.Print "ExitScope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


Application.CustomMenus Property (Visio)

 Copy code hover
[image]

Application.CustomMenus Property (Visio)
Send feedback

Published: July 16, 2012

Gets a UIObject object that represents the current custom menus and accelerators of an Application object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomMenus

expression A variable that represents an Application object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If Microsoft Visio menus and accelerators have not been customized, either programmatically, by a Visio solution, or in the user interface, the CustomMenus property returns Nothing.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the currently active user interface (UI) for your document without replacing the application-level custom UI. You must write additional code to add your custom UI items.

VBA Copy code Copy code

Sub CustomMenus_Example()

 Dim vsoUIObject As Visio.UIObject

 'Check whether there are custom menus bound to the document.
 If ThisDocument.CustomMenus Is Nothing Then

 'If not, check whether there are custom menus bound to the application.
 If Visio.Application.CustomMenus Is Nothing Then

 'If not, use the Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus
 MsgBox "Using Built-In Menus", 0

 Else

 'If there are existing Visio application-level custom menus, use them.
 Set vsoUIObject = Visio.Application.CustomMenus
 MsgBox "Using Custom Menus", 0

 End If

 Else

 'Use the existing custom menus.
 Set vsoUIObject = ThisDocument.CustomMenus
 MsgBox "Using Custom Menus", 0

 End If

End Sub


Application.CustomMenusFile Property (Visio)

 Copy code hover
[image]

Application.CustomMenusFile Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of the file that defines custom menus and accelerators for an Application object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomMenusFile

expression A variable that represents an Application object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the object is not using custom menus, the CustomMenusFile property returns Nothing.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the currently active UI for your document without replacing the application-level custom UI. It also saves any existing custom menus to a file and specifies that the current document use those menus. You must write additional code to add your custom UI items.

Note Note

This macro uses the VBA keyword Kill to delete a file on disk. Use this keyword carefully, because you cannot undo a Kill command once it has been run, and you will not get a prior warning message.

VBA Copy code Copy code

Sub CustomMenusFile_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim strPath As String

 'Check whether there are custom menus bound to the document.
 If ThisDocument.CustomMenus Is Nothing Then

 'If not, check whether there are custom menus bound to the application.
 If Visio.Application.CustomMenus Is Nothing Then

 'If not, use the Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus
 MsgBox "Using Built-In Menus", 0

 Else

 'If there are existing Visio custom menus, use them.
 Set vsoUIObject = Visio.Application.CustomMenus

 'Save these custom menus to a file.
 strPath = Visio.Application.Path & "\CustomUI.vsu"
 vsoUIObject.SaveToFile (strPath)

 'Set the document to use the existing custom UI.
 ThisDocument.CustomMenusFile = strPath

 'Get this document's UIObject object.
 Set vsoUIObject = ThisDocument.CustomMenus

 'Delete the newly created temp file.
 Kill Visio.Application.Path & "\CustomUI.vsu"
 ThisDocument.ClearCustomMenus
 MsgBox "Using Custom Menus", 0

 End If

 Else

 'Use the existing custom menus.
 Set vsoUIObject = ThisDocument.CustomMenus

 End If

End Sub


Application.CustomToolbars Property (Visio)

 Copy code hover
[image]

Application.CustomToolbars Property (Visio)
Send feedback

Published: July 16, 2012

Gets a UIObject object that represents the current custom toolbars and status bars of an Application object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomToolbars

expression A variable that represents an Application object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If Microsoft Visio toolbars and status bars have not been customized, either programmatically, by a Visio solution, or in the user interface, the CustomToolbars property returns Nothing.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the currently active user interface (UI) for your document without replacing the application-level custom UI. You must write additional code to add your custom UI items.

VBA Copy code Copy code
Sub CustomToolbars_Example()

 Dim vsoUIObject As Visio.UIObject

 'Check whether there are custom toolbars bound to the document.
 If ThisDocument.CustomToolbars Is Nothing Then

 'If not, check whether there are custom toolbars bound to the application.
 If Visio.Application.CustomToolbars Is Nothing Then

 'If not, use the Visio built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)
 MsgBox "Using Built-In Toolbars", 0

 Else

 'If there are existing Visio application-level custom toolbars, use them.
 Set vsoUIObject = Visio.Application.CustomToolbars
 MsgBox "Using Custom Toolbars", 0

 End If

 Else

 'Use the existing custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars
 MsgBox "Using Custom Toolbars", 0

 End If

End Sub


Application.CustomToolbarsFile Property (Visio)

 Copy code hover
[image]

Application.CustomToolbarsFile Property (Visio)
Send feedback

Published: July 16, 2012

Returns or sets the name of the file that defines custom toolbars and status bars for an Application object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomToolbarsFile

expression A variable that represents an Application object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the object is not using custom toolbars, the CustomToolbarsFile property returns Nothing.


Application.DataFeaturesEnabled Property (Visio)

 Copy code hover
[image]

Application.DataFeaturesEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Gets whether the data features in Microsoft Visio are enabled for the current instance of Visio. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .DataFeaturesEnabled

expression An expression that returns a Application object.

Return Value

Boolean

Remarks

Whether the data features are enabled depends on the licensing of the installed version of Visio.


Application.DefaultAngleUnits Property (Visio)

 Copy code hover
[image]

Application.DefaultAngleUnits Property (Visio)
Send feedback

Published: July 16, 2012

Determines the default unit of measure for quantities that represent angles. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .DefaultAngleUnits

expression A variable that represents an Application object.

Return Value

Variant

Remarks

The DefaultAngleUnits property corresponds to the value shown in the Angle box under Display on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).

The return value contains one of the values of VisUnitCodes, which are declared in the Microsoft Visio type library.

You can specify the value of the DefaultAngleUnits property as an integer (a member of VisUnitCodes) or a string value such as "degrees". If the string is invalid or the unit code is inappropriate (non-angular), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Cell formulas that contain a specific unit of measure are displayed in those units regardless of the default angle units setting. Many cell formulas, however, use implicit unit syntax and are displayed in default units.

A program can create a cell whose formula is displayed in default units by setting the cell's Formula property to a string in implicit unit syntax. For example, if the formula for the angle of a shape is "=90[deg,A]" , the result is displayed as "90 deg." if the DefaultAngleUnits property is visDegrees, and "1.5708 rad." if the DefaultAngleUnits property is visRadians.

Alternatively, a program can use the following statement to set the cell's result to default angle units:

VBA Copy code Copy code
vsoCell.Result(visAngleUnits) = 90

In this case, the result is 90 degrees if the DefaultAngleUnits property is visDegrees, and 90 radians if the DefaultAngleUnits property is visRadians.

For details about implicit units of measure, see About Units of Measure.


Application.DefaultDurationUnits Property (Visio)

 Copy code hover
[image]

Application.DefaultDurationUnits Property (Visio)
Send feedback

Published: July 16, 2012

Determines the default unit of measure for quantities that represent durations. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .DefaultDurationUnits

expression A variable that represents an Application object.

Return Value

Variant

Remarks

The DefaultDurationUnits property corresponds to the value shown in the Duration box under Display on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).

The return value contains one of the values of VisUnitCodes, which are declared in the Microsoft Visio type library.

You can specify DefaultDurationUnits as an integer (a member of VisUnitCodes) or a string value such as "minutes". If the string is invalid or the unit code is inappropriate (non-duration), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Cell formulas that contain a specific unit of measure are displayed in those units regardless of the default duration units setting. Many cell formulas, however, use implicit unit syntax and are displayed in default units.

A program can create a cell whose formula displays in default units by setting the cell's Formula property to a string in implicit unit syntax. For example, if a formula specifying duration is "=10[em,E]" , the result displays as "0.0069 ed" if the DefaultDurationUnits property is visElapsedDay, and "600.0000 es" if the DefaultDurationUnits property is visElapsedSec.

Alternatively, a program can use the following statement to set the cell's result to default duration units:

VBA Copy code Copy code
vsoCell.Result(visDurationUnits) = 60

In this case, the result is 60 minutes if the DefaultDurationUnits property is visElapsedMin and 60 seconds if the DefaultDurationUnits property is visElapsedSec.

For details about implicit units of measure, see About Units of Measure.


Application.DefaultRectangleDataObject Property (Visio)

 Copy code hover
[image]

Application.DefaultRectangleDataObject Property (Visio)
Send feedback

Published: July 16, 2012

Returns an IDataObject interface that represents the Rectangle tool used in the Microsoft Visio user interface. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .DefaultRectangleDataObject

expression An expression that returns a Application object.

Return Value

IDataObject

Remarks

By using the DefaultRectangleDataObject property to get an IDataObject interface, you can create a new rectangle shape linked to data—a result similar to that you would get by dragging a data recordset row onto the page. This property is useful in situations where no master is selected in a docked stencil.


Application.DefaultTextUnits Property (Visio)

 Copy code hover
[image]

Application.DefaultTextUnits Property (Visio)
Send feedback

Published: July 16, 2012

Determines the default unit of measure for quantities that represent text metrics. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .DefaultTextUnits

expression A variable that represents an Application object.

Return Value

Variant

Remarks

The DefaultTextUnits property corresponds to the value shown in the Text box under Display on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).

The return value contains one of the values of VisUnitCodes, which are declared in the Microsoft Visio type library.

You can specify the value of DefaultTextUnits as an integer (a member of VisUnitCodes) or a string value such as "pt". If the string is invalid or the unit code is inappropriate (non-textual), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Cell formulas that contain a specific unit of measure are displayed in those units regardless of the default text units setting. Many cell formulas, however, use implicit unit syntax and are displayed in default units.

A program can create a cell whose formula is displayed in default units by setting the cell's Formula property to a string in implicit unit syntax. For example, the formula "=8[pt,T]" is displayed as "8 pt" if the DefaultTextUnits property is visPoints and "0.6272" if the DefaultTextUnits property is visCiceros.

Alternatively, a program can use the following statement to set the cell's result to default text units:

VBA Copy code Copy code
vsoCell.Result(visTextUnits) = 12

In this case, the text is 12 points if the DefaultTextUnits property is visPoints and 12 ciceros if the DefaultTextUnits property is visCiceros.

For details about implicit units of measure, see About Units of Measure.


Application.DefaultZoomBehavior Property (Visio)

 Copy code hover
[image]

Application.DefaultZoomBehavior Property (Visio)
Send feedback

Published: July 16, 2012

Determines the zoom behavior for all new Microsoft Visio documents and drawing windows. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .DefaultZoomBehavior

expression A variable that represents an Application object.

Return Value

VisZoomBehavior

Remarks

To set zoom behavior for an existing document, or for a particular window, use the ZoomBehavior property of the document and window, respectively.

The following constants declared by the Visio type library in VisZoomBehavior are valid values for the DefaultZoomBehavior property.

Constant | Value | Description
visZoomNone | 0 | Undefined zoom behavior; use the zoom behavior of the document or application
visZoomInPlaceContainer | 1 | The container performs the zoom. This is the default.
visZoomVisio | 2 | Visio performs the zoom.
visZoomVisioExact | 4 | Visio zooms when open in place; Visio does not adjust the zoom level

Note Note

The default behavior (visZoomInPlaceContainer) is different from the behavior used in Microsoft Visio 2002, but is the same as that in earlier versions of Visio. To replicate the behavior seen in Microsoft Visio 2002, set this value to visZoomVisio.

If this value is set to the default, visZoomInPlaceContainer, Visio uses the container's IOleCommandTarget interface to perform the zoom and forces a fit-to-window zoom within the in-place window. If the container does not support IOleCommandTarget, no zooming occurs.


Application.DeferRecalc Property (Visio)

 Copy code hover
[image]

Application.DeferRecalc Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the application recalculates cell formulas during a series of actions. Read/write.

Version Information

Version Added: Visio 4.1

Syntax

expression .DeferRecalc

expression A variable that represents an Application object.

Return Value

Integer

Remarks

Use the DeferRecalc property to improve performance during a series of actions. For example, you can defer formula recalculation while changing the formulas or values of several cells. When the series of actions is complete, you must always set the DeferRecalc property back to the value it had before you changed it. See the following examples.

If you release objects or send a large number of commands to Visio while recalculation is deferred, Visio may at times need to process its queue of pending recalculations. Because of this, use care in setting formulas inside a scope where you want recalculation deferred. Ideally, you should only set formulas when recalculation is turned off.

For example, consider the following Microsoft Visual Basic for Applications (VBA) sequence:

VBA Copy code Copy code
Dim blsDeferCalcOriginalValue As Boolean
blsDeferCalcOriginalValue = Application.DeferRecalc
Application.DeferRecalc = True
vsoShape.Cells("height").ResultIU = 12
vsoShape.Cells("width").ResultIU = 14
Application.DeferRecalc = blsDeferCalcOriginalValue

Because VBA makes and releases a temporary Cell object in the preceding code, Visio will process its queue at that point.

In the following sequence, Visio will not process the recalculation queue until the application turns recalculation on again (or the user performs some operation).

VBA Copy code Copy code
Dim blsDeferCalcOriginalValue As Boolean
blsDeferCalcOriginalValue = Application.DeferRecalc
Application.DeferRecalc = True
Set vsoCell1 = vsoShape.Cells("Height")
Set vsoCell2 = vsoShape.Cells("Width")
vsoCell1.ResultIU = 12
vsoCell2.ResultIU = 14
Application.DeferRecalc = blsDeferCalcOriginalValue


Application.DeferRelationshipRecalc Property (Visio)

 Copy code hover
[image]

Application.DeferRelationshipRecalc Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio defers recalculating shape sizes and relationships when a member of the relationship pair is moved or resized. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .DeferRelationshipRecalc

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

For example, if you resize a shape that is a member of a container in a structured diagram, Visio will not adjust the size of the container if DeferRelationshipRecalc is True. When you set DeferRelationshipRecalc to False, Visio recalculates the container size and adjusts it accordingly. (In each case, the container's ResizeAsNeeded property must be set to visContainerAutoResizeExpandContract.)

Setting DeferRelationshipRecalc to False causes Visio to immediately process all deferred actions.


Application.DialogFont Property (Visio)

 Copy code hover
[image]

Application.DialogFont Property (Visio)
Send feedback

Published: July 16, 2012

Returns information about the fonts that Microsoft Visio uses in its dialog boxes. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .DialogFont

expression A variable that represents an Application object.

Return Value

IFontDisp

Remarks

You can use this property to display your dialog boxes in the same font as the Visio dialog boxes.

COM (Component Object Model) provides a standard implementation of a font object with the IFontDisp interface on top of the underlying system font support. The IFontDisp interface exposes a font object's properties and is implemented in the stdole type library as a StdFont object that can be created within Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic projects in Visio.

To get information about the StdFont object that supports the IFontDisp interface

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click stdole.

  4. Under Classes, examine the class named StdFont.

For details about the IFontDisp interface, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.

Example

The following sample code shows how to get a reference to a StdFont object that conveys information about the application fonts, and how to print that information to the Immediate window.

VBA Copy code Copy code

Sub DialogFont_Example()

Dim objStdFont As StdFont
Set objStdFont = Application.DialogFont

 With objStdFont

 Debug.Print .Bold
 Debug.Print .CharSet
 Debug.Print .Italic
 Debug.Print .Name
 Debug.Print .Size
 Debug.Print .Strikethrough
 Debug.Print .Underline
 Debug.Print .Weight

 End With

End Sub


Application.Documents Property (Visio)

 Copy code hover
[image]

Application.Documents Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Documents collection for a Microsoft Visio instance. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Documents

expression A variable that represents an Application object.

Return Value

Documents

Remarks

You can iterate through a Documents collection by using the Count property to retrieve the number of documents in the collection. You can use the Item property to retrieve individual elements from a collection.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.Documents


Application.DrawingPaths Property (Visio)

 Copy code hover
[image]

Application.DrawingPaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for drawings. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .DrawingPaths

expression A variable that represents an Application object.

Return Value

String

Remarks

The DrawingPaths property is set to an empty string ("") by default.

The string passed to and received from the DrawingPaths property is the same string shown in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\DrawingsPath subkey.

Visio looks for drawings in all paths named in the DrawingPaths property and all the subfolders of those paths. If you pass the DrawingPaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Setting the DrawingPaths property replaces existing values for DrawingPaths in the File Locations dialog box. To retain existing values, get the existing string and then append the new file path to that string, as shown in the following code:

VBA Copy code Copy code
Application.DrawingPaths = Application.DrawingPaths & ";" & "newpath".
Note Note

Modifying the registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).


Application.EventInfo Property (Visio)

 Copy code hover
[image]

Application.EventInfo Property (Visio)
Send feedback

Published: July 16, 2012

Gets additional information associated with an event, if any exists. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventInfo(eventSeqNum)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
eventSeqNum | Required | Long | visEvtIDMostRecent (0) for information about the most recently fired event, or the sequence number of the event to examine.

Return Value

String

Remarks

When Microsoft Visio fires an event, there are a small number of events for which additional information is available. These events are BeforeDocumentSaveAs, DocumentSavedAs, EnterScope, ExitScope, MarkerEvent, ShapesDeleted, and ShapeChanged. Use the application's EventInfo property to obtain this information, when available.

The EventInfo property returns the following:

  • A string whose contents are specific to the event in question, if the event does record extra information.

  • An empty string if an event does not record extra information.

  • An error if Visio no longer has information for the specified event.

For details about the contents of the EventInfo property for an event, see the specific event topic.

If an event target queries the EventInfo property immediately after being triggered, the most recent event and the event whose sequence number was passed to the target are the same. However, if the target is an add-on implemented by an executable (.exe) file, this may not be the case, because the executable file and Visio are separate tasks that aren't modal with respect to each other.

Note Note

Event handlers that use the Microsoft Visual Basic for Applications (VBA) WithEvents keyword have access to only the most recent event and must use visEvtIDMostRecent.

To ensure that the information returned by the EventInfo property is associated with the same event that triggered the add-on, the executable file can pass <sequence number> as an argument to the EventInfo property. You can obtain the sequence number of an event in the following ways:

  • If the Action property of the Event object returns visActCodeRunAddon, the command line string passed to the add-on contains a substring of the form "/eventid=<sequence number>".

    Note Note

    Even though the substring is labeled "/eventid," don't confuse the <sequence number> passed in the command line string with the ID property of the firing Event object, which identifies the Event object in its EventList collection. The number being passed is actually the firing sequence number.

  • If the Action property of the Event object returns visActCodeAdvise, the sequence number is passed as an argument to the VisEventProc procedure implemented by the target object.


Application.EventList Property (Visio)

 Copy code hover
[image]

Application.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents an Application object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Application.EventsEnabled Property (Visio)

 Copy code hover
[image]

Application.EventsEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a Microsoft Visio instance fires events. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .EventsEnabled

expression A variable that represents an Application object.

Return Value

Integer

Remarks

If the EventsEnabled property is False, Visio does not fire events, run add-ons, or execute strings that contain arbitrary Visual Basic for Applications (VBA) code when evaluating RUNADDON operands in cell formulas.

By default, the EventsEnabled property is True when an instance of Visio starts.

You may want to disable event firing if you have written code to handle events such as DocumentOpened or DocumentCreated that does not work properly, or to prevent the incorporation of a virus into a document. Events will not fire until the EventsEnabled property is set to True.

Example

These VBA macros show how to use the EventsEnabled property to suspend and resume event processing.

VBA Copy code Copy code

Public Sub SuspendEventProcessing_Example()

 'Suspend event processing.
 Application.EventsEnabled = False
 End Sub

Public Sub EventsEnabled_Example()

 'Resume event processing.
 Application.EventsEnabled = True

End Sub


Application.FullBuild Property (Visio)

 Copy code hover
[image]

Application.FullBuild Property (Visio)
Send feedback

Published: July 16, 2012

Returns the full build number of the running instance. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .FullBuild

expression A variable that represents an Application object.

Return Value

Long

Remarks

The format of the build number is described in the following table.

Bits | Description
0 - 15 | Internal build number
16 - 20 | Internal revision number
21 - 25 | Minor version number
26 - 30 | Major version number (Microsoft Visio 2013 = 15)
31 | Reserved

In addition, for Visio 2013, to obtain the correct full build number, it is necessary to add 1000 to the internal revision number part of the full build number returned by the FullBuild property, as shown in the following macro.

The build number of the running instance is written to the FullBuildNumberCreated property when a new document is created, and to the FullBuildNumberEdited property when a document is edited.

Example

The following Microsoft Visual Basic procedures show how to use the FullBuild property to get the full build number of the current instance of Visio. Once the full build number has been obtained, the ParseFullBuildProperty procedure parses the number and prints the results in the Immediate window.

VBA Copy code Copy code
Public Sub FullBuild_Example()

 Dim lngFullBuild as Long
 lngFullBuild = Application.FullBuild
 ParseFullBuildProperty (lngFullBuild)

End Sub
VBA Copy code Copy code
Public Sub ParseFullBuildProperty(ByRef lngFullBuild As Long)

 Dim lngMajor As Long
 Dim lngMinor As Long
 Dim lngRevision As Long
 Dim lngBuild As Long
 Dim lngNumber As Long

 lngNumber = lngFullBuild

 ' Low 16 bits:
 lngBuild = lngNumber Mod 65536
 lngNumber = lngNumber / 65536

 'Next 5 bits:
 lngRevision = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Next 5 bits:
 lngMinor = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Next 5 bits:
 lngMajor = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Remaining 1 bit unused and 0 as of Visio 2010
 Debug.Print "lngFullBuild (full version specification): " & lngMajor & "." _
 & lngMinor & "." & lngBuild & "." & lngRevision + 1000
 Debug.Assert(0 = lngNumber)

End Sub


Application.HelpPaths Property (Visio)

 Copy code hover
[image]

Application.HelpPaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for Help files. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .HelpPaths

expression A variable that represents an Application object.

Return Value

String

Remarks

The HelpPaths property is set to an empty string ("") by default.

The string passed to and received from the HelpPaths property is the same string shown in the File Paths dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\HelpPath subkey.

When the application looks for Help files, it looks in all paths named in the HelpPaths property and all the subfolders of those paths. If you pass the HelpPaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Setting the HelpPaths property replaces existing values for HelpPaths in the File Paths dialog box. To retain existing values, get the existing string and then append the new file path to that string, as shown in the following code:

VBA Copy code Copy code
Application.HelpPaths = Application.HelpPaths & ";" & "newpath".
Note Note

Modifying the registry in any manner, whether through the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get and set the HelpPaths property of the Application object. Before running this macro, replace fullpath(s) with the path or paths to the location or locations where you want Visio to look for Help files.

VBA Copy code Copy code

Public Sub GetHelpPaths_Example()

    Dim strCurrentPath As String

    'Retrieve the current path to Visio Help files.
    strCurrentPath = Application.HelpPaths
    MsgBox ("The current path for Microsoft Visio Help files is " + strCurrentPath)

End Sub

Public Sub SetHelpPaths_Example()

    Dim strNewPath As String

    'Store the new path.
    strNewPath = "fullpath(s)"

    'Set the new path in the Application object.
    Application.HelpPaths = strNewPath

End Sub


Application.InhibitSelectChange Property (Visio)

 Copy code hover
[image]

Application.InhibitSelectChange Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether shapes added to the drawing page by Automation are selected. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .InhibitSelectChange

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

Use the InhibitSelectChange property to control shape selection and increase performance when dropping a series of shapes in the drawing window programmatically. When the InhibitSelectChange property is True, Microsoft Visio does not select any shapes after they are dropped. Your solution, however, can select shapes.

Additionally, Visio attempts to preserve currently selected shapes whenever possible, unless shapes are deselected by the solution.

If a program neglects to turn the InhibitSelectChange property off (False) after turning it on, the Visio instance will turn it back off when the user performs an operation.


Application.InstanceHandle32 Property (Visio)

 Copy code hover
[image]

Application.InstanceHandle32 Property (Visio)
Send feedback

Published: July 16, 2012

Gets the instance handle of the Application object for a 32-bit version of Microsoft Visio. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .InstanceHandle32

expression A variable that represents an Application object.

Return Value

Long

Remarks

Calls to the InstanceHandle property are directed to the InstanceHandle32 property.


Application.InstanceHandle64 Property (Visio)

 Copy code hover
[image]

Application.InstanceHandle64 Property (Visio)
Send feedback

Published: July 16, 2012

Gets the instance handle of the Application object for a 64-bit version of Microsoft Visio. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .InstanceHandle64

expression An expression that returns an Application object.

Return Value

Int64


Application.IsInScope Property (Visio)

 Copy code hover
[image]

Application.IsInScope Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a call to an event handler is between an EnterScope event and an ExitScope event for a scope. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .IsInScope(nCmdID)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
nCmdID | Required | Long | The scope ID.

Return Value

Boolean

Remarks

Constants representing scope IDs are prefixed with visCmd and are declared by the Visio type library. You can also use an ID returned by the BeginUndoScope method.

You could use this property in a CellChanged event handler to determine whether a cell change was the result of a particular operation.

Example

This example shows how to use the IsInScope property to determine whether a call to a procedure that handles the CellChanged event is in a particular scope—that is, whether the call occurs between the EnterScope and ExitScope events for that scope.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application
Private lngScopeID As Long

Public Sub IsInScope_Example()

 Dim vsoShape As Visio.Shape

 'Set the module-level application variable to
 'trap application-level events.
 Set vsoApplication = Application

 'Begin a scope.
 lngScopeID = Application.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell (to trigger the CellChanged event).
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 Application.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering my scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting my scope " & nScopeID
 Else
 Debug.Print "ExitScope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


Application.IsUndoingOrRedoing Property (Visio)

 Copy code hover
[image]

Application.IsUndoingOrRedoing Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the current event handler is being called as a result of an Undo or Redo action in the application. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .IsUndoingOrRedoing

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

The IsUndoingOrRedoing property returns True when the application is firing events related to an Undo or Redo action that the user has initiated in the user interface, or that an Automation client has initiated by calling the Undo or Redo method of an Application object.

When the application calls an event handler, the event has a "cause." If that cause is a user action or another event handler, it is legitimate to perform undoable actions during the course of handling that event. However, if the cause of the event firing is an Undo or Redo action, the event handler should not perform undoable actions. Doing so eliminates the ability to redo an action.

You will typically only perform undoable actions inside an event handler when this property is False. You can perform undoable actions when the flag is True, but the redo queue is destroyed.

Example

This example adds a shape to a drawing and then checks whether the shape has been added as a result of an Undo or Redo action.

VBA Copy code Copy code

Public Sub IsUndoingOrRedoing_Example()

Dim vsoShape As Visio.Shape

 'Draw a shape to trigger the ShapeAdded event
 Set vsoShape = ActivePage.DrawRectangle(1,2,2,1)

End Sub
VBA Copy code Copy code

Sub Document_ShapeAdded(ByVal Shape As IVShape)

 If Not Application.IsUndoingOrRedoing Then

 Debug.Print "Shape was added by new action."

 End If

End Sub


Application.IsVisio32 Property (Visio)

 Copy code hover
[image]

Application.IsVisio32 Property (Visio)
Send feedback

Published: July 16, 2012

Returns True if the current instance of Microsoft Visio is 32-bit. Returns False if the current instance is 64-bit. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .IsVisio32

expression An expression that returns a Application object.

Return Value

Integer


Application.Language Property (Visio)

 Copy code hover
[image]

Application.Language Property (Visio)
Send feedback

Published: July 16, 2012

Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .Language

expression A variable that represents an Application object.

Return Value

Long

Remarks

The Language property returns the language ID recorded in the object's VERSIONINFO resource. The IDs returned are the standard IDs used by Microsoft Windows to encode different language versions. For example, the Language property returns &H0409 for the U.S. English version of Visio. For details, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Application.LanguageHelp Property (Visio)

 Copy code hover
[image]

Application.LanguageHelp Property (Visio)
Send feedback

Published: July 16, 2012

Represents the language ID of the Help in the version of the Microsoft Visio instance represented by the parent object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .LanguageHelp

expression A variable that represents an Application object.

Return Value

Long

Remarks

The LanguageHelp property returns the language ID of the Help recorded in the object's VERSIONINFO resource. The IDs returned are the standard IDs used by Microsoft Windows to encode different language versions. For example, the LanguageHelp property returns &H0409 for the U.S. English version of Visio. For details, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN.


Application.LanguageSettings Property (Visio)

 Copy code hover
[image]

Application.LanguageSettings Property (Visio)
Send feedback

Published: July 16, 2012

Returns a reference to the Microsoft Office (MSO) LanguageSettings interface. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .LanguageSettings

expression A variable that represents an Application object.

Return Value

Object

Remarks

After you use the LanguageSettings property to get a reference to the MSO LanguageSettings interface, you can use methods of that interface to get the locale identifier (LCID) for the language used when Office was installed, the user interface (UI) language, and the language for Help, as well as the current setting for the preferred language for editing in the UI, as shown in the following example.

However, you cannot use the LanguageSettings interface to change language settings: you can change language settings only in the Microsoft Office Language Settings 2007 dialog box. (Click Start, point to All Programs, point to Microsoft Office, point to Microsoft Office Tools, and then click Microsoft Office 2007 Language Settings.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the LanguageSettings property to get an MSO LanguageSettings interface, and then to use two of its methods to get the ID of the language set for the UI, and to test whether US English is set as the preferred language for editing.

VBA Copy code Copy code
Public Sub LanguageSettings_Example()

    Dim msoLanguageSettings As LanguageSettings

    Set msoLanguageSettings = Application.LanguageSettings
    Debug.Print msoLanguageSettings.LanguageID(msoLanguageIDUI)
    Debug.Print msoLanguageSettings.LanguagePreferredForEditing(msoLanguageIDEnglishUS)

End Sub


Application.LiveDynamics Property (Visio)

 Copy code hover
[image]

Application.LiveDynamics Property (Visio)
Send feedback

Published: July 16, 2012

Controls whether Microsoft Visio recalculates shape properties during drag operations on every mouse move or only after the mouse button is released. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .LiveDynamics

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

The LiveDynamics property tracks actions, such as resizing and rotating shapes, and is effective when shapes are glued or related to each other. When the value of the LiveDynamics property is True, more events such as CellChanged occur. Solutions that respond to such events may operate more quickly if the LiveDynamics property is set to False.


Application.MyShapesPath Property (Visio)

 Copy code hover
[image]

Application.MyShapesPath Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets where Microsoft Visio looks for the My Shapes folder on the user's hard disk. Read/write.

Version Information

Version Added: Visio 2007

Syntax

expression .MyShapesPath

expression An expression that returns an Application object.

Return Value

String

Remarks

The setting of the MyShapesPath property corresponds to the value of the My Shapes text box in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.)


Application.Name Property (Visio)

 Copy code hover
[image]

Application.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents an Application object.

Return Value

String

Remarks

You can get, but not set, the Name property of a Document object. If a document is not yet named, this property returns the document's temporary name, such as Drawing1 or Stencil1.

You can get, but not set, the Name property of an Addon object or a Font object.

You can get, but not set, the Name property of a Cell object. Some cells are in named rows; you can get and set the name of a named row by using the RowName property.

You can set the Name property of a Style object that represents a style that is not a default Microsoft Office Visio style. If you attempt to set the Name property of a default Visio style, an error is generated.

A cell has both a local name and a universal name. The local name differs depending on the locale for which the running version of Microsoft Windows is installed. The universal name is the same regardless of what locale is installed. To get the universal name of a cell, use the Name property. To get the local name, use the LocalName property.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Name property to display layer names. It also uses the Layer property to get a reference to a particular layer and the LayerCount property to determine the number of layers to which a shape is assigned.

VBA Copy code Copy code

Public Sub Name_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoLayers As Visio.Layers
 Dim vsoLayer As Visio.Layer

 If ActiveDocument Is Nothing Then
 Documents.Add ("")
 End If

 Set vsoPage = ActivePage
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Get the Layers collection.
 Set vsoLayers = vsoPage.Layers

 'Create a layer named ExampleLayer1 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer1")
 vsoLayer.Add vsoShape, 1

 'Create a layer named ExampleLayer2 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer2")
 vsoLayer.Add vsoShape, 1

 'Verify that the shape has been assigned to 2 layers.
 Debug.Print "The page has " & vsoShape.LayerCount & " layers."

 'Get a reference to the first layer.
 Set vsoLayer = vsoShape.Layer(1)

 'Verify by using the Name property.
 Debug.Print "Current vsoLayer name is """ & vsoLayer.Name & "."""

End Sub


Application.ObjectType Property (Visio)

 Copy code hover
[image]

Application.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents an Application object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Application.OnDataChangeDelay Property (Visio)

 Copy code hover
[image]

Application.OnDataChangeDelay Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets how long the Microsoft Visio instance waits before advising a container application that a Visio document being shown by the container has changed and should be redisplayed. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .OnDataChangeDelay

expression An expression that returns a Application object.

Return Value

Long

Remarks

The OnDataChangeDelay property affects only instances of Visio that are run from within an OLE container document.

  • Setting the value of the OnDataChangeDelay property to zero (0) causes Visio to send immediate advises to the container as data changes in open Visio documents.

  • Setting the value of the OnDataChangeDelay property to -1 causes Visio to use the interval specified in the OLEUpdateDelay entry in the registry. If the registry doesn't contain this setting, Visio defaults to using a value of 10,000 (milliseconds).

  • Setting the OnDataChangeDelay property to any value other than -1 or 0 overrides the registry setting and sets the delay between advises to the value of OnDataChangeDelay. If the OnDataChangeDelay property is not set or set to 1 and the OLEUpdateDelay setting is 0, Visio never sends advises to the container.

Note Note

If you experience decreased performance when you add or move shapes that are contained in a Visio drawing that is hosted in the Visio Drawing Control, you can install a hot fix and then use the OnDataChangeDelay property to overcome this problem. For more information, see the Microsoft Knowledge Base article 839079.


Application.Path Property (Visio)

 Copy code hover
[image]

Application.Path Property (Visio)
Send feedback

Published: July 16, 2012

Returns the drive and folder path of the Microsoft Visio application. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Path

expression A variable that represents an Application object.

Return Value

String


Application.PersistsEvents Property (Visio)

 Copy code hover
[image]

Application.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents an Application object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Application.ProcessID Property (Visio)

 Copy code hover
[image]

Application.ProcessID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the unique identity of the current Microsoft Visio process. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ProcessID

expression A variable that represents an Application object.

Return Value

Long

Remarks

The ProcessID property returns a value unique to the indicated instance. The application doesn't reuse the value until 4294967296 (2^32) more threads have been created on the current workstation.

Important note Important

The value returned by ProcessID is not the same as the Windows Process ID of the current Visio instance.

Example

This Microsoft Visual Basic for Applications (VBA) program shows how to use the ProcessID property to determine the unique identity of the current Microsoft Visio process.

VBA Copy code Copy code
Sub ProcessID_Example ()

    Dim vsoApplication As Visio.Application

    'Get the current instance of Microsoft Office Visio.
    Set vsoApplication = Visio.Application

    'Prints the unique ID of the current Visio process.
    Debug.Print "Visio Process identifier: "; vsoApplication.ProcessID

End Sub


Application.PromptForSummary Property (Visio)

 Copy code hover
[image]

Application.PromptForSummary Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio prompts for document properties when it saves a document. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .PromptForSummary

expression A variable that represents an Application object.

Return Value

Integer

Remarks

This property corresponds to the Prompt for document properties on first save check box on the Save tab in the Visio Options dialog box (click the File tab, and then click Options).

Example

This Microsoft Visual Basic for Applications (VBA) macro switches the PromptForSummary property of the Visio Application object.

VBA Copy code Copy code

Public Sub PromptForSummary_Example()

    Application.PromptForSummary = Not Application.PromptForSummary

End Sub


Application.SaveAsWebObject Property (Visio)

 Copy code hover
[image]

Application.SaveAsWebObject Property (Visio)
Send feedback

Published: July 16, 2012

Returns a reference to the IDispatch interface of a VisSaveAsWeb object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .SaveAsWebObject

expression A variable that represents an Application object.

Return Value

Object

Remarks

Once you have a reference to the VisSaveAsWeb object, you can use the objects, methods, and properties of the Save as Web Page API to publish Microsoft Visio documents to the Web. For more information about the Save as Web Page API, search for "Save as Web Page API" on MSDN.

To be able to work with the Save as Web Page API, you must get a reference to the Microsoft Visio 14.0 Save As Web Type Library in your Microsoft Visual Basic or Microsoft Visual Basic for Applications (VBA) project. To get this reference in VBA, use the following procedure:

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the Tools menu, click References.

  3. In the Available References list, select Microsoft Visio 14.0 Save As Web Type Library and click OK.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.SaveAsWebObject

Example

This VBA macro shows how to use the SaveAsWebObject property to get a VisSaveAsWeb object. It also shows how to get a VisWebPageSettings object, configure Web-page settings, and create a Web page to display the active Visio document. The macro gets a Visio Application object and passes it to the SaveAsWeb procedure, which gets the VisSaveAsWeb object, configures the settings, and creates the Web page.

Before running this macro, get a reference to the Microsoft Visio 14.0 Save As Web Type Library as described above, and replace path\filename in the code with the full path to and name of the .htm file you want to create on your computer to display the Web page.

VBA Copy code Copy code

Public Sub SaveAsWebObject_Example

    Dim vsoApplication as Visio.Application
    Call SaveAsWeb(vsoApplication)

End Sub

Public Sub SaveAsWeb (vsoApplication as Visio.Application)

    Dim objSaveAsWeb As IVisSaveAsWeb
    Dim objWebPageSettings As IVisWebPageSettings

    ' Get a VisSaveAsWeb object that
    ' represents a new Web page project
    Set objSaveAsWeb = Application.SaveAsWebObject

    ' Get a VisWebPageSettings object
    Set objWebPageSettings = objSaveAsWeb.WebPageSettings

    ' Configure Web-page settings
    objWebPageSettings.StartPage = 1
    objWebPageSettings.EndPage = 2
    objWebPageSettings.LongFileNames = True
    objWebPageSettings.TargetPath = "path\filename"

    ' Now create the pages; because we did not identify
    ' a particular document, the active document is saved
    objSaveAsWeb.CreatePages

End Sub


Application.ScreenUpdating Property (Visio)

 Copy code hover
[image]

Application.ScreenUpdating Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the screen is updated (redrawn) during a series of actions. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .ScreenUpdating

expression A variable that represents an Application object.

Return Value

Integer

Remarks

Use the ScreenUpdating property to increase performance during a series of actions. For example, you can turn off screen updating while a series of shapes are created so that the screen is not redrawn after each shape appears. Then you can turn screen updating on to update the screen.

If you send a large number of commands to a Microsoft Visio instance while screen updating is turned off, the Visio instance may redisplay the screen occasionally to flush its buffers.

If a program neglects to turn screen updating on after turning it off, the Visio instance turns screen updating back on when a user performs an operation.

Note Note

The ShowChanges and ScreenUpdating properties are similar in that they are both designed to increase performance during a series of actions, but they work differently. Setting the ShowChanges property also sets the ScreenUpdating property, but setting the ScreenUpdating property does not set the ShowChanges property. For a comparison of these two properties, see the ShowChanges property.

Example

This Microsoft Visual Basic code snippet shows how to use the ScreenUpdating property.

VBA Copy code Copy code
'Turn off screen updating to improve performance during
'the series of actions that follow.
 Visio.Application.ScreenUpdating = False

'Drop several shapes.
'Set the shapes' text.
'Connect the shapes.
'Format the connectors.

'Turn screen updating on again when the actions are complete.
Visio.Application.ScreenUpdating = True


Application.Settings Property (Visio)

 Copy code hover
[image]

Application.Settings Property (Visio)
Send feedback

Published: July 16, 2012

Returns an ApplicationSettings object, which you can use to set Microsoft Visio application properties. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Settings

expression A variable that represents an Application object.

Return Value

ApplicationSettings

Remarks

Use the Settings property of the Application object to get an ApplicationSettings object that you can then use to set various application properties corresponding to those in the Options dialog box (click the File tab, and then click Options) and the Snap & Glue dialog box (on the View tab, click the Visual Aids arrow).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Settings property to get an ApplicationSettings object. It also shows how to use the RecentFilesListSize property to get the number of entries in the list of recently used files in Visio.

VBA Copy code Copy code
Public Sub Settings_Example()

    Dim vsoApplicationSettings As Visio.ApplicationSettings
    Dim lngListSize As Long

    Set vsoApplicationSettings = Visio.Application.Settings
    lngListSize = vsoApplicationSettings.RecentFilesListSize

    Debug.Print lngListSize

End Sub


Application.ShowChanges Property (Visio)

 Copy code hover
[image]

Application.ShowChanges Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the screen is updated (redrawn) during a series of actions. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .ShowChanges

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

Use the ShowChanges property to increase performance during a series of actions. For example, you can set the ShowChanges property to False while a series of shapes are created so that the screen is not redrawn after each shape appears. Then you can set it to True to update the screen.

If a program neglects to turn the ShowChanges property on after turning it off, the Microsoft Visio instance will turn it back on when the user performs an operation.

The ShowChanges property is similar to the ScreenUpdating property, which was implemented in Visio 3.0. In most cases using the ShowChanges property is preferable to using the ScreenUpdating property. Setting the ShowChanges property automatically sets the ScreenUpdating property; however, setting the ScreenUpdating property does not set the ShowChanges property.

  • When ShowChanges is False, the Visio instance will not refresh the screen (repaint drawing windows) as documents change or when they become obscured by other windows. All shapes in drawing and stencil windows are deselected and the Visio instance will not allow programs to change the selections of windows.

  • When only ScreenUpdating is False, the Visio instance will occasionally refresh the screen as documents change. ScreenUpdating does not cause deselects to occur or restrict selection changes.

The Visio instance will usually run faster when both the ShowChanges and ScreenUpdating properties are False than when only the ScreenUpdating property is False. When both the ShowChanges and ScreenUpdating properties are False, the Visio views will not react to document changes until the ShowChanges property becomes True. This can cause noticeable delays after a program has completed a sequence of many operations. To cause some changes to occur as they happen, set ScreenUpdating to True immediately after setting ShowChanges to False. This can shorten the delay that occurs after ShowChanges becomes True, but will probably lengthen the time to complete the overall sequence of actions.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.ShowChanges


Application.ShowProgress Property (Visio)

 Copy code hover
[image]

Application.ShowProgress Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a progress indicator is shown while performing certain operations. Read/write.

Version Information

Version Added: Visio 4.1

Syntax

expression .ShowProgress

expression A variable that represents an Application object.

Return Value

Integer

Remarks

If you want to perform an operation, such as printing, that typically displays a progress indicator but you don't want the progress indicator to appear, set the ShowProgress property to False (0). By default, the ShowProgress property is True (non-zero).

In most cases you should restore the setting to its prior value when you've completed the operation.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ShowProgress property of the Application object. It switches the display of the progress indicator on and off and displays the state of the property in the Immediate window.

VBA Copy code Copy code

Sub ShowProgress_Example()

 'Create a variable to hold the current state
 'of the progress indicator.
 Dim intProgress As Integer

 'Display the current state of the progress indicator.
 Debug.Print "Initial state: " & Application.ShowProgress

 'Get the state of the progress indicator.
 intProgress = Application.ShowProgress

 'Turn off the progress indicator.
 Application.ShowProgress = False

 'Display the status again.
 Debug.Print "Changed state: " & Application.ShowProgress

 'Now restore the progress indicator to its original state.
 Application.ShowProgress = intProgress

 'Display the status again.
 Debug.Print "Restored state: " & Application.ShowProgress

End Sub


Application.ShowStatusBar Property (Visio)

 Copy code hover
[image]

Application.ShowStatusBar Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the status bar is shown. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .ShowStatusBar

expression A variable that represents an Application object.

Return Value

Integer

Remarks

The ShowStatusBar property persists each time you run the application. The ShowToolbar property is valid for a Microsoft Visio instance only.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to hide and show the status bar.

VBA Copy code Copy code
Public Sub ShowStatusBar_Example()

 'Switch the status bar on or off.
 Application.ShowStatusBar = Not Application.ShowStatusBar

End Sub


Application.ShowToolbar Property (Visio)

 Copy code hover
[image]

Application.ShowToolbar Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether toolbars and menu bars are visible. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .ShowToolbar

expression A variable that represents an Application object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The ShowToolbar property is valid for a Microsoft Visio instance only. The ShowStatusBar property persists each time you run Visio.


Application.StartupPaths Property (Visio)

 Copy code hover
[image]

Application.StartupPaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for third-party and user add-ons to run when the application is started. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .StartupPaths

expression A variable that represents an Application object.

Return Value

String

Remarks

The StartupPaths property is set to an empty string ("") by default.

The string passed to and received from the StartupPaths property is the same string shown in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\StartupPath subkey.

When the application looks for third-party and user startup add-on files, it looks in all paths named in the StartupPaths property, as well as at the paths of any startup add-ons installed at setup, and all the subfolders of those paths. If you pass the StartupPaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Setting the StartupPaths property replaces existing values for StartupPaths in the File Locations dialog box. To retain existing values, get the existing string and then append the new file path to that string, as shown in the following code:

VBA Copy code Copy code
Application.StartupPaths = Application.StartupPaths & ";" & "newpath".
Caution note Caution

Modifying the Microsoft Windows registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the StartupPaths property to add a path to the Start-up paths list.

VBA Copy code Copy code
Public Sub StartupPaths_Example()

    Dim strMessage As String
    Dim strNewPath As String
    Dim strStartupPath As String
    Dim strTitle As String

    'Get the path we want to add.
    strStartupPath = Application.StartupPaths
    strTitle = "StartupPaths"
    strMessage = "The current content of the Visio Start-up paths box is:"
    strMessage = strMessage & vbCrLf & strStartupPath
    MsgBox strMessage, vbInformation + vbOKOnly, strTitle
    strMessage = "Type in an additional path for Visio to look for add-ons. "

    strNewPath = InputBox$(strMessage, strTitle)

    'Make sure the folder exists and that it's not
    'already in the Start-up paths box.
    strMessage = ""

    If strNewPath = ""  Then
        strMessage = "You did not enter a path."
    ElseIf InStr(strStartupPath, strNewPath)  Then
        strMessage = "The path you specified is already in the Start-up paths box."
    ElseIf Len(Dir$(strNewPath, vbDirectory)) = 0 And _
                Len(Dir$(Application.Path & strNewPath, _
                vbDirectory)) = 0 Then
        strMessage = "The folder you typed does not exist (or is empty)."
    Else
        Application.StartupPaths = strStartupPath & ";" & strNewPath
        strMessage = "We just added " & strNewPath & _
                " to the startup paths."
    End If

    If strMessage <> ""  Then
        MsgBox strMessage, vbExclamation + vbOKOnly, strTitle
    End If

End Sub


Application.Stat Property (Visio)

 Copy code hover
[image]

Application.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents an Application object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Application.StencilPaths Property (Visio)

 Copy code hover
[image]

Application.StencilPaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for stencils. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .StencilPaths

expression A variable that represents an Application object.

Return Value

String

Remarks

The StencilPaths property is set to an empty string ("") by default.

The string passed to and received from the StencilPaths property is the same string shown in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\StencilPath subkey.

When Visio looks for stencils, it looks in all paths named in the StencilPaths property and all the subfolders of those paths. If you pass the StencilPaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Setting the StencilPaths property replaces existing values for Stencils in the File Locations dialog box. To retain existing values, get the existing string and then append the new file path to that string, as shown in the following code:

VBA Copy code Copy code
Application.StencilPaths = Application.StencilPaths & ";" & "newpath".
Caution note Caution

Modifying the registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to us the StencilPaths property to add a path to the stencils.

VBA Copy code Copy code

Public Sub ShowStencilPaths_Example()

    Dim strMessage As String
    Dim strNewPath As String
    Dim strStencilPath As String
    Dim strTitle As String

    'Get the path we want to add.
    strStencilPath = Application.StencilPaths
    strTitle = "StencilPaths"
    strMessage = "The current content of the Visio Stencils box is:"
    strMessage = strMessage & vbCrLf & strStencilPath
    MsgBox strMessage, vbInformation + vbOKOnly, strTitle
    strMessage = "Type in an additional path for Visio to look for stencils. "
    strNewPath = InputBox$(strMessage, strTitle)

    'Make sure the folder exists and that it's not
    'already in the stencil paths.
    strMessage = ""
    If strNewPath = ""  Then
        strMessage = "You did not enter a path."
        ElseIf InStr(strStencilPath, strNewPath)  Then
            strMessage = "The path you specified is already in the stencil paths."
        ElseIf Len(Dir$(strNewPath, vbDirectory)) = 0 And _
                Len(Dir$(Application.Path & strNewPath, _
                vbDirectory)) = 0 Then
            strMessage = "The folder you typed does not exist (or is blank)."
        Else
            Application.StencilPaths = strStencilPath & ";" & strNewPath
            strMessage = "We just added " & strNewPath & _
                " to the stencil paths."
        End If

    If strMessage <> ""  Then
        MsgBox strMessage, vbExclamation + vbOKOnly, strTitle
    End If

End Sub


Application.TemplatePaths Property (Visio)

 Copy code hover
[image]

Application.TemplatePaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for templates. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TemplatePaths

expression A variable that represents an Application object.

Return Value

String

Remarks

The TemplatePaths property is set to an empty string ("") by default.

The string passed to and received from the TemplatePaths property is the same string shown in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\TemplatePath subkey.

When Visio looks for templates, it looks in all paths named in the TemplatePaths property and all the subfolders of those paths. If you pass the TemplatePaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Setting the TemplatePaths property replaces existing values for Templates in the File Locations dialog box. To retain existing values, get the existing string and then append the new file path to that string, as shown in the following code:

VBA Copy code Copy code
Application.TemplatePaths = Application.TemplatePaths & ";" & "newpath".
Caution note Caution

Modifying the registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the TemplatePaths property to add a path to the Templates paths box.

VBA Copy code Copy code

Public Sub TemplatePaths_Example()

    Dim strMessage As String
    Dim strNewPath As String
    Dim strTemplatePath As String
    Dim strTitle As String

    'Get the path we want to add.
    strTemplatePath = Application.TemplatePaths
    strTitle = "TemplatePaths"
    strMessage = "The current content of the Visio Templates path box is:"
    strMessage = strMessage & vbCrLf & strTemplatePath
    MsgBox strMessage, vbInformation + vbOKOnly, strTitle
    strMessage = "Type in an additional path for Visio to look for templates. "
    strNewPath = InputBox$(strMessage, strTitle)

    'Make sure the folder exists and that it's not
    'already in the Templates path box.
    strMessage = ""
    If strNewPath = ""  Then
        strMessage = "You did not enter a path."
        ElseIf InStr(strTemplatePath, strNewPath)  Then
            strMessage = "The path you specified is already in the Templates path box."
        ElseIf Len(Dir$(strNewPath, vbDirectory)) = 0 And _
                Len(Dir$(Application.Path & strNewPath, _
                vbDirectory)) = 0 Then
            strMessage = "The folder you typed does not exist (or is blank)."
        Else
            Application.TemplatePaths = strTemplatePath & ";" & strNewPath
            strMessage = "We just added " & strNewPath & _
                " to the Templates path box."
    End If

    If strMessage <> ""  Then
        MsgBox strMessage, vbExclamation + vbOKOnly, strTitle
    End If

End Sub


Application.TraceFlags Property (Visio)

 Copy code hover
[image]

Application.TraceFlags Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets events logged during a Microsoft Visio instance. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .TraceFlags

expression A variable that represents an Application object.

Return Value

Long

Remarks

The value of the TraceFlags property can be a combination of the following values.

Constant | Value | Description
visTraceEvents | &H1 | Event occurrences
visTraceAdvises | &H2 | Outgoing advise calls
visTraceAddonInvokes | &H4 | Add-on invocations
visTraceCallsToVBA | &H8 | VBA invocations

Setting the visTraceEvents flag causes Visio to log most events as they happen and display them in the Immediate window. In most cases this occurs even if no external agent is listening or responding to the event. In a few cases, Visio knows there is no listener for an event and does not log those events. Visio also does not log idle events or advises. In addition, some events are specializations of other events and aren't recorded. For example, the SelectionAdded event is manufactured from distinct ShapeAdded events, so the Immediate window records the ShapeAdded events but not the SelectionAdded events.

Here is a string Visio might log when visTraceEvents is set:

VBA Copy code Copy code
-event: 0x8040 /doc=1 /page=1 /shape=Sheet.1

The number after -event: is the code of the event that occurred. In this case 0x8040 is the code for the ShapeAdded event. The text following the event code differs from event to event.

Setting the visTraceAdvises flag writes a line to the Immediate window just before Visio calls an event handler procedure and another line just after the event handler returns. This includes event procedures in Microsoft Visual Basic for Applications (VBA) projects, for example, procedures in ThisDocument. Here is an example of what you might see:

VBA Copy code Copy code
>advise seq=4 event=0x8040 sink=0x40097598
<advise seq=4

These strings indicate the call to and return from an event handler. The sequence number also indicates this event was the fourth one fired by Visio. The code of the event is 0x8040 and the address of the interface Visio called is 0x40097598.

Setting the visTraceAddonInvokes flag records when Visio invokes an EXE or VSL add-on, and when Visio regains control. Here is an example:

VBA Copy code Copy code
>invokeAO: SHOWARGS.EXE
<invokeAO: completed

Setting the visTraceAddonInvokes flag also traces attempts to invoke add-ons that are not present. For example, if a cell's formula is =RunAddon("xxx") and there is no add-on named "xxx", the message "InvokeAO: Failed to map 'xxx' to known Add-on" is logged.

Setting the visTraceCallToVBA flag writes a line to the Immediate window just before it makes a call to VBA other than a call to an event procedure (use visTraceAdvises to log calls to VBA event procedures) and another line just after VBA returns control to Visio. This flag traces macro invocations, calls to VBA procedures resulting from evaluation of cells that make use of RunAddon or CallThis operands, and calls resulting from selection of custom menu or toolbar items. Here is an example:

VBA Copy code Copy code
>invokeVBA: Module1.MyMacro
<invokeVBA: completed

A message doesn't appear in the Immediate window unless a document that has a VBA project is open. Visio queues a small number of messages to log when such a document opens. However, messages are lost if no document with a project is available for lengthy periods. Messages are also lost if VBA resets or if there are undismissed breakpoints.

Code in VBA projects can intersperse its messages with those logged by Visio by using standard Debug.Print statements. Code in non-VBA projects can log messages to the Immediate window by using Document.VBProject.ExecuteLine("Debug.Print ""somestring""").

The TraceFlags property is recorded in the TraceFlags entry of the Application section of the registry.

Example

This VBA macro shows how to use the TraceFlags property to log events, advises, add-on invocations, and Visual Basic invocations in the Immediate window.

VBA Copy code Copy code

Public Sub TraceFlags_Example()

 Application.TraceFlags = visTraceEvents + visTraceAdvises + _
 visTraceAddonInvokes + visTraceCallsToVBA

End Sub


Application.TypelibMajorVersion Property (Visio)

 Copy code hover
[image]

Application.TypelibMajorVersion Property (Visio)
Send feedback

Published: July 16, 2012

Returns the major version number of the Microsoft Visio type library. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .TypelibMajorVersion

expression A variable that represents an Application object.

Return Value

Integer

Remarks

The major and/or minor version number of the Visio type library will increase whenever the Visio type library is extended. A program can use the TypelibMajorVersion and TypelibMinorVersion properties to guarantee that the Visio version it is working with provides support for the features it is using.

Small changes to the Visio type library do not affect the Application object's Version property.


Application.TypelibMinorVersion Property (Visio)

 Copy code hover
[image]

Application.TypelibMinorVersion Property (Visio)
Send feedback

Published: July 16, 2012

Returns the minor version number of the Microsoft Visio type library. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .TypelibMinorVersion

expression A variable that represents an Application object.

Return Value

Integer

Remarks

The major and/or minor version number of the Visio type library will increase whenever the Visio type library is extended. A program can use the TypelibMajorVersion and TypelibMinorVersion properties to guarantee that the Visio version it is working with provides support for the features it is using.

Small changes to the Visio type library do not affect the Application object's Version property.


Application.UndoEnabled Property (Visio)

 Copy code hover
[image]

Application.UndoEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether undo information is maintained in memory. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .UndoEnabled

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

When Microsoft Visio starts, the value of the UndoEnabled property is True. Setting the value of the UndoEnabled property to False discontinues the collection of undo information in memory and clears the existing undo information.

You should attempt to maintain the property at its current value across the complete operation that you perform. In other words, use code structured like this:

VBA Copy code Copy code
blsPrevious = Application.UndoEnabled
Application.UndoEnabled = False

'Large operation here
Application.UndoEnabled = blsPrevious

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the UndoEnabled method to disable and then re-enable undo behavior in Visio.

VBA Copy code Copy code
Public Sub UndoEnabled_Example()

 'Disable undo
 Application.UndoEnabled = False

 'Draw three shapes.
 ActivePage.DrawRectangle 1, 2, 2, 1
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Enable undo.
 Application.UndoEnabled = True

End Sub


Application.UserName Property (Visio)

 Copy code hover
[image]

Application.UserName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the user name of an Application object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .UserName

expression A variable that represents an Application object.

Return Value

String

Remarks

Setting the UserName property is equivalent to entering a name in the Name box on the General tab in the Visio Options dialog box (click the File tab, and then click Options).


Application.VBAEnabled Property (Visio)

 Copy code hover
[image]

Application.VBAEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Specifies whether Microsoft Visual Basic for Applications (VBA) is enabled in the application. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .VBAEnabled

expression A variable that represents an Application object.

Return Value

Boolean

Remarks

If a document that contains a VBA project is opened with VBA enabled, and then VBA becomes disabled while the document is open:

  • Microsoft Visio no longer executes macros in that document, but the macro names still appear in the Macros dialog box (press Alt+F8).

  • Visio continues firing events to the project.

If a document that contains a VBA project is opened with VBA disabled, and then VBA becomes enabled while the document is open:

  • Visio does not fire events to the project, even though VBA has become enabled.

  • Macros remain disabled.

The VBAEnabled property is set to True if the Trust access to the VBA project object model check box is selected under Developer Macro Settings on the Macro Settings page of the Trust Center (click the File tab, click Options, click Trust Center, and then click Trust Center Settings). If it is not selected, the property reports False.

Example

You may have a document that requires VBA to be enabled to run properly, for example, code in a document's DocumentOpened event handler. The following code can be run from an add-on to verify whether VBA is enabled in the application before a document that depends on VBA is opened.

Before running this procedure, supply a valid document file name for the variable filename.

VBA Copy code Copy code
Public Sub VBAEnabled_Example()

    Dim vsoDocument As Visio.Document
    Dim blsStatus As Boolean

    blsStatus = Application.VBAEnabled
    If Not blsStatus Then

        MsgBox "For this process to continue, VBA must be enabled." & _
        " Please enable VBA and start over."

    Else

        Set vsoDocument = Documents.Open("filename")

    End if

End Sub


Application.Vbe Property (Visio)

 Copy code hover
[image]

Application.Vbe Property (Visio)
Send feedback

Published: July 16, 2012

Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Visio documents. Read-only.

Version Information

Version Added: Visio 4.5

Syntax

expression .Vbe

expression A variable that represents an Application object.

Return Value

Object

Remarks

To get information about the object returned by the Vbe property, follow these steps:

To get information about the object returned by the Vbe property

  1. In the Code group on the Developer tab, click Visual Basic.

  2. In the Visual Basic Editor, on the Tools menu, click References.

  3. In the References dialog box, click Microsoft Visual Basic for Applications Extensibility 5.3, and then click OK.

  4. On the View menu, click Object Browser.

  5. In the Project/Library list, select the VBIDE type library.

  6. In the Classes list, examine the class named VBE.

Beginning with Visio 2002, the Vbe property raises an exception if you are running in a security-enhanced environment and your system administrator has blocked access to the VBA object model. There is no user interface or programmatic way to turn this on—the system administrator must turn on (or off) access by setting a Group Policy. This helps protect against viruses that spread by accessing the Visual Basic projects in commonly used templates and injecting the virus code into them.

Example

This VBA macro shows how to use the Vbe property to determine how many VBA projects are open in an instance of Visio.

Before running this code, make sure the Trust access to the VBA project object model check box is selected under Developer Macro Settings on the Macro Settings page of the Trust Center dialog box (click the File tab, click Options, click Trust Center, and then click Trust Center Settings).

VBA Copy code Copy code

Public Sub Vbe_Example()

     Dim vbideVBE As VBIDE.VBE

     Set vbideVBE = Visio.Application.Vbe
     Debug.Print vbideVBE.VBProjects.Count

End Sub


Application.Version Property (Visio)

 Copy code hover
[image]

Application.Version Property (Visio)
Send feedback

Published: July 16, 2012

Returns the version of a running Microsoft Visio instance. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Version

expression A variable that represents an Application object.

Return Value

String

Remarks

Use the Version property of the Application object to verify the version of a particular Visio instance. This information is helpful if your program requires a particular version. Both the major and minor version numbers are returned. The string returned by Microsoft Visio 2013 is 15.0.

Example

This Microsoft Visual Basic for Applications (VBA) program shows how to print the version of a Visio instance in the Immediate window.

VBA Copy code Copy code

Public Sub Version_Example()

 Dim vsoApplication As Visio.Application
 Dim strVersion As String
 Dim intDotPosition As Integer
 Set vsoApplication = CreateObject("Visio.Application")

 strVersion = vsoApplication.Version
 intDotPosition = InStr(strVersion, ".")

 Debug.Print " Major Version : "; Left(strVersion, intDotPosition - 1)
 Debug.Print " Minor Version : "; Right(strVersion, Len(strVersion) - intDotPosition)

End Sub


Application.Visible Property (Visio)

 Copy code hover
[image]

Application.Visible Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is visible. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Visible

expression A variable that represents an Application object.

Return Value

Boolean


Application.Window Property (Visio)

 Copy code hover
[image]

Application.Window Property (Visio)
Send feedback

Published: July 16, 2012

Returns the window associated with the current instance of Microsoft Visio. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Window

expression A variable that represents an Application object.

Return Value

Window

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.Window

Example

The following macro shows how to use the Window property to print the caption of the window associated with the current instance of Visio in the Immediate window.

VBA Copy code Copy code

Public Sub Window_Example()

    Debug.Print  Application.Window.Caption

End Sub


Application.WindowHandle32 Property (Visio)

 Copy code hover
[image]

Application.WindowHandle32 Property (Visio)
Send feedback

Published: July 16, 2012

Returns the 32-bit handle of a Microsoft Visio window. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .WindowHandle32

expression A variable that represents an Application object.

Return Value

Long

Remarks

The WindowHandle32 property of an Application object returns one of the following:

  • The HWND for the main Visio (frame) window (most common).

  • The HWND for the container application's main frame window if Visio is running in-place and active.

  • The HWND for the window returned by the GetActiveWindow() function if either frame window is disabled (for example, if a modal dialog box is running). For details about the GetActiveWindow function, see the Microsoft Platform SDK on the Microsoft Developer Network (MSDN) Web site.

Use the WindowHandle32 property of the Window object to obtain the HWND for a window in the Windows collection of a Visio instance.

You can use the obtained HWND in Windows API calls.

Note Note

Calls to the WindowHandle property (now hidden) are directed to the WindowHandle32 property.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.WindowHandle

  • Microsoft.Office.Interop.Visio.IVApplication.WindowHandle32

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the 32-bit handle of a window.

VBA Copy code Copy code

Public Sub WindowHandle32_Example()

    Dim vsoWindow As Visio.Window
    Dim lngWindowHandle32 As Long

    'Get the active window.
    Set vsoWindow = ActiveWindow

    'Get the 32-bit handle of the active window.
    lngWindowHandle32 = vsoWindow.WindowHandle32

    'Verify that you got the handle.
    Debug.Print "The active window handle is"; lngWindowHandle32

End Sub


Application.Windows Property (Visio)

 Copy code hover
[image]

Application.Windows Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Windows collection for a Microsoft Visio instance or window. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Windows

expression A variable that represents an Application object.

Return Value

Windows

Example

This Microsoft Visual Basic macro gets the Windows collection of the Application object and prints the ID of each window in the collection in the Immediate window.

VBA Copy code Copy code
Public Sub Windows_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoWindows As Visio.Windows
 Dim intCounter As Integer

 'Get the Windows collection.
 Set vsoApplication = Application
 Set vsoWindows = vsoApplication.Windows

 For intCounter = 1 To vsoWindows.Count
 Debug.Print vsoWindows.Item(intCounter).ID
 Next intCounter

End Sub


Application Methods (Visio)

 Copy code hover
[image]

Application Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddUndoUnit | Adds an object that supports the IOleUndoUnit or IVBUndoUnit interface to the Microsoft Visio undo queue.
BeginUndoScope | Starts a transaction with a unique scope ID for an instance of Microsoft Visio.
ClearCustomMenus | Restores the built-in Microsoft Visio user interface.
ClearCustomToolbars | Restores the built-in Microsoft Visio user interface.
ConvertResult | Converts a string or number into an equivalent number in different measurement units.
DoCmd | Performs the command that has the indicated command ID.
EndUndoScope | Ends or cancels a transaction that has a unique scope.
EnumDirectories | Returns an array naming the folders Microsoft Visio would search, given a list of paths.
FormatResult | Formats a string or number into a string according to a format picture. Uses specified units for scaling and formatting.
FormatResultEx | Formats a string or number into a string according to a format picture, using specified units for scaling and formatting. Optionally, for date or time strings, sets the language and calendar type of the string.
GetBuiltInStencilFile | Returns the file path to the specified built-in, hidden stencil used to populate certain galleries in the Microsoft Visio user interface.
GetCustomStencilFile | Returns the path to the specified custom stencil used to populate certain galleries in the Microsoft Visio user interface.
GetPreviewEnabled | Returns a value that indicates whether preview is enabled for the specified gallery in the Microsoft Visio user interface.
InvokeHelp | Performs operations that involve the Microsoft Visio Help system.
OnComponentEnterState | Informs a Microsoft Visio instance that client code is causing the instance to enter or exit a particular state.
PurgeUndo | Empties the Microsoft Visio queue of undo actions.
QueueMarkerEvent | Queues a MarkerEvent event that fires after all other queued events.
Quit | Closes the indicated instance of Microsoft Visio.
Redo | Reverses the most recent undo unit.
RegisterRibbonX | Registers the IRibbonExtensibility interface that is implemented by the specified add-on to populate the custom user interface (UI).
RenameCurrentScope | Renames the top-level open undo scope.
SetCustomMenus | Replaces the current built-in or custom menus of an application or document.
SetCustomToolbars | Replaces the current built-in or custom toolbars of an application or document.
SetPreviewEnabled | Turns preview on or off for a gallery in the Microsoft Visio user interface.
Undo | Reverses the most recent undo unit, if the undo unit can be reversed.
UnregisterRibbonX | Unregisters a previouly registered IRibbonExtensiblity interface that a Microsoft Visio add-in implements.


Application.AddUndoUnit Method (Visio)

 Copy code hover
[image]

Application.AddUndoUnit Method (Visio)
Send feedback

Published: July 16, 2012

Adds an object that supports the IOleUndoUnit or IVBUndoUnit interface to the Microsoft Visio undo queue.

Version Information

Version Added: Visio 2000

Syntax

expression .AddUndoUnit(pUndoUnit)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
pUndoUnit | Required | [UNKNOWN] | A reference to an object that supports the IOleUndoUnit or IVBUndoUnit interface.

Return Value

Nothing

Remarks

For information about implementing the IOleUndoUnit interface on your object, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network. For information about implementing the IVBUndoUnit interface, see Developing Microsoft Visio Solutions on MSDN.

Example

The following procedure shows how to use the AddUndoUnit method to add an object to the Visio undo queue. When a shape is added to the active document, the procedure checks to see if it was added as a result of an undo or redo action, and if not, it adds an Undo unit.

This procedure is a member of class clsParticipateInUndo, which is defined in one of two related class modules in the Code Samples Library in the Visio SDK, and is not intended to be run independently. (The other class module defines class clsVBUndoUnits.) For more information on these class modules, see the Visio SDK on MSDN.

VBA Copy code Copy code

Private Sub mvsoDocument_ShapeAdded(ByVal vsoShape As IVShape)

 Dim VBUndoUnit As clsVBUndoUnits

 On Error GoTo mvsoDocument_ShapeAdded_Err

 If Not (mvsoApplication Is Nothing) Then

 If Not msvoApplication.IsUndoingOrRedoing Then

 'Increment the count of undoable actions.
 IncrementModuleVar
 Debug.Print "Original Do: GetModuleVar = " & GetModuleVar

 'Instantiate clsVBUndoUnit, a
 'class that implements Visio.IVBUndoUnit.
 Set VBUndoUnit = New clsVBUndoUnits

 'Pass the current instance of the class
 'of which this procedure is a member,
 'clsParticipateInUndo, to the Undo unit.
 VBUndoUnit.SetModelObject Me

 'Add an Undo unit.
 mvsoApplication.AddUndoUnit VBUndoUnit

 End If

 End If

Exit Sub

mvsoDocument_ShapeAdded_Err:

 MsgBox Err.Description

End Sub


Application.BeginUndoScope Method (Visio)

 Copy code hover
[image]

Application.BeginUndoScope Method (Visio)
Send feedback

Published: July 16, 2012

Starts a transaction with a unique scope ID for an instance of Microsoft Visio.

Version Information

Version Added: Visio 2000

Syntax

expression .BeginUndoScope(bstrUndoScopeName)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
bstrUndoScopeName | Required | String | The name of the scope; could appear in the Visio user interface.

Return Value

Long

Remarks

If you need to know whether events you receive are the result of a particular operation that you initiated, use the BeginUndoScope and EndUndoScope methods to wrap your operation. In your event handlers, use the IsInScope property to test whether the scope ID returned by the BeginUndoScope method is part of the current context. Make sure you clear the scope ID you stored from the BeginUndoScope property when you receive the ExitScope event with that ID.

You must balance calls to the BeginUndoScope method with calls to the EndUndoScope method. If you call the BeginUndoScope method, you should call the EndUndoScope method as soon as you are finished with the actions that constitute your scope. Also, while actions to multiple documents should be robust within a single scope, closing a document may have the side effect of clearing the undo information for the currently open scope as well as clearing the undo and redo stacks. If that happens, passing bCommit = False to EndUndoScope does not restore the undo information.

You can also use the BeginUndoScope and EndUndoScope methods to add an action defined by an add-on to the Visio undo stream. This is useful when you are operating from modeless scenarios where the initiating agent is part of an add-on's user interface or a modeless programmatic action.

Note Note

Most Visio actions are already wrapped in internal undo scopes, so add-ons running within the application do not need to call this method.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.BeginUndoScope(string)

Example

This example shows how to use the BeginUndoScope method to start a transaction that has a unique scope ID for an instance of Visio.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application
Private lngScopeID As Long

Public Sub BeginUndoScope_Example()

    Dim vsoShape As Visio.Shape

    'Set the module-level application variable to
    'trap application-level events.
    Set vsoApplication = Application

    'Begin a scope and set the module-level scope ID variable.
    lngScopeID = Application.BeginUndoScope("Draw Shapes")

    'Draw three shapes.
    Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
    ActivePage.DrawOval 3, 4, 4, 3
    ActivePage.DrawLine 4, 5, 5, 4

    'Change a cell to trigger the CellChanged event.
    vsoShape.Cells("Width").Formula = 5

    'End and commit this scope.
    Application.EndUndoScope lngScopeID, True

 End Sub

 Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

    'Check to see if this cell change is the result of something
    'happening within the scope.
    If vsoApplication.IsInScope(lngScopeID) Then
        Debug.Print Cell.Name & " changed in scope "; lngScopeID
    End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
    ByVal nScopeID As Long, _
    ByVal bstrDescription As String)

    If vsoApplication.CurrentScope = lngScopeID Then
        Debug.Print "Entering my scope " & nScopeID
    Else
        Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
    End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
    ByVal nScopeID As Long, _
    ByVal bstrDescription As String, _
    ByVal bErrOrCancelled As Boolean)

    If vsoApplication.CurrentScope = lngScopeID Then
        Debug.Print "Exiting my scope " & nScopeID
    Else
        Debug.Print "Exit Scope " & bstrDescription & "(" & nScopeID & ")"
    End If

End Sub


Application.ClearCustomMenus Method (Visio)

 Copy code hover
[image]

Application.ClearCustomMenus Method (Visio)
Send feedback

Published: July 16, 2012

Restores the built-in Microsoft Visio user interface.

Version Information

Version Added: Visio 4.0

Syntax

expression .ClearCustomMenus

expression A variable that represents an Application object.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Calling the ClearCustomMenus method on an object without custom menus has no effect.

Example

This example shows how to clear custom menus for the ThisDocument and Application objects and restore the built-in Visio menus.

VBA Copy code Copy code

Public Sub ClearCustomMenus_Example()

 'Tell Visio to use the built-in menus.
 ThisDocument.ClearCustomMenus
 Visio.Application.ClearCustomMenus

End Sub


Application.ClearCustomToolbars Method (Visio)

 Copy code hover
[image]

Application.ClearCustomToolbars Method (Visio)
Send feedback

Published: July 16, 2012

Restores the built-in Microsoft Visio user interface.

Version Information

Version Added: Visio 4.0

Syntax

expression .ClearCustomToolbars

expression A variable that represents an Application object.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Calling the ClearCustomToolbars method on an object without custom toolbars has no effect.

Example

This example shows how to clear custom toolbars for the ThisDocument and Application objects and restore the built-in Microsoft Visio toolbars.

VBA Copy code Copy code

Public Sub ClearCustomToolbars_Example()

 'Tell Visio to use the built-in toolbars.
 ThisDocument.ClearCustomToolbars
 Visio.Application.ClearCustomToolbars

End Sub


Application.ConvertResult Method (Visio)

 Copy code hover
[image]

Application.ConvertResult Method (Visio)
Send feedback

Published: July 16, 2012

Converts a string or number into an equivalent number in different measurement units.

Version Information

Version Added: Visio 4.5

Syntax

expression .ConvertResult(StringOrNumber, UnitsIn, UnitsOut)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
StringOrNumber | Required | Variant | String or number to be converted; can be a string, floating point number, or integer.
UnitsIn | Required | Variant | Measurement units to attribute to StringOrNumber.
UnitsOut | Required | Variant | Measurement units to express the result in.

Return Value

Double

Remarks

If passed as a string, StringOrNumber might be the formula or prospective formula of a cell or the result or prospective result of a cell expressed as a string. The ConvertResult method evaluates the string and converts the result into the units designated by UnitsOut. The ConvertResult method returns an error if the string contains any cell references.

Possible values for StringOrNumber include:

1.7

3

"2.5"

"4.1 cm"

"12 ft - 17 in + (12 cm / SQRT(7))"

The UnitsIn and UnitsOut arguments can be strings such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Office Visio units such as centimeters, meters, miles, and so on. You can also use any of the units constants declared by the Visio type library in VisUnitCodes. A list of valid units is also listed in About Units of Measure.

If StringOrNumber is a floating point number or integer, UnitsIn declares what unit of measure the ConvertResult method should construe the number to be. Pass "" to indicate internal Visio units.

If StringOrNumber is a string, UnitsIn specifies how to interpret the evaluated result and is only used if the result is a scalar. For example, the expression "4 * 5 cm" evaluates to 20 cm, which is not a scalar, so UnitsIn is ignored. The expression "4 * 5" evaluates to 20 which is a scalar and is interpreted using the specified UnitsIn.

The UnitsOut argument specifies in what units the returned number should be expressed. If you want the results expressed in the same units as the evaluated expression, pass "NOCAST" or visNoCast.

Examples where string is specified:

VBA Copy code Copy code

Debug.Print vsoApplication.ConvertResult("0.5 * 2", "ft", "ft") >>> 1.0
Debug.Print vsoApplication.ConvertResult("0.5 * 2", "ft", "in") >>> 12.0
Debug.Print vsoApplication.ConvertResult("1 cm", "ft", "in") >>> 0.39
Debug.Print vsoApplication.ConvertResult("1 cm", "ft", "NOCAST") >>> 1.0
Debug.Print vsoApplication.ConvertResult("1 cm", "ft", "") >>> 0.39
Debug.Print vsoApplication.ConvertResult("1 cm", "ft", "bozo") >>> exception: Bad measurement unit.

Examples where number is specified:

VBA Copy code Copy code

Debug.Print vsoApplication.ConvertResult(1, "ft", "ft") >>> 1
Debug.Print vsoApplication.ConvertResult(1, "ft", "in") >>> 12
Debug.Print vsoApplication.ConvertResult(1.0, "in", "ft") >>> 8.33333333333333E-02
Debug.Print vsoApplication.ConvertResult(1.0, visFeet, "") >>> 12
Debug.Print vsoApplication.ConvertResult(1, "bozo", "in") >>> exception: Bad measurement unit.

Example

The following macro shows how to use the ConvertResult method to report the distance between two shapes in centimeters, feet, yards, and miles. To run this macro, you must have two shapes selected on your page.

VBA Copy code Copy code
Sub ConvertResult_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoWindow As Visio.Window
 Dim vsoSelection As Visio.Selection
 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape

 Dim dblPinX1 As Double
 Dim dblPinY1 As Double
 Dim dblPinX2 As Double
 Dim dblPinY2 As Double
 Dim dblPinX1in As Double
 Dim dblPinY1in As Double
 Dim dblPinX2in As Double
 Dim dblPinY2in As Double
 Dim lngCount As Long
 Dim dblDistance As Double
 Dim dblDistanceX As Double
 Dim dblDistanceY As Double
 Dim dblResult(4) As Double
 Dim strUnit As String
 Set vsoApplication = Visio.Application
 Set vsoWindow = vsoApplication.ActiveWindow

 'Drawing page must be active window
 If vsoWindow.Type = 1 Then
 Set vsoSelection = vsoWindow.Selection
 lngCount = vsoSelection.Count

 'Exactly two shapes should be selected
 If lngCount <> 2 Then
 MsgBox "A total of " & lngCount & " shapes are " _
 & "selected. Please select two shapes and try " _
 & "again", 0
 Else
 Set vsoShape1 = vsoSelection.Item(1)
 Set vsoShape2 = vsoSelection.Item(2)

 'Pass the Visio Automation constant for inches (visInches, which is defined as 65) to the Result method to force units to inches
 dblPinX1in = vsoShape1.Cells("PinX").Result(65)
 dblPinY1in = vsoShape1.Cells("PinY").Result(65)
 dblPinX2in = vsoShape2.Cells("PinX").Result(65)
 dblPinY2in = vsoShape2.Cells("PinY").Result(65)
 dblDistance = Sqr((dblPinX2in - dblPinX1in) ^ 2 + _
 (dblPinY2in - dblPinY1in) ^ 2)

 'Convert distances from inches to centimeters, feet, yards, and miles
 dblResult(1) = vsoApplication.ConvertResult(dblDistance, "in", "cm")
 dblResult(2) = vsoApplication.ConvertResult(dblDistance, "in", "ft")
 dblResult(3) = vsoApplication.ConvertResult(dblDistance, "in", "yd")
 dblResult(4) = vsoApplication.ConvertResult(dblDistance, "in", "mi")

 'Display results
 MsgBox dblResult(1) & " centimeters; " & dblResult(2) & " feet; " & _
 dblResult(3) & " ;yards; " & dblResult(4) & " miles ", 0

 End If

 Else
 MsgBox "The drawing page must be active.", 0

 End If

End Sub


Application.DoCmd Method (Visio)

 Copy code hover
[image]

Application.DoCmd Method (Visio)
Send feedback

Published: July 16, 2012

Performs the command that has the indicated command ID.

Version Information

Version Added: Visio 4.0

Syntax

expression .DoCmd(CommandID)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
CommandID | Required | Integer | The command to perform.

Return Value

Nothing

Remarks

Constants for Microsoft Visio command IDs are declared by the Visio type library in VisUICmds and are prefixed with visCmd.

The DoCmd method works best with commands that display dialog boxes.

For a list of commands that can be used with the DoCmd method, see the topic DoCmd/DOCMD Commands in this Automation Reference.

Example

The following macro shows how to use constants with the DoCmd method. It opens a new document and displays the document stencil.

VBA Copy code Copy code

Public Sub DoCmd_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")

 Visio.Application.DoCmd (visCmdWindowShowMasterObjects)

End Sub


Application.EndUndoScope Method (Visio)

 Copy code hover
[image]

Application.EndUndoScope Method (Visio)
Send feedback

Published: July 16, 2012

Ends or cancels a transaction that has a unique scope.

Version Information

Version Added: Visio 2000

Syntax

expression .EndUndoScope(nScopeID, bCommit)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
nScopeID | Required | Long | The ID of the scope to close.
bCommit | Required | Boolean | flag indicating that the changes made during the scope should be accepted (True) or canceled (False).

Return Value

Nothing

Remarks

If you need to know whether events you receive are the result of a particular operation that you initiated, use the BeginUndoScope and EndUndoScope methods to wrap your operation. In your event handlers, use the IsInScope property to test whether the scope ID returned by the BeginUndoScope method is part of the current context. Make sure you clear the scope ID you stored from the BeginUndoScope property when you receive the ExitScope event with that ID.

You must balance calls to the BeginUndoScope method with calls to the EndUndoScope method. If you call the BeginUndoScope method, you should call the EndUndoScope method as soon as you are done with the actions that constitute your scope. Also, while actions to multiple documents should be robust within a single scope, closing a document may have the side effect of clearing the undo information for the currently open scope as well as clearing the undo and redo stacks. If that happens, passing bCommit = False to EndUndoScope does not restore the undo information.

You can also use the BeginUndoScope and EndUndoScope methods to add an action defined by an add-on to the Microsoft Visio undo stream. This is useful when you are operating from modeless scenarios where the initiating agent is part of an add-on's user interface or a modeless programmatic action.

Note Note

Most Visio actions are already wrapped in internal undo scopes, so add-ons running within the application do not need to call this method.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.EndUndoScope(int, bool)

Example

This example shows how to use the EndUndoScope method to end a transaction that has a unique scope ID for an instance of Visio.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application
Private lngScopeID As Long

Public Sub EndUndoScope_Example()

    Dim vsoShape As Visio.Shape

    'Set the module-level application variable to
    'trap Application-level events.
    Set vsoApplication = Visio.Application

    'Begin a scope and set the module-level variable.
    lngScopeID = vsoApplication.BeginUndoScope("Draw Shapes")

    'Draw three shapes.
    Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

    ActivePage.DrawOval 3, 4, 4, 3
    ActivePage.DrawLine 4, 5, 5, 4

    'Change a cell to trigger a CellChanged event.
    vsoShape.Cells("Width").Formula = 5

    'End and commit this scope.
    vsoApplication.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

    'Check to see if this cell change is the result of something
    'happening within the scope.
    If vsoApplication.IsInScope(lngScopeID) Then
        Debug.Print Cell.Name & " changed in scope "; lngScopeID
    End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
    ByVal nScopeID As Long, _
    ByVal bstrDescription As
     String)

    If vsoApplication.CurrentScope = lngScopeID Then
        Debug.Print "Entering my scope " & nScopeID
    Else
        Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
    End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
    ByVal nScopeID As Long, _
    ByVal bstrDescription As String, _
    ByVal bErrOrCancelled As Boolean)

    If vsoApplication.CurrentScope = lngScopeID Then
        Debug.Print "Exiting my scope " & nScopeID
    Else
        Debug.Print "Exit Scope " & bstrDescription & "(" & nScopeID & ")"
    End If

End Sub


Application.EnumDirectories Method (Visio)

 Copy code hover
[image]

Application.EnumDirectories Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array naming the folders Microsoft Visio would search, given a list of paths.

Version Information

Version Added: Visio 4.5

Syntax

expression .EnumDirectories(PathsString, NameArray())

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
PathsString | Required | String | A string of full or partial paths separated by semicolons.
NameArray() | Required | String | Out parameter. An array that receives the enumerated folder names.

Return Value

Nothing

Remarks

Several Visio properties such as AddonPaths and TemplatePaths accept and receive a string interpreted to be a list of path (folder) names separated by semicolons. When the application looks for items in the named paths, it looks in the folders and all their subfolders.

The purpose of the EnumDirectories method is to accept a string such as one that the AddonPaths property might produce and return a list of the folders that the application enumerates when processing such a string.

If the EnumDirectories method succeeds, NameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1. Each string is the fully qualified name of a folder that exists. The list names those folders designated in the path list that exist and all their subfolders.

The NameArray() parameter is an out parameter that is allocated by the EnumDirectories method, and ownership is passed back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. (Microsoft Visual Basic and Visual Basic for Applications automatically free the strings referenced by the array's entries.)

Example

The following example shows how to use the EnumDirectories method to print (in the Immediate window) a list of all the folders Visio searches for add-ons.

VBA Copy code Copy code

Public Sub EnumDirectories_Example()

 Dim strDirectoryNames() As String
 Dim intLowerBound As Integer
 Dim intUpperBound As Integer

 Application.EnumDirectories Application.AddonPaths, strDirectoryNames

 intLowerBound = LBound(strDirectoryNames)
 intUpperBound = UBound(strDirectoryNames)

 While intLowerBound <= intUpperBound
 Debug.Print strDirectoryNames(intLowerBound)
 intLowerBound = intLowerBound + 1
 Wend

End Sub


Application.FormatResult Method (Visio)

 Copy code hover
[image]

Application.FormatResult Method (Visio)
Send feedback

Published: July 16, 2012

Formats a string or number into a string according to a format picture. Uses specified units for scaling and formatting.

Version Information

Version Added: Visio 4.5

Syntax

expression .FormatResult(StringOrNumber, UnitsIn, UnitsOut, Format)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
StringOrNumber | Required | Variant | String or number to be formatted; can be passed as a string, floating point number, or integer.
UnitsIn | Required | Variant | Measurement units to attribute to StringOrNumber.
UnitsOut | Required | Variant | Measurement units to express the result in.
Format | Required | String | Picture of what the result string should look like.

Return Value

String

Remarks

If passed as a string, StringOrNumber might be the formula or prospective formula of a cell or the result or prospective result of a cell expressed as a string. The FormatResult method evaluates the string and formats the result. Because the string is being evaluated outside the context of being the formula of a particular cell, the FormatResult method returns an error if the string contains any cell references.

Possible values for StringOrNumber include:

1.7

3

"2.5"

"4.1 cm"

"12 ft - 17 in. + (12 cm / SQRT(7))"

The UnitsIn and UnitsOut arguments can be strings such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Office Visio units such as centimeters, meters, miles, and so on. You can also use any of the unit constants declared by the Visio type library in VisUnitCodes. A list of valid units is also included in About Units of Measure.

If StringOrNumber is a string, UnitsIn specifies how to interpret the evaluated result and is only used if the result is a scalar. For example, the expression "4 * 5 cm" evaluates to 20 cm, which is not a scalar, so UnitsIn is ignored. The expression "4 * 5" evaluates to 20, which is a scalar and is interpreted using the specified UnitsIn.

The UnitsOut argument specifies the units in which the returned string should be expressed. If you want the results expressed in the same units as the evaluated expression, pass "NOCAST" or visNoCast.

Format is a string that specifies a template or picture of the string produced by the FormatResult method. For details, see the FORMAT function. A few of the possibilities are:

# : Output a single digit, but not if it's a leading or trailing 0.

0 : Output a single digit, even if it is a leading or trailing 0.

. : Decimal placeholder.

, : Thousands separator.

"text" or 'text' : Output enclosed text as is.

\c : Output the character c.

Example

Where a string is specified

VBA Copy code Copy code
' Prints 1.00
Debug.Print Application.FormatResult("0.5 * 2", "ft", "ft", "#.00 u")

' Prints 12.00 in.
Debug.Print Application.FormatResult("0.5 * 2", "ft", "in", "#.00 u")

' Prints .39 in.
Debug.Print Application.FormatResult("1 cm", "ft", "in", "#.00 u")

' Prints 1.00 cm.
Debug.Print Application.FormatResult("1 cm", "ft", "NOCAST", "#.00 u")

' Prints 0.39
Debug.Print Application.FormatResult("1 cm", "ft", "", "0.00 u")

' Prints 1858.06 sq. cm.
Debug.Print Application.FormatResult("1 sq. ft. * 2", "in^2", "cm^2", "0.00 u")

' Throws an exception because of bad measurement unit ("bozo")
Debug.Print Application.FormatResult("1 cm", "ft", "bozo", "#.00 u")

Where a number is specified

VBA Copy code Copy code
' Prints 1.00
Debug.Print Application.FormatResult(1, "ft", "ft", "#.00 u")

' Prints 12.00 in.
Debug.Print Application.FormatResult(1, "ft", "in", "#.00 u")

' Prints .08 ft.
Debug.Print Application.FormatResult(1.0, "in", "ft", "#.00 u")

' Prints 12.00
Debug.Print Application.FormatResult(1.0, visFeet, "", "#.00 u")

' Throws an exception because of bad measurement unit ("bozo")
Debug.Print Application.FormatResult(1, "bozo", "in", "#.00 u")

The following macro shows how to use the FormatResult method to convert a value from centimeters to inches and display the result in a message box.

VBA Copy code Copy code

Public Sub FormatResult_Example()

 Dim strOldValue As String
 Dim strNewValue As String

 'Set old value.
 strOldValue = "1 cm"

 'Format value.
 strNewValue = Application.FormatResult _
 (strOldValue, "ft", "in", "#.00 u")

 'Display new value.
 MsgBox (strNewValue)

End Sub


Application.FormatResultEx Method (Visio)

 Copy code hover
[image]

Application.FormatResultEx Method (Visio)
Send feedback

Published: July 16, 2012

Formats a string or number into a string according to a format picture, using specified units for scaling and formatting. Optionally, for date or time strings, sets the language and calendar type of the string.

Version Information

Version Added: Visio 2003

Syntax

expression .FormatResultEx(StringOrNumber, UnitsIn, UnitsOut, Format, LangID, CalendarID)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
StringOrNumber | Required | Variant | String or number to be formatted; can be passed as a string, floating point number, or integer.
UnitsIn | Required | Variant | Measurement units to attribute to StringOrNumber.
UnitsOut | Required | Variant | Measurement units to express the result in.
Format | Required | String | Picture of what the result string should look like.
LangID | Optional | Long | The language to use for the result string.
CalendarID | Optional | Long | he calendar to use for the result string. The default value is the Western calendar, visCalWestern.

Return Value

String

Remarks

If passed as a string, StringOrNumber might be the formula or prospective formula of a cell or the result or prospective result of a cell expressed as a string. The FormatResultEx method evaluates the string and formats the result. Because the string is being evaluated outside the context of being the formula of a particular cell, the FormatResultEx method returns an error if the string contains any cell references.

Possible values for StringOrNumber include:

1.7

3

"2.5"

"4.1 cm"

"12 ft - 17 in + (12 cm / SQRT(7))"

When UnitsIn is visDate, you can pass a numeric value to the DATETIME function in StringOrNumber. The integer portion of the value you pass should represent the number of days since December 30, 1899, and the decimal portion should represent the fraction of a day since midnight. For example, 38135.50 represents noon on May 28th, 2004.

The UnitsIn and UnitsOut arguments can be strings such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Visio units such as centimeters, meters, miles, and so on. You can also use any of the unit constants declared by the Visio type library in VisUnitCodes. A list of valid units is also included in About Units of Measure.

If StringOrNumber is a string, UnitsIn specifies how to interpret the evaluated result and is only used if the result is a scalar. For example, the expression "4 * 5 cm" evaluates to 20 cm, which is not a scalar, so UnitsIn is ignored. The expression "4 * 5" evaluates to 20, which is a scalar and is interpreted using the specified UnitsIn.

The UnitsOut argument specifies the units in which the returned string should be expressed. If you want the results expressed in the same units as the evaluated expression, pass "NOCAST" or visNoCast.

Format is a string that specifies a template or picture of the string produced by the FormatResultEx method. For details, see the FORMAT function. A few of the possibilities are:

# : Output a single digit, but not if it is a leading or trailing 0.

0 : Output a single digit, even if it is a leading or trailing 0.

. : Decimal placeholder.

, : Thousands separator.

"text" or 'text' : Output enclosed text as is.

\c : Output the character c.

When UnitsIn is visDate, Format should be one of the custom Microsoft Visio expanded-form date/time formats, which are of the form "{{ date/time format picture }}". You can view these formats in the Custom Format box in the Data Format dialog box in Visio. (Select a shape, and then, on the Insert tab, click Field. In the Category list, click Date/Time, and then click Data Format.)

The LangID argument is optional. If you don't specify a value, Visio uses the current system language. If you pass a value, the LangID argument should be one of the standard IDs used by Microsoft Windows to encode different language versions. For example, 1033 is the language ID for English (United States). To see a list of possible language IDs, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN.

The CalendarID argument should be one of the following values, which are declared in VisCellVals in the Visio type library. The default value is the Western calendar, visCalWestern.

Constant | Value | Description
visCalWestern | 0 | Western
visCalArabicHijri | 1 | Arabic Hijiri
visCalHebrewLunar | 2 | Hebrew Lunar
visCalChineseTaiwan | 3 | Taiwan Calendar
visCalJapaneseEmperor | 4 | Japanese Emperor Reign
visCalThaiBuddhism | 5 | Thai Buddhist
visCalKoreanDanki | 6 | Korean Danki
visCalSakaEra | 7 | Saka Era
visCalTranslitEnglish | 8 | English transliterated
visCalTranslitFrench | 9 | French transliterated

Example

The following example shows how to use the FormatResultEx property to format a date in Greek and display it as shape text.

VBA Copy code Copy code
Public Sub FormatResultEx_Example

 Dim vsoShape As Visio.Shape
 Dim strDate As String

 Set vsoShape = ActivePage.DrawOval (3, 5, 5, 9)
 strDate = Application.FormatResultEx (37663.50, visDate, "", "{{dd MMMM yyyy}}", 1032, 0)

 vsoShape.Text = strDate

End Sub


Application.GetBuiltInStencilFile Method (Visio)

 Copy code hover
[image]

Application.GetBuiltInStencilFile Method (Visio)
Send feedback

Published: July 16, 2012

Returns the file path to the specified built-in, hidden stencil used to populate certain galleries in the Microsoft Visio user interface.

Version Information

Version Added: Visio 2010

Syntax

expression .GetBuiltInStencilFile(StencilType, MeasurementSystem)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
StencilType | Required | VisBuiltInStencilTypes | The stencil to retrieve. See Remarks for possible values.
MeasurementSystem | Required | VisMeasurementSystem | The measurement system for the stencil.

Return Value

String

Remarks

The StencilType parameter value must be one of the following VisBuiltInStencilTypes constants.

Constant | Value | Description
visBuiltInStencilBackgrounds | 0 | The hidden stencil that contains the shapes displayed in the Backgrounds gallery (Design tab).
visBuiltInStencilBorders | 1 | The hidden stencil that contains the shapes displayed in the Borders and Titles gallery (Design tab).
visBuiltInStencilContainers | 2 | The hidden stencil that contains the shapes displayed in the Container gallery (Insert tab).
visBuiltInStencilCallouts | 3 | The hidden stencil that contains the shapes displayed in the Callout gallery (Insert tab).
visBuiltInStencilLegends | 4 | The hidden stencil that contains the shapes displayed in the Insert Legend gallery (Data tab).

Example

The following Visual Basic for Applications (VBA) code sample shows how to use the GetBuiltInStencilFile method to open the built-in, hidden, container stencil, and to add one of the containers from that stencil to the active page to contain the selected shape or shapes. Before you run this code, be sure that there is a selected shape (or a selection of shapes) on the active page.

VBA Copy code Copy code
Public Sub GetBuiltInStencilFile_Example()

    Dim vsoDocument As Visio.Document
    Set vsoDocument = Application.Documents.OpenEx(Application.GetBuiltInStencilFile(visBuiltInStencilContainers, visMSUS), visOpenHidden)
    Application.ActivePage.DropContainer vsoDocument.Masters.ItemU("Container 1"), Application.ActiveWindow.Selection
    vsoDocument.Close

End Sub


Application.GetCustomStencilFile Method (Visio)

 Copy code hover
[image]

Application.GetCustomStencilFile Method (Visio)
Send feedback

Published: July 16, 2012

Returns the path to the specified custom stencil used to populate certain galleries in the Microsoft Visio user interface.

Version Information

Version Added: Visio 2010

Syntax

expression .GetCustomStencilFile(StencilType)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
StencilType | Required | VisBuiltInStencilTypes | The stencil to retrieve. See Remarks for possible values.

Return Value

String

Remarks

The StencilType parameter value must be one of the following VisBuiltInStencilTypes constants.

Constant | Value | Description
visBuiltInStencilBackgrounds | 0 | The hidden stencil that contains the shapes displayed in the Backgrounds gallery (Design tab).
visBuiltInStencilBorders | 1 | The hidden stencil that contains the shapes displayed in the Borders and Titles gallery (Design tab).
visBuiltInStencilContainers | 2 | The hidden stencil that contains the shapes displayed in the Container gallery (Insert tab).
visBuiltInStencilCallouts | 3 | The hidden stencil that contains the shapes displayed in the Callout gallery (Insert tab).
visBuiltInStencilLegends | 4 | The hidden stencil that contains the shapes displayed in the Insert Legend gallery (Data tab).


Application.GetPreviewEnabled Method (Visio)

 Copy code hover
[image]

Application.GetPreviewEnabled Method (Visio)
Send feedback

Published: July 16, 2012

Returns a value that indicates whether preview is enabled for the specified gallery in the Microsoft Visio user interface.

Version Information

Version Added: Visio 2010

Syntax

expression .GetPreviewEnabled(GalleryName)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
GalleryName | Required | String | The name of the gallery for which you want to check the preview status. See Remarks.

Return Value

Boolean

Remarks

For the GalleryName parameter, you must pass the control ID for the specified gallery. You can find a list of control IDs for all Visio galleries by searching the MSDN library at http://msdn.microsoft.com/library.


Application.InvokeHelp Method (Visio)

 Copy code hover
[image]

Application.InvokeHelp Method (Visio)
Send feedback

Published: July 16, 2012

Performs operations that involve the Microsoft Visio Help system.

Version Information

Version Added: Visio 2002

Syntax

expression .InvokeHelp(bstrHelpFileName, Command, Data)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
bstrHelpFileName | Required | String | Specifies an HTML file, a URL, a compiled HTML file, or an optional window definition (preceded with a ">" character). If the command being used does not require a file or URL, this value may be "".
Command | Required | Long | The action to perform.
Data | Required | Long | Any data that is required based on the value of the command argument.

Return Value

Nothing

Remarks

Using the InvokeHelp method, you can create a custom Help system that is integrated with the Visio Help system. To enable your custom Help to appear in the same MSO Help window as Visio Help, do not specify a window definition in the bstrHelpFileName argument.

The arguments passed to the InvokeHelp method correspond to those described in the HTML Help API. For a list of command values, see the HTML Help API Reference on MSDN, the Microsoft Developer Network. Microsoft Visual Basic programmers can use the numeric equivalent of the C++ constants defined in the HTML Help API header files.

For example, use the following code to display the Visio Help pane:

VBA Copy code Copy code
Application.InvokeHelp "Visio.chm", 15, 0

For more information about the HTML Help API, search for "HTML Help API overview" on MSDN.


Application.OnComponentEnterState Method (Visio)

 Copy code hover
[image]

Application.OnComponentEnterState Method (Visio)
Send feedback

Published: July 16, 2012

Informs a Microsoft Visio instance that client code is causing the instance to enter or exit a particular state.

Version Information

Version Added: Visio 2002

Syntax

expression .OnComponentEnterState(uStateID, bEnter)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
uStateID | Required | VisOnComponentEnterCodes | Describes the state being entered or exited along with flags that influence behavior while in the indicated state.
bEnter | Required | Boolean | True to indicate that a state is being entered; False to indicate that a state is being exited.

Return Value

Nothing

Remarks

The uStateIDargument indicates the state being entered or exited. Code that calls this method should do so both when entering and exiting the state.

At present, the only state change supported by the OnComponentEnterState method is visComponentStateModal, indicating that the client is performing an action that causes Visio to enter or exit a modal state.

Most client code doesn't need to call the OnComponentEnterState method when causing Visio to enter or leave the state of being modal, for example, when showing modal dialog boxes. Typically, this method is used by client code that shows dialog boxes other than Microsoft Visual Basic for Applications (VBA) forms and requires behavior different from the Visio default behavior.

Following are constants and values for uStateID, which are declared by the Visio type library in VisOnComponentEnterCodes. Any of the following constants prefixed with visModal can be combined with visComponentStateModal to influence Visio behavior when transitioning to or from a modal state.

Constant | Value | Description
visComponentStateModal | 1 | The state being identified is a modal state.
visModalDeferEvents | &H10000 | Causes Visio to attempt to defer firing events while modal. By default, Visio defers firing events when displaying its own dialog boxes, but does not defer firing events when client code has caused a dialog box to appear.In the case of several nested modal scopes, if any scope is deferring events, all scopes within the outermost scope that is deferring events will defer events.This flag only has an effect when Visio is entering a modal scope. When exiting a modal scope, Visio behaves as it did when entering the scope.
visModalNoBeforeAfter | &H20000 | Prevents Visio from firing a BeforeModal event when entering a modal scope or an AfterModal event when leaving a modal scope.By default, Visio fires these events when displaying its own dialog boxes or displaying dialog boxes implemented by VBA, but does not fire these events when client code displays a dialog box.Calling the OnComponentEnterState method will cause these events to fire unless visModalNoBeforeAfter is specified.
visModalDontBlockMessages | &H40000 | Prevents Visio from rejecting calls from outside its main thread while modal. By default, Visio does reject calls from outside its thread while modal.In the case of several nested modal scopes, if any scope is deferring events, all scopes within the outermost scope that is deferring events will defer events.This flag only has an effect when Visio is entering a modal scope. When exiting a modal scope, Visio behaves as it did when entering the scope.
visModalDisableVisiosFrame | &H80000 | Causes Visio to disable its frame window while modal. By default, Visio disables its frame window when showing its own dialog boxes or when showing dialog boxes implemented by VBA, but not when client code in another process shows a dialog box.If code in another process wants to show a dialog box and have the Visio frame window behave as if it is the Visio process showing the dialog box, it can set this flag.This flag only has an effect when Visio entering a modal scope. When exiting a modal scope, Visio behaves as it did when entering the scope.


Application.PurgeUndo Method (Visio)

 Copy code hover
[image]

Application.PurgeUndo Method (Visio)
Send feedback

Published: July 16, 2012

Empties the Microsoft Visio queue of undo actions.

Version Information

Version Added: Visio 5.0

Syntax

expression .PurgeUndo

expression A variable that represents an Application object.

Return Value

Nothing

Remarks

After calling the PurgeUndo method, no operation performed before the call can be reversed.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PurgeUndo method to clear the undo list.

VBA Copy code Copy code

Public Sub PurgeUndo_Example()

 Application.PurgeUndo

End Sub


Application.QueueMarkerEvent Method (Visio)

 Copy code hover
[image]

Application.QueueMarkerEvent Method (Visio)
Send feedback

Published: July 16, 2012

Queues a MarkerEvent event that fires after all other queued events.

Version Information

Version Added: Visio 5.0

Syntax

expression .QueueMarkerEvent(ContextString)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ContextString | Required | String | An arbitrary string that is passed with the event that fires.

Return Value

Long

Remarks

The QueueMarkerEvent method works in conjunction with the MarkerEvent event to allow an Automation client to queue an event to itself. The QueueMarkerEvent method causes the application to fire a MarkerEvent event after it has fired all the events in its event queue.

The QueueMarkerEvent method returns the sequence number of the MarkerEvent event to fire, and the string passed to the QueueMarkerEvent method (legally empty) is passed to the MarkerEvent event handler.

A client program can use either the sequence number or the string to correlate QueueMarkerEvent calls with MarkerEvent events. In this way, the client is able to distinguish events it caused and events it did not cause.

Example

Paste this example code into the ThisDocument object and then run the UseMarker procedure. The output will be displayed in the Microsoft Visual Basic for Applications (VBA) Immediate window.

VBA Copy code Copy code

Dim WithEvents vsoApplication As Visio.Application

Private Sub vsoApplication_MarkerEvent(ByVal app As Visio.IVApplication, _
 ByVal SequenceNum As Long, ByVal ContextString As String)

 Debug.Print "Marker: " & app.EventInfo(0)

End Sub

Private Sub vsoApplication_ShapeAdded(ByVal Shape As Visio.IVShape)

 Debug.Print " ShapeAdded: " & Shape.Name

End Sub

Public Sub UseMarker()

 Set vsoApplication = ThisDocument.Application

 'Marker events can be used to comment a segment
 'of events in the queue.
 vsoApplication.QueueMarkerEvent "I am starting..."
 ActivePage.DrawRectangle 0, 0, 3, 3
 vsoApplication.QueueMarkerEvent "I am finished..."

End Sub

The output in the VBA Immediate window looks like this:

Marker: I am starting...

ShapeAdded: Sheet.1

Marker: I am finished...


Application.Quit Method (Visio)

 Copy code hover
[image]

Application.Quit Method (Visio)
Send feedback

Published: July 16, 2012

Closes the indicated instance of Microsoft Visio.

Version Information

Version Added: Visio 2.0

Syntax

expression .Quit

expression A variable that represents an Application object.

Return Value

Nothing

Remarks

If the Quit method is invoked when any open document has unsaved changes, a dialog box appears asking if you want to save the document. To quit the application without saving and seeing the dialog box, set the Saved property of the Document object representing the document to True immediately before quitting. Set the Saved property to True only if you are sure you want to close the document without saving changes, because you will lose any unsaved changes.


Application.Redo Method (Visio)

 Copy code hover
[image]

Application.Redo Method (Visio)
Send feedback

Published: July 16, 2012

Reverses the most recent undo unit.

Version Information

Version Added: Visio 2.0

Syntax

expression .Redo

expression A variable that represents an Application object.

Return Value

Nothing

Remarks

To reverse the effect of the Undo method, use the Redo method. For example, if you clear an item and then use the Undo method to restore it, use the Redo method to clear the item again.

You cannot invoke the Redo method from code that is executing inside the scope of an open undo unit. Code is in the scope of an open undo unit if it is one of the following:

  • A macro or add-on invoked by the Microsoft Visio user interface.

  • In an event handler responding to a Visio event other than the VisioIsIdle event.

  • In a user-created undo scope. If you call the Redo method from code inside the scope of an open undo unit, it will raise an exception.

The Redo method also raises an exception if the Visio instance is presently performing an undo or redo. To determine whether the Visio instance is undoing or redoing use the IsUndoingOrRedoing property.

You can call the Redo method from the VisioIsIdle event handler because the VisioIsIdle event can only fire when the IsUndoingOrRedoing property is False. You can also call the Redo method from code not invoked by the Visio instance, for example, code invoked from the Visual Basic Editor or from an external program.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to undo and redo actions.

VBA Copy code Copy code

Public Sub Redo_Example()

 Dim vsoShape As Visio.Shape

 'Draw a rectangle, use Undo to delete it, and
 'then use Redo to redraw it.
 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)

 'Delete the shape.
 Visio.Application.Undo

 'Bring it back.
 Visio.Application.Redo

End Sub


Application.RegisterRibbonX Method (Visio)

 Copy code hover
[image]

Application.RegisterRibbonX Method (Visio)
Send feedback

Published: July 16, 2012

Registers the IRibbonExtensibility interface that is implemented by the specified add-on to populate the custom user interface (UI).

Version Information

Version Added: Visio 2010

Syntax

expression .RegisterRibbonX(SourceAddOn, TargetDocument, TargetModes, FriendlyName)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
SourceAddOn | Required | IRibbonExtensibilty | The add-on to register.
TargetDocument | Required | Document | The document that uses the custom UI.
TargetModes | Required | VisRibbonXModes | The modes in which the custom UI should be visible. See Remarks for possible values.
FriendlyName | Required | String | The name to associate with the UI items and errors that originate in the add-on.

Return Value

Nothing

Remarks

If TargetDocument is null, the custom UI is defined at the level of the application. Otherwise, Microsoft Visio binds the visibility of the custom UI to the specified document. The UI does not appear in conjunction with any other document.

TargetModes can be one or more of the following VisRibbonXModes constants.

Name | Value | Description
visRxModeNone | 0 | Display the custom UI when no documents are open.
visRxModeDrawing | 1 | Display the custom UI in Drawing mode.
visRxModeStencil | 2 | Display the custom UI in Stencil mode.
visRxModePrintPreview | 4 | Display the custom UI in Print Preview mode.

If FriendlyName is null, the method fails.


Application.RenameCurrentScope Method (Visio)

 Copy code hover
[image]

Application.RenameCurrentScope Method (Visio)
Send feedback

Published: July 16, 2012

Renames the top-level open undo scope.

Version Information

Version Added: Visio 2002

Syntax

expression .RenameCurrentScope(bstrScopeName)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
bstrScopeName | Required | String | The new name of the undo scope.

Return Value

Nothing

Remarks

The new name assigned to the undo scope appears on the Undo menu as the item name. If there is no open undo scope, the RenameCurrentScope method raises an exception.


Application.SetCustomMenus Method (Visio)

 Copy code hover
[image]

Application.SetCustomMenus Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the current built-in or custom menus of an application or document.

Version Information

Version Added: Visio 4.0

Syntax

expression .SetCustomMenus(MenusObject)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
MenusObject | Required | [IVUIOBJECT] | An expression that returns a UIObject object that represents the new custom menus.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the UIObject object was created in a separate process by using the CreateObject procedure instead of getting the appropriate property of an Application or Document object, the SetCustomMenus method returns an error.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to add a menu and menu item to the user interface, and then replace the built-in menu set with the custom set.

To restore the Microsoft Visio built-in user interface after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub SetCustomMenus_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UI object that represents the Microsoft Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a Demo menu.
 Set vsoMenu = vsoMenus.AddAt(1)
 vsoMenu.Caption = "Demo"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new Demo menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the properties for the new menu item.
 vsoMenuItem.Caption = "&Hello"
 vsoMenuItem.AddOnName = "MsgBox ""Hello"""

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


Application.SetCustomToolbars Method (Visio)

 Copy code hover
[image]

Application.SetCustomToolbars Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the current built-in or custom toolbars of an application or document.

Version Information

Version Added: Visio 4.0

Syntax

expression .SetCustomToolbars(ToolbarsObject)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ToolbarsObject | Required | [IVUIOBJECT] | An expression that returns a UIObject object that represents the new custom toolbars.

Return Value

Nothing

Remarks

If the ToolbarsObject object was created in a separate process by using the VBA CreateObject method instead of getting the appropriate property of an Application or Document object, the SetCustomToolbars method returns an error.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SetCustomToolbars method to replace the built-in toolbar set with the custom set. It retrieves a copy of the built-in Visio toolbars, adds a toolbar and a toolbar button, sets the button icon, and then replaces the toolbar set.

Before running this macro, replace path\filename in the code with the full path to and filename of an icon file (.ico) on your computer.

VBA Copy code Copy code
Public Sub SetCustomToolbarItems_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbar As Visio.Toolbar
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Create a new toolbar
 Set vsoToolbar = vsoToolbarSet.Toolbars.Add

 With vsoToolbar
 .Caption = "test"
 .Position = visBarFloating
 .Left = 300
 .Top = 200

 .Protection = visBarNoHorizontalDock
 .Visible = True
 .Enabled = True
 End With

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbar.ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = visCmdPanZoom

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


Application.SetPreviewEnabled Method (Visio)

 Copy code hover
[image]

Application.SetPreviewEnabled Method (Visio)
Send feedback

Published: July 16, 2012

Turns preview on or off for a gallery in the Microsoft Visio user interface.

Version Information

Version Added: Visio 2010

Syntax

expression .SetPreviewEnabled(GalleryName, OnOrOff)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
GalleryName | Required | String | The name of the gallery for which you want to set the preview status. See Remarks.
OnOrOff | Required | Boolean | True to turn preview on for the specified gallery; False to turn preview off.

Return Value

Nothing

Remarks

For the GalleryName parameter, you must pass the control ID for the specified gallery. You can find a list of control IDs for all Visio galleries by searching the MSDN library at http://msdn.microsoft.com/library.


Application.Undo Method (Visio)

 Copy code hover
[image]

Application.Undo Method (Visio)
Send feedback

Published: July 16, 2012

Reverses the most recent undo unit, if the undo unit can be reversed.

Version Information

Version Added: Visio 2.0

Syntax

expression .Undo

expression A variable that represents an Application object.

Return Value

Nothing

Remarks

Use the Undo method to reverse actions one undo unit at a time.

The number of times that code can call the Undo method depends on whether or not the code is executing in the scope of an open undo unit. Code runs in the scope of an open undo unit if it is:

  • A macro or add-on invoked by the Microsoft Visio user interface.

  • In an event handler responding to a Visio event other than the VisioIsIdle event.

  • In a user-created undo scope.

If code is not executing in the scope of an open undo unit, it can call the Undo method for each undo unit presently on the Visio undo stack. You can set the maximum number of units on the undo stack (20 is the default) on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options). If the number of calls to the Undo method exceeds the number of undo units on the stack, no action is taken and the Undo method raises no exception.

If code is executing in the scope of an open undo unit, it can call the Undo method once for each operation in the open undo unit. If there are additional calls to the Undo method, it raises an exception and takes no action. For example, if code in a macro performs two operations, it can call the Undo method twice. If the macro calls the Undo method a third time, the Undo method raises an exception.

Code that calls the Undo method from within the scope of an undo unit cannot call the Redo method to reverse the action. The Redo method can only be called when there are no open undo units.

The Undo method also raises an exception if the Visio instance is presently performing an undo or redo. To determine whether the Visio instance is undoing or redoing, use the IsUndoingOrRedoing property.

You can call the Undo method from the VisioIsIdle event handler because the VisioIsIdle event can only fire when the IsUndoingOrRedoing property is False. You can also call the Undo method from code not invoked by the Visio instance, for example, code invoked from the Visual Basic Editor or from an external program.

You can undo most actions, but not all. Use the Redo method to reverse the effect of the Undo method.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to undo and redo actions.

VBA Copy code Copy code

Public Sub Undo_Example()

    Dim vsoShape As Visio.Shape

    'Draw a rectangle, use Undo to delete it, and
    'then use Redo to redraw it.
    Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)

    'Delete the shape.
    Visio.Application.Undo

    'Bring it back.
    Visio.Application.Redo

End Sub


Application.UnregisterRibbonX Method (Visio)

 Copy code hover
[image]

Application.UnregisterRibbonX Method (Visio)
Send feedback

Published: July 16, 2012

Unregisters a previouly registered IRibbonExtensiblity interface that a Microsoft Visio add-in implements.

Version Information

Version Added: Visio 2010

Syntax

expression .UnregisterRibbonX(SourceAddOn, TargetDocument)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
SourceAddOn | Required | IRibbonExtensibility | The add-in to unregister.
TargetDocument | Required | Document | The document in which to unregister the add-in.

Return Value

Nothing


Application Events (Visio)

 Copy code hover
[image]

Application Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
AfterModal | Occurs after the Microsoft Visio instance leaves a modal state.
AfterRemoveHiddenInformation | Occurs when hidden information is removed from the document.
AfterReplaceShapes | Occurs after a shape-replacement operation.
AfterResume | Occurs when the operating system resumes normal operation after having been suspended.
AfterResumeEvents | Occurs after firing of events is resumed.
AppActivated | Occurs after a Microsoft Visio instance becomes active.
AppDeactivated | Occurs after a Microsoft Visio instance becomes inactive.
AppObjActivated | Occurs after a Microsoft Visio instance becomes active.
AppObjDeactivated | Occurs after a Microsoft Visio instance becomes inactive.
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
BeforeDocumentClose | Occurs before a document is closed.
BeforeDocumentSave | Occurs before a document is saved.
BeforeDocumentSaveAs | Occurs just before a document is saved by using the Save As command.
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforeModal | Occurs before a Microsoft Visio instance enters a modal state.
BeforePageDelete | Occurs before a page is deleted.
BeforeQuit | Occurs before a Microsoft Visio instance terminates.
BeforeReplaceShapes | Occurs just before a shape-replacement operation.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
BeforeStyleDelete | Occurs before a style is deleted.
BeforeSuspend | Occurs before the operating system enters a suspended state.
BeforeSuspendEvents | Occurs before firing of events is suspended.
BeforeWindowClosed | Occurs before a window is closed.
BeforeWindowPageTurn | Occurs before a window is about to show a different page.
BeforeWindowSelDelete | Occurs before the shapes in the selection of a window are deleted.
CalloutRelationshipAdded | Occurs when a new callout relationship is added to the application.
CalloutRelationshipDeleted | Occurs when a callout relationship is deleted from the application.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ContainerRelationshipAdded | Occurs when a new container relationship is added to the document.
ContainerRelationshipDeleted | Occurs when a container relationship is deleted from the document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
DataRecordsetAdded | Occurs when a DataRecordset object is added to a DataRecordsets collection.
DataRecordsetChanged | Occurs when a data recordset changes as a result of being refreshed.
DesignModeEntered | Occurs before a document enters design mode.
DocumentChanged | Occurs after certain properties of a document are changed.
DocumentCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.
DocumentCreated | Occurs after a document is created.
DocumentOpened | Occurs after a document is opened.
DocumentSaved | Occurs after a document is saved.
DocumentSavedAs | Occurs after a document is saved by using the Save As command.
EnterScope | Queued when an internal command begins, or when an Automation client opens a scope by using the BeginUndoScope method.
ExitScope | Queued when an internal command ends, or when an Automation client exits a scope by using the EndUndoScope method.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
KeyDown | Occurs when a keyboard key is pressed.
KeyPress | Occurs when a keyboard key is pressed.
KeyUp | Occurs when a keyboard key is released.
MarkerEvent | Caused by calling the QueueMarkerEvent method.
MasterAdded | Occurs after a new master is added to a document.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
MouseDown | Occurs when a mouse button is clicked.
MouseMove | Occurs when the mouse is moved.
MouseUp | Occurs when a mouse button is released.
MustFlushScopeBeginning | Occurs before the Microsoft Visio instance is forced to flush its event queue.
MustFlushScopeEnded | Occurs after the Microsoft Visio instance is forced to flush its event queue.
NoEventsPending | Occurs after the Microsoft Visio instance flushes its event queue.
OnKeystrokeMessageForAddon | Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.
PageAdded | Occurs after a new page is added to a document.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelDocumentClose | Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelQuit | Occurs before the application terminates in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelReplaceShapes | Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSuspend | Occurs before the operating system enters a suspended state. If any event handler returns True, the Microsoft Visio instance will deny the operating system's request.
QueryCancelSuspendEvents | Occurs before the application suspends events in response to client code. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelWindowClose | Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QuitCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelQuit event.
ReplaceShapesCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.
RuleSetValidated | Occurs when a rule set is validated.
RunModeEntered | Occurs after a document enters run mode.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionChanged | Occurs after a set of shapes selected in a window changes.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
StyleAdded | Occurs after a new style is added to a document.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.
SuspendCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSuspend event.
SuspendEventsCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSuspendEvents event. .
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.
ViewChanged | Occurs when the zoom level or scroll position of a drawing window changes.
VisioIsIdle | Occurs after the application empties its message queue.
WindowActivated | Occurs after the active window changes in a Microsoft Visio instance.
WindowChanged | Occurs when the size or position of a window changes.
WindowCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.
WindowOpened | Occurs after a window is opened.
WindowTurnedToPage | Occurs after a window shows a different page.


Application.AfterModal Event (Visio)

 Copy code hover
[image]

Application.AfterModal Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the Microsoft Visio instance leaves a modal state.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _AfterModal(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance that is no longer modal.

Remarks

Visio becomes modal when it displays a dialog box. A modal instance of Visio does not handle Automation calls. The BeforeModal event indicates that the instance is about to become modal, and the AfterModal event indicates that the instance is no longer modal.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.AfterRemoveHiddenInformation Event (Visio)

 Copy code hover
[image]

Application.AfterRemoveHiddenInformation Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when hidden information is removed from the document.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _AfterRemoveHiddenInformation(ByVal doc As IVDOCUMENT)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document from which hidden information has been removed.

Remarks

The AfterRemoveHiddenInformation event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the AfterRemoveHiddenInformation event is fired, the EventInfo property returns a string that contains information about which items were removed from the document, consisting of the sum of applicable constant values from the VisRemoveHiddenInfoItems enumeration.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.AfterReplaceShapes Event (Visio)

 Copy code hover
[image]

Application.AfterReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs after a shape-replacement operation.

Syntax

expression .AfterReplaceShapes(sel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data type | Description
sel | Required | IVSELECTION | A Selection object that represents the replacement shape or shapes.

See also

Concepts

Application Object

Other resources

Application Members


Application.AfterResume Event (Visio)

 Copy code hover
[image]

Application.AfterResume Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the operating system resumes normal operation after having been suspended.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _AfterResume(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that resumes after the operating system resumes normal operation.

Remarks

You can use the AfterResume event to reopen any network files that you may have closed in response to the BeforeSuspend event.

If your solution runs outside the Microsoft Visio process, you cannot be assured of receiving this event. For this reason, you should monitor window messages in your program.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.AfterResumeEvents Event (Visio)

 Copy code hover
[image]

Application.AfterResumeEvents Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after firing of events is resumed.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _AfterResumeEvents(ByVal app As [IVAPPLICATION])

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio in which firing of events resumed.

Return Value

nothing

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.AppActivated Event (Visio)

 Copy code hover
[image]

Application.AppActivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a Microsoft Visio instance becomes active.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _AppActivated(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that becomes the active application.

Remarks

The AppActivated event indicates that an instance of Visio has become the active application on the Microsoft Windows desktop. The AppActivated event is different from the AppObjectActivated event, which occurs after an instance of Visio becomes active—the instance of Visio that is retrieved by the GetObject method in a Microsoft Visual Basic program.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.AppDeactivated Event (Visio)

 Copy code hover
[image]

Application.AppDeactivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a Microsoft Visio instance becomes inactive.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _AppDeactivated(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is no longer the active application.

Remarks

The AppDeactivated event indicates that an instance of Visio is no longer the active application on the Microsoft Windows desktop. The AppDeactivated event is different from the AppObjectDeactivated event, which occurs after an instance of Visio ceases to be the active instance—the instance of Visio that is retrieved by the GetObject method in a Microsoft Visual Basic program.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.AppObjActivated Event (Visio)

 Copy code hover
[image]

Application.AppObjActivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a Microsoft Visio instance becomes active.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _AppObjActivated(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that has become the active instance.

Remarks

The AppObjActivated event indicates that an instance of Visio has become active—the instance of Visio that is retrieved by the GetObject method in a Microsoft Visual Basic program. The AppObjActivated event is different from the AppActivated event, which occurs after an instance of Visio becomes the active application on the Microsoft Windows desktop.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.AppObjDeactivated Event (Visio)

 Copy code hover
[image]

Application.AppObjDeactivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a Microsoft Visio instance becomes inactive.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _AppObjDeactivated(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is no longer the active instance.

Remarks

The AppObjDeactivated event indicates that the instance of Visio is no longer the active instance of Visio—the instance of Visio that is retrieved by the GetObject method in a Microsoft Visual Basic program. The AppObjDeactivated event is different from the AppDeactivated event, which occurs after an instance of Visio is no longer the active instance on the Microsoft Windows desktop.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeDataRecordsetDelete Event (Visio)

 Copy code hover
[image]

Application.BeforeDataRecordsetDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a DataRecordset object is deleted from the DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _BeforeDataRecordsetDelete(ByVal DataRecordset As IVDATARECORDSET)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeDocumentClose Event (Visio)

 Copy code hover
[image]

Application.BeforeDocumentClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document is closed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeDocumentClose(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this event maps to the following types:

  • Microsoft.Office.Interop.Visio.EApplication_BeforeDocumentCloseEventHandler (the BeforeDocumentClose delegate.)

  • Microsoft.Office.Interop.Visio.EApplication_Event.BeforeDocumentClose(the BeforeDocumentClose event.)


Application.BeforeDocumentSave Event (Visio)

 Copy code hover
[image]

Application.BeforeDocumentSave Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document is saved.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _BeforeDocumentSave(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be saved.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeDocumentSaveAs Event (Visio)

 Copy code hover
[image]

Application.BeforeDocumentSaveAs Event (Visio)
Send feedback

Published: July 16, 2012

Occurs just before a document is saved by using the Save As command.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _BeforeDocumentSaveAs(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be saved.

Remarks

The BeforeDocumentSaveAs event fires when a document is saved to either a native format (for example, VSD or VDX) or a non-native format (for example, HTM or BMP). It does not fire when a document is saved to DWG, DXF, and DGN formats. To save a document in a non-native format programmatically, you must use the Export method of the Page object. Note that when you call the SaveAs method, Microsoft Visio fires first the BeforeDocumentSaveAs event and then the DocumentSavedAs event. Calling the Export method, however, fires the BeforeDocumentSaveAs event but not the DocumentSavedAs event that follows it in response to the SaveAs method.

The BeforeDocumentSaveAs event is one of a group of events for which the EventInfo property of the Application object contains extra information.

If the BeforeDocumentSaveAs event is fired because a save was initiated by a user or a program, the EventInfo property returns the following string:

"/saveasfile=<filename>"

If it fires because Visio is saving a copy of an open file (for autorecovery or to include as a mail attachment), the EventInfo property will return one of the following strings:

  • If the event is fired for autorecovery purposes, the name of a recovery file in this format: "/autosavefile=C:\TEMP\~$2VSO2FD.vsd"

  • If the event is fired because a document copy is being made to send as a mail attachment, the name of an attachment file in this format: "/mailfile=C:\TEMP\~$2VSO2FD.vsd"

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection by using the AddAdvise method, the vMoreInfo argument to VisEventProc designates the document index: "/doc=1".


Application.BeforeMasterDelete Event (Visio)

 Copy code hover
[image]

Application.BeforeMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a master is deleted from a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeModal Event (Visio)

 Copy code hover
[image]

Application.BeforeModal Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a Microsoft Visio instance enters a modal state.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeModal(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is going to enter a modal state.

Remarks

Visio becomes modal when it displays a dialog box. A modal instance of Visio does not handle Automation calls. The BeforeModal event indicates that an instance is about to become modal, and the AfterModal event indicates that the instance is no longer modal.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforePageDelete Event (Visio)

 Copy code hover
[image]

Application.BeforePageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a page is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforePageDelete(ByVal Page As [IVPAGE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeQuit Event (Visio)

 Copy code hover
[image]

Application.BeforeQuit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a Microsoft Visio instance terminates.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeQuit(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is going to terminate.

Remarks

When programming with Microsoft Visual Basic, use the BeforeDocumentClose event instead of the BeforeQuit event. The code in a Visual Basic project of a Visio document never has the chance to respond to the BeforeQuit event because the project is a property of a document, and all documents are closed before the BeforeQuit event notification is sent.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeReplaceShapes Event (Visio)

 Copy code hover
[image]

Application.BeforeReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs just before a shape-replacement operation.

Syntax

expression .BeforeReplaceShapes(replaceShapes)

expression A variable that represents a Application object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.

See also

Concepts

Application Object

Other resources

Application Members


Application.BeforeSelectionDelete Event (Visio)

 Copy code hover
[image]

Application.BeforeSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before selected objects are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selected objects that are going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. To find out if a shape is locked against deletion, check the value of its LockDelete cell.

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeShapeDelete Event (Visio)

 Copy code hover
[image]

Application.BeforeShapeDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is deleted.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeShapeDelete(ByVal Shape As [IVSHAPE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeShapeDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use the VBA WithEvents keyword to sink the BeforeShapeDelete event.

For performance considerations, the Document object's event set does not include the BeforeShapeDelete event. To sink the BeforeShapeDelete event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Application.BeforeShapeTextEdit Event (Visio)

 Copy code hover
[image]

Application.BeforeShapeTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is opened for text editing in the user interface.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _BeforeShapeTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be opened for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeStyleDelete Event (Visio)

 Copy code hover
[image]

Application.BeforeStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a style is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeSuspend Event (Visio)

 Copy code hover
[image]

Application.BeforeSuspend Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the operating system enters a suspended state.

Version Information

Version Added: Visio 2000 SR-1

Syntax

Private Sub expression _BeforeSuspend(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is going to be suspended.

Remarks

Client programs should close any open network files when this event is fired.

If your solution runs outside the Microsoft Visio process, you cannot be assured of receiving this event. For this reason, you should monitor window messages in your program.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeSuspendEvents Event (Visio)

 Copy code hover
[image]

Application.BeforeSuspendEvents Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before firing of events is suspended.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _BeforeSuspendEvents(ByVal app As [IVAPPLICATION])

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio in which firing of events is going to be suspended.

Return Value

nothing

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeWindowClosed Event (Visio)

 Copy code hover
[image]

Application.BeforeWindowClosed Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a window is closed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeWindowClosed(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeWindowPageTurn Event (Visio)

 Copy code hover
[image]

Application.BeforeWindowPageTurn Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a window is about to show a different page.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeWindowPageTurn(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to show a different page.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.BeforeWindowSelDelete Event (Visio)

 Copy code hover
[image]

Application.BeforeWindowSelDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the shapes in the selection of a window are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeWindowSelDelete(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that contains the selection that is going to be deleted.

Remarks

The BeforeWindowSelDelete event fires if user interactions cause shapes in a window to be deleted. It doesn't fire if a program deletes shapes in a window by using the Cut method, for example.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.CalloutRelationshipAdded Event (Visio)

 Copy code hover
[image]

Application.CalloutRelationshipAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a new callout relationship is added to the application.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _CalloutRelationshipAdded(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the new callout shape-pair relationship.

Remarks

The RelatedShapePairEvent object returned by this event contains two shapes: the callout, represented by the FromShapeID property of the RelatedShapePairEvent object; and the target shape, represented by the ToShapeID property.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Application.CalloutRelationshipDeleted Event (Visio)

 Copy code hover
[image]

Application.CalloutRelationshipDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a callout relationship is deleted from the application.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _CalloutRelationshipDeleted(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the callout shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively. When Microsoft Visio deletes both shapes in the container relationship simultaneously, for example when both shapes are deleted from a drawing as part of a selection, the event does not fire.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event that you want to create, see Event codes.


Application.CellChanged Event (Visio)

 Copy code hover
[image]

Application.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


Application.ConnectionsAdded Event (Visio)

 Copy code hover
[image]

Application.ConnectionsAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections have been established between shapes.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsAdded(ByVal Connects As [IVCONNECTS])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that were established.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsAdded event. To sink the ConnectionsAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Application.ConnectionsDeleted Event (Visio)

 Copy code hover
[image]

Application.ConnectionsDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections between shapes have been removed.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsDeleted(ByVal Connects As [IVCONNECTS])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that have been removed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsDeleted event. To sink the ConnectionsDeleted event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Application.ContainerRelationshipAdded Event (Visio)

 Copy code hover
[image]

Application.ContainerRelationshipAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a new container relationship is added to the document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _ContainerRelationshipAdded(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the new container shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Application.ContainerRelationshipDeleted Event (Visio)

 Copy code hover
[image]

Application.ContainerRelationshipDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a container relationship is deleted from the document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _ContainerRelationshipDeleted(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the container shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively. When Microsoft Visio deletes both shapes in the container relationship simultaneously, for example when both shapes are deleted from a drawing as part of a selection, the event does not fire.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event that you want to create, see Event codes.


Application.ConvertToGroupCanceled Event (Visio)

 Copy code hover
[image]

Application.ConvertToGroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ConvertToGroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.DataRecordsetAdded Event (Visio)

 Copy code hover
[image]

Application.DataRecordsetAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a DataRecordset object is added to a DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetAdded(ByVal DataRecordset As [IVDATARECORDSET])

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that was added.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.


Application.DataRecordsetChanged Event (Visio)

 Copy code hover
[image]

Application.DataRecordsetChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a data recordset changes as a result of being refreshed.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetChanged(ByVal DataRecordsetChanged As IVDATARECORDSETCHANGEDEVENT)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetChanged | Required | [IVDATARECORDSETCHANGEDEVENT] | The data recordset that changed.

Remarks

When the DataRecordsetChanged event fires, the DataRecordsetChangedEvent object is passed to the IVisEventProc.VisEventProc method as the pSubjectObj parameter, which represents he subject of the event—the object to which the event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.DesignModeEntered Event (Visio)

 Copy code hover
[image]

Application.DesignModeEntered Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document enters design mode.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _DesignModeEntered(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to enter design mode.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.DocumentChanged Event (Visio)

 Copy code hover
[image]

Application.DocumentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after certain properties of a document are changed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentChanged(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document whose properties were changed.

Remarks

The DocumentChanged event indicates that one of a document's properties, such as Author or Description, has changed.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.DocumentCloseCanceled Event (Visio)

 Copy code hover
[image]

Application.DocumentCloseCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _DocumentCloseCanceled(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.DocumentCreated Event (Visio)

 Copy code hover
[image]

Application.DocumentCreated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is created.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentCreated(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was created.

Remarks

The DocumentCreated event is often added to the EventList collection of a Microsoft Visio template file (.vst). The event's action is triggered whenever a new document is created based on that template.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

You can add DocumentCreated events to the EventList collection of an Application object, Documents collection, or Document object. The first two are straightforward; if a document is opened or created in the scope of the Application object or its Documents collection, the DocumentCreated event occurs.

However, adding a DocumentCreated event to the EventList collection of a Document object makes sense only if the event's action is visActCodeRunAddon. In this case, the event is persistable; it can be stored with the document. If the document that contains the persistent event is opened, its action is triggered. If a new document is based on or copied from the document that contains the persistent event, the DocumentCreated event is copied to the new document and its action is triggered. However, if the event's action is visActCodeAdvise, that event is not persistable and therefore is not stored with the document; hence, it is never triggered.

You can prevent code from running in response to the DocumentCreated, DocumentOpened, or DocumentAdded event and all events from firing by setting the value of the EventsEnabled property of an Application object to False.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square.

The DocumentCreated event handler runs when a new drawing based on the template that contains this code is created. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentCreated(ByVal vsoDocument As Visio.IVDocument)

'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 'the shape was created locally.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Application.DocumentOpened Event (Visio)

 Copy code hover
[image]

Application.DocumentOpened Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is opened.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentOpened(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was opened.

Remarks

The DocumentOpened event is often added to the EventList collection of a Microsoft Visio template file (.vst). The event's action is triggered whenever an existing document is opened.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

You can add DocumentOpened events to the EventList collection of an Application object, Documents collection, or Document object. The first two are straightforward—if a document is opened or created in the scope of the Application object or its Documents collection, the DocumentOpened event occurs.

However, adding a DocumentOpened event to the EventList collection of a Document object makes sense only if the event's action is visActCodeRunAddon. In this case, the event is persistable—it can be stored with the document. If the document that contains the persistent event is opened, its action is triggered. If a new document is based on or copied from the document that contains the persistent event, the DocumentOpened event is copied to the new document and its action is triggered. However, if the event's action is visActCodeAdvise, that event is not persistable and therefore is not stored with the document; hence it is never triggered.

You can prevent code from running in response to the DocumentCreated, DocumentOpened or DocumentAdded event and all events from firing by setting the value of the EventsEnabled property of an Application object to False.


Application.DocumentSaved Event (Visio)

 Copy code hover
[image]

Application.DocumentSaved Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is saved.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentSaved(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was saved.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


Application.DocumentSavedAs Event (Visio)

 Copy code hover
[image]

Application.DocumentSavedAs Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is saved by using the Save As command.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentSavedAs(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was saved.

Remarks

The DocumentSavedAs event is one of a group of events for which the EventInfo property of the Application object contains extra information.

If the DocumentSavedAs event is fired because a save was initiated by a user or a program, the EventInfo property returns the following string:

"/saveasfile=<filename>"

If it fires because Microsoft Visio is saving a copy of an open file (for autorecovery or to include as a mail attachment), the EventInfo property returns one of the following strings:

  • If the event is fired for autorecovery purposes, the name of a recovery file in this format: "/autosavefile=drivename:\foldername\filename"

  • If the event is fired because a document copy is being made to send as a mail attachment, the name of an attachment file in this format: "/mailfile=drivename:\foldername\filename"

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection created by using the AddAdvise method, the varMoreInfo argument to VisEventProc designates the document index: "/doc=1".


Application.EnterScope Event (Visio)

 Copy code hover
[image]

Application.EnterScope Event (Visio)
Send feedback

Published: July 16, 2012

Queued when an internal command begins, or when an Automation client opens a scope by using the BeginUndoScope method.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _EnterScope(ByVal app As [IVAPPLICATION], ByVal nScopeID As Long, ByVal bstrDescription As String)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that contains the scope.
nScopeID | Required | Long | A language-independent number that describes the operation that just ended or the scope ID returned by the BeginUndoScope method.
bstrDescription | Required | String | A textual description of the operation that changes in different language versions. Contains the user interface description of a Visio operation or the description passed to the BeginUndoScope method.

Remarks

The nScopeID value returned in the case of a Visio operation is the equivalent of the command-related constants that begin with visCmd*.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection created by using the AddAdvise method, the EnterScope event is one of a group of selected events that record extra information in the EventInfo property of the Application object.

The EventInfo property returns bstrDescription, as described above. In addition, the varMoreInfo argument to VisEventProc contains a string formatted as follows: [<nScopeID>;<bErrOrCancelled>;<bstrDescription>;<nHwndContext>], where nHwndContext is the window handle (HWND) of the window that is the context for the command. nHwndContext could be 0.

For EnterScope, bErrOrCancelled always equals zero.

Example

This example shows how to use the EnterScope event. The example determines whether a call to a procedure that handles the CellChanged event is in a particular scope—that is, whether the call occurs between the EnterScope and ExitScope events for that scope.

VBA Copy code Copy code
Private WithEvents vsoApplication As Visio.Application

Private lngScopeID As Long

Public Sub Scope_Example()

 Dim vsoShape As Visio.Shape

 'Set the module-level application variable to
 'trap application-level events.
 Set vsoApplication = Application

 'Begin a scope.
 lngScopeID = Application.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 Application.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering my scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting my scope " & nScopeID
 Else
 Debug.Print "Exit Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


Application.ExitScope Event (Visio)

 Copy code hover
[image]

Application.ExitScope Event (Visio)
Send feedback

Published: July 16, 2012

Queued when an internal command ends, or when an Automation client exits a scope by using the EndUndoScope method.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ExitScope(ByVal app As [IVAPPLICATION], ByVal nScopeID As Long, ByVal bstrDescription As String, ByVal bErrOrCancelled As Boolean)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that contains the scope.
nScopeID | Required | Long | A language-independent number that describes the operation that just ended, or the scope ID returned by the BeginUndoScope method.
bstrDescription | Required | String | A textual description of the operation that changes in different language versions. Contains the UI description of a Visio operation or the description passed to the BeginUndoScope method.
bErrOrCancelled | Required | Boolean | True if there was an error during the scope or if the scope was canceled; False if there wasn't an error and it wasn't canceled.

Remarks

The nScopeID value returned in the case of a Visio operation is the equivalent of the command-related constants that begin with visCmd*.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection created using the AddAdvise method, the ExitScope event is one of a group of selected events that record extra information in the EventInfo property of the Application object.

The EventInfo property returns bstrDescription, as described previously. In addition, the varMoreInfo argument to VisEventProc contains a string formatted as follows: [<nScopeID>;<bErrOrCancelled>;<bstrDescription>;<nHwndContext>], where nHwndContext is the window handle (HWND) of the window that is the context for the command. nHwndContext could be 0.

For ExitScope, bErrOrCancelled is non-zero if the operation failed or was canceled.

Example

This example shows how to use the ExitScope event. The example determines whether a call to a procedure that handles the CellChanged event is in a particular scope—that is, whether the call occurs between the EnterScope and ExitScope events for that scope.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application
Private lngScopeID AsLong

Public Sub Scope_Example()

 Dim vsoShape As Visio.Shape

 'Set the module-level application variable to
 'trap application-level events.
 Set vsoApplication = Application

 'Begin a scope.
 lngScopeID = Application.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 Application.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering my scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting my scope " & nScopeID
 Else
 Debug.Print "Exit Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


Application.FormulaChanged Event (Visio)

 Copy code hover
[image]

Application.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Application.GroupCanceled Event (Visio)

 Copy code hover
[image]

Application.GroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _GroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.KeyDown Event (Visio)

 Copy code hover
[image]

Application.KeyDown Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is pressed.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, ByVal CancelDefault As Boolean)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | The key that was pressed. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the SHIFT and CTRL keys for the event. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 12, it indicates that the user held down both SHIFT and CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio does not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyDown does not have the prefix "Query," but it is still a query event. That is, you can cancel processing the message sent by KeyDown, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

Note Note

Pressing an accelererator key combination, for example, CTRL + C, does not fire the KeyDown event.

If you are using VBA, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyDown event. In the Immediate window, the handler prints the code of the key that was pressed to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


Application.KeyPress Event (Visio)

 Copy code hover
[image]

Application.KeyPress Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is pressed.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyPress(ByVal KeyAscii As Long, ByVal CancelDefault As Boolean)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
KeyAscii | Required | Long | The ASCII value of the key that was pressed. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyAscii are the ASCII codes. To see a list of these codes, search for "ASCII character codes" on MSDN.

If you set CancelDefault to True, Visio does not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyPress does not have the prefix "Query," but it is still a query event. That is, you can cancel processing the message sent by KeyPress, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

Note Note

Pressing an accelererator key combination, for example, CTRL + C, does not fire the KeyPress event.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyPress event. In the Immediate window, the handler prints the ASCII code of the key that was pressed to fire the event.


Application.KeyUp Event (Visio)

 Copy code hover
[image]

Application.KeyUp Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is released.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, ByVal CancelDefault As Boolean)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | The key that was released. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the SHIFT and CTRL keys for the event. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 12, it indicates that the user held down both SHIFT and CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyUp does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by KeyUp, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

If you are using Microsoft Visual Basic or VBA, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, press any key, and then release it to fire a KeyUp event. In the Immediate window, the handler prints the code of the key that was released to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


Application.MarkerEvent Event (Visio)

 Copy code hover
[image]

Application.MarkerEvent Event (Visio)
Send feedback

Published: July 16, 2012

Caused by calling the QueueMarkerEvent method.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _MarkerEvent(ByVal app As [IVAPPLICATION], ByVal SequenceNum As Long, ByVal ContextString As String)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The active instance of Microsoft Visio.
SequenceNum | Required | Long | The ordinal position of this event with respect to past events.
ContextString | Required | String | Context string passed by the QueueMarkerEvent method.

Remarks

Unlike other events that Visio fires, the MarkerEvent event is fired by a client program. A client program receives the MarkerEvent event only if the client program called the QueueMarkerEvent method.

By using the MarkerEvent event in conjunction with the QueueMarkerEvent method, a client program can queue an event to itself. The client program receives the MarkerEvent event after Visio fires all the events present in its event queue at the time of the QueueMarkerEvent call.

The MarkerEvent event passes both the context string that was passed by the QueueMarkerEvent method and the sequence number of the MarkerEvent event to the MarkerEvent event handler. Either of these values can be used to correlate QueueMarkerEvent calls with MarkerEvent events. In this way, a client program can distinguish events it caused from those it did not cause.

For example, a client program that changes the values of Visio cells may only want to respond to the CellChanged events that it did not cause. The client program can first call the QueueMarkerEvent method and pass a context string for later use to bracket the scope of its processing:

VBA Copy code Copy code

vsoObject.QueueMarkerEvent "ScopeStart"
 <My program changes cells here>
vsoObject.QueueMarkerEvent "ScopeEnd"

Then, in the MarkerEvent event handler, the client program could use the context string passed to the QueueMarkerEvent method to identify the CellChanged events that it caused:

VBA Copy code Copy code

Dim blsICausedCellChanges as Boolean

Private Sub vsoObject_MarkerEvent (ByVal vsoApplication As Visio.IVApplication, _
 ByVal lngSequenceNum As Long, ByVal strContextString As String)

 If strContextString = "ScopeStart" Then
 blsICausedCellChanges = True
 ElseIf strContextString = "ScopeEnd" Then
 blsICausedCellChanges = "False"
 End If

End Sub

Private Sub vsoObject_CellChanged (ByVal Cell As Visio.IVCell)

 'Respond only if this client didn't cause a cell change.
 If blsICausedCellChanges = False Then
 <respond to the cell changes>
 End If

End Sub

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification, the MarkerEvent event is one of one of a group of events that record extra information in the EventInfo property of the Application object.

The EventInfo property returns ContextString as described above. The varMoreInfo argument to VisEventProc will be empty.

Example

This example shows how to use the MarkerEvent event to mark an event in the event queue.

Paste this example code into the ThisDocument code window and then run UseMarker. The output will be displayed in the Immediate window.

VBA Copy code Copy code

Dim WithEvents vsoApplication As Visio.Application

Private Sub vsoApplication_MarkerEvent(ByVal app As Visio.IVApplication, _
 ByVal lngSequenceNum As Long, ByVal strContextString As String)
 Debug.Print "Marker: " & app.EventInfo(0)

End Sub

Private Sub vsoApplication_ShapeAdded(ByVal vsoShape As Visio.IVShape)
 Debug.Print " ShapeAdded: " & vsoShape.Name

End Sub

Public Sub UseMarker()

 Set vsoApplication = ThisDocument.Application

 'MarkerEvent events can be used to comment a segment
 'of events in the queue.
 vsoApplication.QueueMarkerEvent "I am starting..."
 ActivePage.DrawRectangle 0, 0, 3, 3
 vsoApplication.QueueMarkerEvent "I am finished..."

End Sub

The output in the Immediate window looks like this:

Marker: I am starting...

ShapeAdded: Sheet.1

Marker: I am finished...


Application.MasterAdded Event (Visio)

 Copy code hover
[image]

Application.MasterAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new master is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterAdded(ByVal Master As [IVMASTER])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.MasterChanged Event (Visio)

 Copy code hover
[image]

Application.MasterChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after properties of a master are changed and propagated to its instances.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterChanged(ByVal Master As [IVMASTER])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master whose properties changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.MasterDeleteCanceled Event (Visio)

 Copy code hover
[image]

Application.MasterDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _MasterDeleteCanceled(ByVal Master As [IVMASTER])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.MouseDown Event (Visio)

 Copy code hover
[image]

Application.MouseDown Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a mouse button is clicked.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was pressed. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseDown does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseDown, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseDown event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event.


Application.MouseMove Event (Visio)

 Copy code hover
[image]

Application.MouseMove Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the mouse is moved.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was clicked. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseMove does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseMove, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then move the mouse briefly in the active window to fire a series of MouseMove events. In the Immediate window, the handler prints a list of x- and y-position value pairs, each of which corresponds to the mouse position when a MouseMove event fired.


Application.MouseUp Event (Visio)

 Copy code hover
[image]

Application.MouseUp Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a mouse button is released.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was released. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseUp does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseUp, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseUp event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event.


Application.MustFlushScopeBeginning Event (Visio)

 Copy code hover
[image]

Application.MustFlushScopeBeginning Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the Microsoft Visio instance is forced to flush its event queue.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _MustFlushScopeBeginning(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is forced to flush its event queue.

Remarks

This event, along with the MustFlushScopeEnded event, can be used to identify whether an event is being fired because Visio is forced to flush its event queue.

Visio maintains a queue of pending events that it attempts to fire at discrete moments when it is able to process arbitrary requests (callbacks) from event handlers.

Occasionally, Visio is forced to flush its event queue when it is not prepared to handle arbitrary requests. When this occurs, Visio first fires a MustFlushScopeBeginning event, and then it fires the events that are presently in its event queue. After firing all pending events, Visio fires the MustFlushScopeEnded event.

After Visio has fired the MustFlushScopeBeginning event, client programs should not call Visio methods that have side effects until the MustFlushScopeEnded event is received. A client can perform arbitrary queries of Visio objects when Visio is between the MustFlushScopeBeginning event and MustFlushScopeEnded event, but operations that cause side effects may fail.

Visio performs a forced flush of its event queue immediately prior to firing a "before" event such as BeforeDocumentClose or BeforeShapeDelete because queued events may apply to objects that are about to close or be deleted. Using the BeforeDocumentClose event as an example, there can be queued events that apply to a shape object in the document that is being closed. So, before the document closes, Visio fires all the events in its event queue.

When a shape is deleted, events are fired in the following sequence:

  1. MustFlushScopeBeginning event
    Client should not call methods that have side effects.

  2. There are zero (0) or more events in the event queue.

  3. BeforeShapeDelete event
    Shape is viable, but Visio is going to delete it.

  4. MustFlushScopeEnded event
    Client can resume invoking methods that have side effects.

  5. ShapesDeleted event
    Shape has been deleted.

  6. NoEventsPending event
    No events remain to be fired.

An event is fired both before (BeforeShapeDeleted event) and after (ShapesDeleted event) the shape is deleted. If a program monitoring these events requires that additional shapes be deleted in response to the initial shape deletion, it should do so in the ShapesDeleted event handler, not the BeforeShapeDeleted event handler. The BeforeShapeDeleted event is inside the scope of the MustFlushScopeBeginning event and the MustFlushScopeEnded event, while the ShapesDeleted event is not.

The sequence number of a MustFlushScopeBeginning event may be higher than the sequence number of events the client sees after it has received the MustFlushScopeBeginning event because Visio assigns sequence numbers to events as they occur. Any events that were queued when the forced flush began have a lower sequence number than the MustFlushScopeBeginning event, even though the MustFlushScopeBeginning event fires first.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.MustFlushScopeEnded Event (Visio)

 Copy code hover
[image]

Application.MustFlushScopeEnded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the Microsoft Visio instance is forced to flush its event queue.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _MustFlushScopeEnded(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is forced to flush its event queue.

Remarks

This event, along with the MustFlushScopeBeginning event, can be used to identify whether an event is being fired because Visio is forced to flush its event queue.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.NoEventsPending Event (Visio)

 Copy code hover
[image]

Application.NoEventsPending Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the Microsoft Visio instance flushes its event queue.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _NoEventsPending(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that flushed its event queue.

Remarks

Visio maintains a queue of events and fires them at discrete moments. Immediately after Visio fires the last event in its event queue, it fires a NoEventsPending event.

A client program can use the NoEventsPending event as a signal that Visio has completed a burst of activity. For example, a client program may want to react to changes in a shape's geometry. A single user action performed on the shape can generate several CellChanged events. The client program could record selected information for each CellChanged event and perform its processing after it receives the NoEventsPending event.

Visio fires the NoEventsPending event only if at least one of the events in the queue is being listened to. If no program is listening for any of the queued events, the NoEventsPending event does not fire. If your program is only listening to the NoEventsPending event, it does not fire unless another program is listening for some of the queued events.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.OnKeystrokeMessageForAddon Event (Visio)

 Copy code hover
[image]

Application.OnKeystrokeMessageForAddon Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.

Version Information

Version Added: Visio 2002

Syntax

Private Sub expression _OnKeystrokeMessageForAddon(ByVal MSG As [IVMSGWRAP])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
MSG | Required | [IVMSGWRAP] | The message that Visio receives.

Remarks

Returns True to indicate that the message was handled by the add-on. Otherwise, returns False.

The OnKeystrokeMessageForAddon event enables add-ons to intercept and process accelerator and keystroke messages directed at their own add-on windows and child windows of their add-on windows. Only add-on windows created using the Add method will source this event.

For this event to fire, the add-on window or one of its child windows must have keystroke focus and the Visio message loop must receive the keystroke message. This event does not fire if the message loop associated with an add-on is handling messages instead of Visio.

Visio fires the OnKeystrokeMessageForAddon event when it receives messages in the following range:

WM_KEYDOWN | 0x0100
WM_KEYUP | 0x0101
WM_CHAR | 0x0102
WM_DEADCHAR | 0x0103
WM_SYSKEYDOWN | 0x0104
WM_SYSKEYUP | 0x0105
WM_SYSCHAR | 0x0106
WM_SYSDEADCHAR | 0x0107

The MSGWrap object, passed to the event handler when the OnKeystrokeMessageForAddon event fires, wraps the Microsoft Windows MSG structure, which contains message data. See the MSGWrap object for more information, or refer to your Windows documentation.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.PageAdded Event (Visio)

 Copy code hover
[image]

Application.PageAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new page is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageAdded(ByVal Page As [IVPAGE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was added.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


Application.PageChanged Event (Visio)

 Copy code hover
[image]

Application.PageChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageChanged(ByVal Page As [IVPAGE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that changed.

Remarks

If several pages of a document have default names and any page but the last is deleted, Microsoft Visio will automatically rename the remaining pages to preserve the naming sequence, but the renaming will not trigger the PageChanged event. For example, if a document contains Page-1, Page-2, and Page-3, and then Page-1 is deleted, Page-2 will be renamed Page-1, and Page-3 will be renamed Page-2, but no PageChanged event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.PageDeleteCanceled Event (Visio)

 Copy code hover
[image]

Application.PageDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _PageDeleteCanceled(ByVal Page As [IVPAGE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was going to be deleted.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelConvertToGroup Event (Visio)

 Copy code hover
[image]

Application.QueryCancelConvertToGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelConvertToGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be converted to a group.

Remarks

A Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • If all handlers return False (don't cancel), the conversion is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelDocumentClose Event (Visio)

 Copy code hover
[image]

Application.QueryCancelDocumentClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelDocumentClose(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be closed.

Remarks

A Microsoft Visio instance fires QueryCancelDocumentClose after the user has directed the instance to close a document.

  • If any event handler returns True (cancel), the instance fires DocumentCloseCanceled and does not close the document.

  • If all handlers return False (don't cancel), the instance firesBeforeDocumentClose and then closes the document.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelGroup Event (Visio)

 Copy code hover
[image]

Application.QueryCancelGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be grouped.

Remarks

A Microsoft Visio instance fires QueryCancelGroup after the user has directed the instance to group a selection of shapes.

  • If any event handler returns True (cancel), the instance fires GroupCanceled and does not group the shapes.

  • If all handlers return False (do not cancel), the grouping is performed.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you use Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelMasterDelete Event (Visio)

 Copy code hover
[image]

Application.QueryCancelMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelMasterDelete after the user has directed the instance to delete a master.

  • If any event handler returns True (cancel), the instance fires MasterDeleteCanceled and does not delete the master.

  • If all handlers return False (don't cancel), the instance fires BeforeMasterDelete and then deletes the master.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelPageDelete Event (Visio)

 Copy code hover
[image]

Application.QueryCancelPageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelPageDelete(ByVal Page As [IVPAGE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

A Visio instance fires QueryCancelPageDelete after the user has directed the instance to delete a page.

  • If any event handler returns True (cancel), the instance fires PageDeleteCanceled and does not delete the page.

  • If all handlers return False (don't cancel) the instance fires BeforePageDelete and then deletes the page.

While a Microsoft Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelQuit Event (Visio)

 Copy code hover
[image]

Application.QueryCancelQuit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application terminates in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelQuit(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that is going to terminate.

Remarks

A Visio instance fires QueryCancelQuit after the user has directed the instance to terminate.

  • If any event handler returns True (cancel), the instance fires QuitCanceled and does not terminate.

  • If all handlers return False (don't cancel), the instance fires BeforeQuit and then terminates.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelReplaceShapes Event (Visio)

 Copy code hover
[image]

Application.QueryCancelReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.

Syntax

expression .QueryCancelReplaceShapes(replaceShapes)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.
lpboolRet | Required | BOOL |

See also

Concepts

Application Object

Other resources

Application Members


Application.QueryCancelSelectionDelete Event (Visio)

 Copy code hover
[image]

Application.QueryCancelSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelSelectionDelete after the user has directed the instance to delete one or more shapes.

  • If any event handler returns True (cancel), the instance fires SelectionDeleteCanceled and does not delete the shapes.

  • If all handlers returnFalse (don't cancel), the instance fires BeforeSelectionDelete and BeforeShapeDelete and then deletes the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelStyleDelete Event (Visio)

 Copy code hover
[image]

Application.QueryCancelStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelStyleDelete after the user has directed the instance to delete a style.

  • If any event handler returns True (cancel), the instance fires StyleDeleteCanceled and does not delete the style.

  • If all handlers return False (don't cancel), the instance fires BeforeStyleDelete and then deletes the style.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelSuspend Event (Visio)

 Copy code hover
[image]

Application.QueryCancelSuspend Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the operating system enters a suspended state. If any event handler returns True, the Microsoft Visio instance will deny the operating system's request.

Version Information

Version Added: Visio 2000 SR-1

Syntax

Private Sub expression _QueryCancelSuspend(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that responds to the operating system request.

Remarks

You will typically respond False and allow the operating system to enter a suspended state. If you have open network files, you can close them when you receive the BeforeSuspend event. If you have open network files that you cannot close, you can return True and Visio will deny the operating system's request.

  • If any event handler returns True (cancel), the instance fires SuspendCanceled and does not enter a suspended state.

  • If all handlers return False (don't cancel), the instance fires BeforeSuspend and then enters a suspended state.

If your solution runs outside the Visio process, you cannot be assured of receiving this event. For this reason, you should monitor window messages in your program.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA macro shows how to capture the QueryCancelSuspend event and allow the operating system to suspend. Declare a WithEvents variable to capture events fired by the Application object.

VBA Copy code Copy code

Public WithEvents vsoApplication As Visio.Application

Private Function vsoApplication_QueryCancelSuspend(ByVal _
    IVisioApplication As IVApplication) As Boolean

    'You agree to let the operating system suspend.
    vsoApplication_QueryCancelSuspend = False

End Function


Application.QueryCancelSuspendEvents Event (Visio)

 Copy code hover
[image]

Application.QueryCancelSuspendEvents Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application suspends events in response to client code. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelSuspendEvents(ByVal app As [IVAPPLICATION])

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio in which firing of events is going to be suspended.

Return Value

nothing

Remarks

A Visio instance fires QueryCancelSuspendEvents after client code has directed the instance to suspend events.

  • If any event handler returns True (cancel), the instance fires SuspendEventsCanceled and does not suspend events.

  • If all handlers return False (don't cancel), the suspension occurs.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelUngroup Event (Visio)

 Copy code hover
[image]

Application.QueryCancelUngroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelUngroup(ByVal Selection As [IVSELECTION], )

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be ungrouped.

Remarks

A Microsoft Visio instance fires QueryCancelUngroup after the user has directed the instance to ungroup one or more shapes.

  • If any event handler returns True (cancel), the instance fires UngroupCanceled and does not ungroup the shapes.

  • If all handlers return False (don't cancel), the instance fires ShapeParentChanged, BeforeSelectionDelete, and BeforeShapeDelete, and then ungroups the shapes.

While a Visio instance is firing a query or cancel event, it respondsto inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QueryCancelWindowClose Event (Visio)

 Copy code hover
[image]

Application.QueryCancelWindowClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelWindowClose(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to be closed.

Remarks

A Microsoft Visio instance fires QueryCancelWindowClose after the user has directed the instance to close a window.

  • If any event handler returns True (cancel), the instance fires WindowCloseCanceled and does not close the window.

  • If all handlers return False (don't cancel), the instance fires BeforeWindowClosed and then closes the window.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but it refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.QuitCanceled Event (Visio)

 Copy code hover
[image]

Application.QuitCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelQuit event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QuitCanceled(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that was going to be terminated.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.ReplaceShapesCanceled Event (Visio)

 Copy code hover
[image]

Application.ReplaceShapesCanceled Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.

Syntax

expression .ReplaceShapesCanceled(replaceShapes)

expression A variable that represents a Application object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.

See also

Concepts

Application Object

Other resources

Application Members


Application.RuleSetValidated Event (Visio)

 Copy code hover
[image]

Application.RuleSetValidated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a rule set is validated.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _RuleSetValidated(ByVal RuleSet As ValidationRuleSet)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
RuleSet | Required | ValidationRuleSet | The rule set that was validated.

Remarks

When Microsoft Visio performs validation, it fires a RuleSetValidated event for every rule set that it processes, even if a rule set is empty.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Application.RunModeEntered Event (Visio)

 Copy code hover
[image]

Application.RunModeEntered Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document enters run mode.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _RunModeEntered(ByVal doc As [IVDOCUMENT])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that entered run mode.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.SelectionAdded Event (Visio)

 Copy code hover
[image]

Application.SelectionAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionAdded(ByVal Selection As [IVSELECTION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the SelectionAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the SelectionAdded event.

For performance considerations, the Document object's event set does not include the SelectionAdded event. To sink the SelectionAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Application.SelectionChanged Event (Visio)

 Copy code hover
[image]

Application.SelectionChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a set of shapes selected in a window changes.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionChanged(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window in which the selection changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.SelectionDeleteCanceled Event (Visio)

 Copy code hover
[image]

Application.SelectionDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _SelectionDeleteCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.ShapeAdded Event (Visio)

 Copy code hover
[image]

Application.ShapeAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _ShapeAdded(ByVal Shape As [IVSHAPE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape or group of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the ShapeAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

To determine if a ShapeAdded event was triggered by a new shape or group of shapes being added to the page, by a set of existing shapes being grouped, or by a paste action, you can use the Application.IsInScope property. If IsInScope returns True when passed visCmdObjectGroup, the ShapeAdded event was triggered by a grouping action. If IsInScope returns True when passed visCmdUFEditPaste or visCmdEditPasteSpecial, the ShapeAdded event was triggered by a paste operation. If IsInScope returns False when passed all of these arguments, the event must have been triggered by new shapes being added to the page.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square. Paste the code into the active document's project in Visio.

The DocumentSaved event handler runs when the active document is saved. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentSaved(ByVal vsoDocument As Visio.IVDocument)

 'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 'the shape was created locally.
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Application.ShapeChanged Event (Visio)

 Copy code hover
[image]

Application.ShapeChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a property of a shape that is not stored in a cell is changed in a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _ShapeChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose property changed.

Remarks

To determine which properties have changed when ShapeChanged fires, use the EventInfo property. The string returned by the EventInfo property contains a list of substrings that identify the properties that changed.

Changes to the following shape properties cause the ShapeChanged event to fire:

  • Name (the EventInfo property contains "/name")

  • Data1 (the EventInfo property contains "/data1")

  • Data2 (the EventInfo property contains "/data2")

  • Data3 (the EventInfo property contains "/data3")

  • UniqueID (the EventInfo property contains "/uniqueid")

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection that was created by using AddAdvise, the varMoreInfo argument to VisEventProc contains the string: "/doc=1 /page=1 /shape=Sheet.3"

Note Note

You can use VBA WithEvents variables to sink the ShapeChanged event.

For performance considerations, the Document object's event set does not include the ShapeChanged event. To sink the ShapeChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Application.ShapeDataGraphicChanged Event (Visio)

 Copy code hover
[image]

Application.ShapeDataGraphicChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a data graphic is applied to or deleted from a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeDataGraphicChanged(ByVal Shape As IVSHAPE)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape to which the data graphic was applied or from which it was deleted.

Remarks

A data graphic is a Master object of type visTypeDataGraphic. When the same master that is already applied to a shape is re-applied to the shape, the ShapeDataGraphicChanged event does not fire, even if the master has been modified since it was applied originally. If, however, a different data graphic master is applied to the shape, the event does fire.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.ShapeExitedTextEdit Event (Visio)

 Copy code hover
[image]

Application.ShapeExitedTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is no longer open for interactive text editing.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeExitedTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that was closed for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.ShapeLinkAdded Event (Visio)

 Copy code hover
[image]

Application.ShapeLinkAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is linked to a data row.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkAdded(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long)

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is linked to data.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row linked to the shape.
DataRowID | Required | Long | The ID of the data row linked to the shape.

Remarks

The ShapeLinkAdded event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkAdded event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.ShapeLinkDeleted Event (Visio)

 Copy code hover
[image]

Application.ShapeLinkDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the link between a shape and a data row is deleted.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkDeleted(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long )

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose link to a data row was broken.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row that was linked to the shape.
DataRowID | Required | Long | The ID of the data row that was linked to the shape.

Remarks

The ShapeLinkDeleted event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkDeleted event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.ShapeParentChanged Event (Visio)

 Copy code hover
[image]

Application.ShapeParentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after shapes are grouped or a group is ungrouped.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeParentChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose parent changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.StyleAdded Event (Visio)

 Copy code hover
[image]

Application.StyleAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new style is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleAdded(ByVal Style As [IVSTYLE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.StyleChanged Event (Visio)

 Copy code hover
[image]

Application.StyleChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleChanged(ByVal Style As [IVSTYLE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.StyleDeleteCanceled Event (Visio)

 Copy code hover
[image]

Application.StyleDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _StyleDeleteCanceled(ByVal Style As [IVSTYLE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.SuspendCanceled Event (Visio)

 Copy code hover
[image]

Application.SuspendCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSuspend event.

Version Information

Version Added: Visio 2000 SR-1

Syntax

Private Sub expression _SuspendCanceled(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that was going to be suspended.

Remarks

If your solution runs outside the Visio process, you cannot be assured of receiving this event. For this reason, you should monitor window messages in your program.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.SuspendEventsCanceled Event (Visio)

 Copy code hover
[image]

Application.SuspendEventsCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSuspendEvents event. .

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _SuspendEventsCanceled(ByVal app As )

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio in which firing of events was going to be suspended.

Return Value

nothing

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.TextChanged Event (Visio)

 Copy code hover
[image]

Application.TextChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the text of a shape is changed in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _TextChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose text changed.

Remarks

The TextChanged event is fired when the raw text of a shape changes, such as when the characters Microsoft Visio stores for the shape change. If a shape's characters change because a user is typing, the TextChanged event does not fire until the text editing session terminates.

When a field is added to or removed from a shape's text, its raw text changes; hence, a TextChanged event fires. However, no TextChanged event fires when the text in a field changes. For example, a shape has a text field that shows its width. A TextChanged event does not fire when the shape's width changes, because the raw text stored for the shape has not changed, even though the apparent (expanded) text of the shape does change. Use the CellChanged event for one of the cells in the Text Fields section to detect when the text in a text field changes.

To access a shape's raw text, use the Text property. To access the text of a shape in which text fields have been expanded, use the Characters.Text property. You can determine the location and properties of text fields in a shape's text by using the Shape.Characters object.

In Visio 5.0 and earlier versions, the raw characters reported by the Text property for a field included four characters, the first being the escape character. Starting with Visio 2000, only a single escape character is present in the raw text stream.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the TextChanged event.

For performance considerations, the Document object's event set does not include the TextChanged event. To sink the TextChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Application.UngroupCanceled Event (Visio)

 Copy code hover
[image]

Application.UngroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _UngroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be ungrouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.ViewChanged Event (Visio)

 Copy code hover
[image]

Application.ViewChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the zoom level or scroll position of a drawing window changes.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ViewChanged(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window whose zoom level or scroll position changed.

Remarks

This event fires whenever the zoom level or scroll position of a Window object of the type visDrawing changes.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.VisioIsIdle Event (Visio)

 Copy code hover
[image]

Application.VisioIsIdle Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the application empties its message queue.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _VisioIsIdle(ByVal app As [IVAPPLICATION])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that emptied its message queue.

Remarks

Visio continually processes messages in its message queue. When its message queue is empty:

  1. Visio performs its own idle-time processing.

  2. Visio tells Microsoft Visual Basic for Applications to perform its idle-time processing.

  3. If the message queue is still empty, Visio fires the VisioIsIdle event.

  4. If the message queue is still empty, Visio calls WaitMessage, which is a call to Microsoft Windows that doesn't return until a new message gets added to the Visio message queue.

A client program can use the VisioIsIdle event as a signal to perform its own background processing.

The VisioIsIdle event is not the equivalent of a standard timer event. Client programs that need to be called on a periodic basis should use standard timer techniques, because the duration in which Visio is idle (calls WaitMessage) is unpredictable. For client programs that are only monitoring Visio activity, however, the VisioIsIdle event can be sufficient, because until WaitMessage returns to Visio, there cannot have been any Visio activity since the VisioIsIdle event was last fired.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.WindowActivated Event (Visio)

 Copy code hover
[image]

Application.WindowActivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the active window changes in a Microsoft Visio instance.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _WindowActivated(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that was activated.

Remarks

The WindowActivated event indicates that the active window has changed in a Visio instance. This event implies that the ActiveDocument and ActivePage properties of the Application object may also have changed; in contrast, any time the ActiveDocument or ActivePage property changes, a WindowActivated event is always generated.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this event maps to the following types:

  • Microsoft.Office.Interop.Visio.EApplication_WindowActivatedEventHandler (the WindowActivated delegate.)

  • Microsoft.Office.Interop.Visio.EApplication_Event.WindowActivated (the WindowActivated event.)


Application.WindowChanged Event (Visio)

 Copy code hover
[image]

Application.WindowChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the size or position of a window changes.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _WindowChanged(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window whose size or position has changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.WindowCloseCanceled Event (Visio)

 Copy code hover
[image]

Application.WindowCloseCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _WindowCloseCanceled(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that was going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.WindowOpened Event (Visio)

 Copy code hover
[image]

Application.WindowOpened Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a window is opened.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _WindowOpened(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that opened.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Application.WindowTurnedToPage Event (Visio)

 Copy code hover
[image]

Application.WindowTurnedToPage Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a window shows a different page.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _WindowTurnedToPage(ByVal Window As [IVWINDOW])

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that shows a different page.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this event maps to the following types:

  • Microsoft.Office.Interop.Visio.EApplication_WindowTurnedToPageEventHandler (the WindowTurnedToPage delegate.)

  • Microsoft.Office.Interop.Visio.EApplication_Event.WindowTurnedToPage (the WindowTurnedToPage event.)


ApplicationSettings Object (Visio)

 Copy code hover
[image]

ApplicationSettings Object (Visio)
Send feedback

Published: July 16, 2012

Represents various application settings for Microsoft Visio.

Remarks

Use the Settings property of the Application object to get an ApplicationSettings object, which you can then use to set various application properties corresponding to those in the Options dialog box (click the File tab, and then click Options) and the Snap & Glue dialog box (on the View tab, click the Visual Aids arrow).

The ApplicationSettings object has no default property.


ApplicationSettings Members (Visio)

 Copy code hover
[image]

ApplicationSettings Members (Visio)
Send feedback

Published: July 16, 2012

Represents various application settings for Microsoft Visio.

Methods

Name | Description
GetRasterExportResolution | Returns the raster export resolution settings.
GetRasterExportSize | Gets the raster export size.
SetRasterExportResolution | Specifies the raster export resolution settings.
SetRasterExportSize | Sets the raster export size.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ApplyBackgroundToDocument | Determines whether the selected background or border is applied to all pages in the document (True) or only to the current page (False). Read/write.
ApplyThemesOnShapeAdd | Gets or sets whether to apply themes to new shapes when they are added to the drawing page. Read/write.
AsianTextUI | Gets whether Asian text is displayed in the Microsoft Visio user interface. Read-only.
BIDITextUI | Gets the current setting for display of right-to-left languages. Read-only.
CenterSelectionOnZoom | Determines whether when the user zooms in, the selection appears in the center of the window. Read/write.
ComplexTextUI | Gets whether complex text is displayed in the Microsoft Visio user interface. Read-only.
ConnectorSplittingEnabled | Determines whether connector splitting is enabled in Microsoft Visio. Read/write.
DefaultSaveFormat | Determines the default format for saving Microsoft Visio files. Read/write.
DeleteConnectorsEnabled | Determines whether connectors are deleted when a shape to which they are connected is deleted. Read/write.
DeveloperMode | Determines if certain user interface functions for the development environment in Microsoft Visio are enabled. Read/write.
DrawingAids | Determines whether drawing aids are currently active in Microsoft Visio. Read/write.
DrawingBackgroundColor | Determines the background color of the Microsoft Visio drawing window for the current session. Read/write.
DrawingBackgroundColorGradient | Determines the background gradient color of the Microsoft Visio drawing window for the current session. Read/write.
DrawingPageColor | Determines the page color of the Microsoft Visio drawing window for the current session. Read/write.
EnableAutoConnect | Determines whether the AutoConnect feature is enabled in the Microsoft Visio user interface (UI). Read/write.
EnableFormulaAutoComplete | Indicates whether ShapeSheet formula AutoComplete is enabled. Read/write.
EnterCommitsText | Returns or sets a Boolean that determines whether pressing Enter commits shape text (True) or writes a new line (False, the default). Read/write.
FreeformDrawingPrecision | Determines the margin of error allowed when the Freeform tool is drawing a straight line before it switches to drawing a spline. Read/write.
FreeformDrawingSmoothing | Determines how precisely mouse movements are smoothed when drawing a spline. Read/write.
KanaFindAndReplace | Gets whether additional options specific to Japanese in the Find and Replace dialog boxes are available. Read-only.
KashidaTextUI | Gets the current setting for display of Kashida text-justification in certain cursive languages. Read-only.
ObjectType | Returns an object's type. Read-only.
RasterExportBackgroundColor | Determines the background color that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, JPG, PNG, or TIFF file. Read/write.
RasterExportColorFormat | Determines the color format that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, JPG, PNG, or TIFF file. Read/write.
RasterExportColorReduction | Determines the color reduction that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, PNG, or TIFF file. Read/write.
RasterExportDataCompression | Determines the data compression algorithm that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP or TIFF file. Read/write.
RasterExportDataFormat | Determines whether the exported raster image is interlaced or non-interlaced when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a GIF or PNG file. Read/write.
RasterExportFlip | Determines the flip that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, JPG, PNG, or TIFF file. Read/write.
RasterExportOperation | Determines the export operation that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a JPG file. Read/write.
RasterExportQuality | Determines the export quality that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a JPG file. Read/write.
RasterExportRotation | Determines the rotation that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, JPG, PNG, or TIFF file. Read/write.
RasterExportTransparencyColor | Determines the transparency color that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a GIF or PNG file. Read/write.
RasterExportUseTransparencyColor | Determines whether Microsoft Visio applies, to the exported image, the transparency color that is specified in the RasterExportTransparencyColor property when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a GIF or PNG file. Read/write.
RecentFilesListSize | Determines the number of entries in the Recent Documents list in the Microsoft Visio user interface. Read/write.
RecentFoldersListSize |
SATextUI | Gets the current setting for display of South Asian languages. Read-only.
ShowChooseDrawingTypePane | Determines if the New tab appears when the user opens Microsoft Visio. Read/write.
ShowFileOpenWarnings | Determines if warning messages appear when the user attempts to open files in XML format that contain errors, such as invalid XML code. Read/write.
ShowFileSaveWarnings | Determines if warning messages appear when the user attempts to save in XML format drawings that contain errors, such as invalid XML code. Read/write.
ShowMoreShapeHandlesOnHover | Gets or sets whether to show additional shape handles when the mouse is paused over a shape. Read/write.
ShowShapeSearchPane | Gets or sets whether the Shape Search pane is visible in the Microsoft Visio user interface (UI). Read/write.
ShowSmartTags | Determines whether display of smart tags in Microsoft Visio is enabled. Read/write.
SnapStrengthExtensionsX | Specifies the distance in pixels along the x-axis that shape extension lines pull when snapping is enabled. Read/Write.
SnapStrengthExtensionsY | Specifies the distance in pixels along the y-axis that shape extension lines pull when snapping is enabled. Read/write.
SnapStrengthGeometryX | Specifies the distance in pixels along the x-axis that shape geometry pulls when snapping is enabled. Read/write.
SnapStrengthGeometryY | Specifies the distance in pixels along the y-axis that shape geometry pulls when snapping is enabled. Read/write.
SnapStrengthGridX | Specifies the distance in pixels along the x-axis that gridlines pull when snapping is enabled. Read/write.
SnapStrengthGridY | Specifies the distance in pixels along the y-axis that gridlines pull when snapping is enabled. Read/write.
SnapStrengthGuidesX | Specifies the distance in pixels along the x-axis that guides pull when snapping is enabled. Read/write.
SnapStrengthGuidesY | Specifies the distance in pixels along the y-axis that guides pull when snapping is enabled. Read/write.
SnapStrengthPointsX | Specifies the distance in pixels along the x-axis that points pull when snapping is enabled. Read/write.
SnapStrengthPointsY | Specifies the distance in pixels along the y-axis that points pull when snapping is enabled. Read/write.
SnapStrengthRulerX | Specifies the distance in pixels along the x-axis that rulers pull when snapping is enabled. Read/write.
SnapStrengthRulerY | Specifies the distance in pixels along the y-axis that rulers pull when snapping is enabled. Read/write.
Stat | Returns status information for an object. Read-only.
StencilBackgroundColor | Determines the background color of the Microsoft Visio stencil window for the current session. Read/write.
StencilBackgroundColorGradient | Determines the background gradient color of the Microsoft Visio stencil window for the current session. Read/write.
StencilCharactersPerLine | For shapes on stencils, determines approximately how many characters of each shape's name appear on each line before the text wraps to the next line. Read/write.
StencilLinesPerMaster | For shapes on stencils in Microsoft Visio, determines how many lines of text of each shape's name can appear below the shape before the text is truncated and "..." is appended. Read/write.
StencilTextColor | Determines the color of text in stencil windows in Microsoft Visio for the current session. Read/write.
SVGExportFormat | Returns or sets a VisSVGExportFormat constant that specifies the options for saving a Microsoft Visio file in SVG format. Read/write.
TransitionsEnabled | Determines whether Microsoft Visio uses an animated transition to show certain shape movements, such as re-layout of shapes. Read/write.
UndoLevels | Determines the number of consecutive actions the user can undo in Microsoft Visio. Read/write.
UseLocalUserInfo |
UserInitials | Determines the user initials associated with the Microsoft Visio file. Read/write.
UserName | Gets or sets the user name of an Application object. Read/write.
ZoomOnRoll | Determines whether zooming in to and out from a Microsoft Visio drawing by rolling the wheel of the mouse is enabled. Read/write.


ApplicationSettings Properties (Visio)

 Copy code hover
[image]

ApplicationSettings Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ApplyBackgroundToDocument | Determines whether the selected background or border is applied to all pages in the document (True) or only to the current page (False). Read/write.
ApplyThemesOnShapeAdd | Gets or sets whether to apply themes to new shapes when they are added to the drawing page. Read/write.
AsianTextUI | Gets whether Asian text is displayed in the Microsoft Visio user interface. Read-only.
BIDITextUI | Gets the current setting for display of right-to-left languages. Read-only.
CenterSelectionOnZoom | Determines whether when the user zooms in, the selection appears in the center of the window. Read/write.
ComplexTextUI | Gets whether complex text is displayed in the Microsoft Visio user interface. Read-only.
ConnectorSplittingEnabled | Determines whether connector splitting is enabled in Microsoft Visio. Read/write.
DefaultSaveFormat | Determines the default format for saving Microsoft Visio files. Read/write.
DeleteConnectorsEnabled | Determines whether connectors are deleted when a shape to which they are connected is deleted. Read/write.
DeveloperMode | Determines if certain user interface functions for the development environment in Microsoft Visio are enabled. Read/write.
DrawingAids | Determines whether drawing aids are currently active in Microsoft Visio. Read/write.
DrawingBackgroundColor | Determines the background color of the Microsoft Visio drawing window for the current session. Read/write.
DrawingBackgroundColorGradient | Determines the background gradient color of the Microsoft Visio drawing window for the current session. Read/write.
DrawingPageColor | Determines the page color of the Microsoft Visio drawing window for the current session. Read/write.
EnableAutoConnect | Determines whether the AutoConnect feature is enabled in the Microsoft Visio user interface (UI). Read/write.
EnableFormulaAutoComplete | Indicates whether ShapeSheet formula AutoComplete is enabled. Read/write.
EnterCommitsText | Returns or sets a Boolean that determines whether pressing Enter commits shape text (True) or writes a new line (False, the default). Read/write.
FreeformDrawingPrecision | Determines the margin of error allowed when the Freeform tool is drawing a straight line before it switches to drawing a spline. Read/write.
FreeformDrawingSmoothing | Determines how precisely mouse movements are smoothed when drawing a spline. Read/write.
KanaFindAndReplace | Gets whether additional options specific to Japanese in the Find and Replace dialog boxes are available. Read-only.
KashidaTextUI | Gets the current setting for display of Kashida text-justification in certain cursive languages. Read-only.
ObjectType | Returns an object's type. Read-only.
RasterExportBackgroundColor | Determines the background color that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, JPG, PNG, or TIFF file. Read/write.
RasterExportColorFormat | Determines the color format that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, JPG, PNG, or TIFF file. Read/write.
RasterExportColorReduction | Determines the color reduction that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, PNG, or TIFF file. Read/write.
RasterExportDataCompression | Determines the data compression algorithm that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP or TIFF file. Read/write.
RasterExportDataFormat | Determines whether the exported raster image is interlaced or non-interlaced when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a GIF or PNG file. Read/write.
RasterExportFlip | Determines the flip that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, JPG, PNG, or TIFF file. Read/write.
RasterExportOperation | Determines the export operation that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a JPG file. Read/write.
RasterExportQuality | Determines the export quality that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a JPG file. Read/write.
RasterExportRotation | Determines the rotation that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, JPG, PNG, or TIFF file. Read/write.
RasterExportTransparencyColor | Determines the transparency color that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a GIF or PNG file. Read/write.
RasterExportUseTransparencyColor | Determines whether Microsoft Visio applies, to the exported image, the transparency color that is specified in the RasterExportTransparencyColor property when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a GIF or PNG file. Read/write.
RecentFilesListSize | Determines the number of entries in the Recent Documents list in the Microsoft Visio user interface. Read/write.
RecentFoldersListSize |
SATextUI | Gets the current setting for display of South Asian languages. Read-only.
ShowChooseDrawingTypePane | Determines if the New tab appears when the user opens Microsoft Visio. Read/write.
ShowFileOpenWarnings | Determines if warning messages appear when the user attempts to open files in XML format that contain errors, such as invalid XML code. Read/write.
ShowFileSaveWarnings | Determines if warning messages appear when the user attempts to save in XML format drawings that contain errors, such as invalid XML code. Read/write.
ShowMoreShapeHandlesOnHover | Gets or sets whether to show additional shape handles when the mouse is paused over a shape. Read/write.
ShowShapeSearchPane | Gets or sets whether the Shape Search pane is visible in the Microsoft Visio user interface (UI). Read/write.
ShowSmartTags | Determines whether display of smart tags in Microsoft Visio is enabled. Read/write.
SnapStrengthExtensionsX | Specifies the distance in pixels along the x-axis that shape extension lines pull when snapping is enabled. Read/Write.
SnapStrengthExtensionsY | Specifies the distance in pixels along the y-axis that shape extension lines pull when snapping is enabled. Read/write.
SnapStrengthGeometryX | Specifies the distance in pixels along the x-axis that shape geometry pulls when snapping is enabled. Read/write.
SnapStrengthGeometryY | Specifies the distance in pixels along the y-axis that shape geometry pulls when snapping is enabled. Read/write.
SnapStrengthGridX | Specifies the distance in pixels along the x-axis that gridlines pull when snapping is enabled. Read/write.
SnapStrengthGridY | Specifies the distance in pixels along the y-axis that gridlines pull when snapping is enabled. Read/write.
SnapStrengthGuidesX | Specifies the distance in pixels along the x-axis that guides pull when snapping is enabled. Read/write.
SnapStrengthGuidesY | Specifies the distance in pixels along the y-axis that guides pull when snapping is enabled. Read/write.
SnapStrengthPointsX | Specifies the distance in pixels along the x-axis that points pull when snapping is enabled. Read/write.
SnapStrengthPointsY | Specifies the distance in pixels along the y-axis that points pull when snapping is enabled. Read/write.
SnapStrengthRulerX | Specifies the distance in pixels along the x-axis that rulers pull when snapping is enabled. Read/write.
SnapStrengthRulerY | Specifies the distance in pixels along the y-axis that rulers pull when snapping is enabled. Read/write.
Stat | Returns status information for an object. Read-only.
StencilBackgroundColor | Determines the background color of the Microsoft Visio stencil window for the current session. Read/write.
StencilBackgroundColorGradient | Determines the background gradient color of the Microsoft Visio stencil window for the current session. Read/write.
StencilCharactersPerLine | For shapes on stencils, determines approximately how many characters of each shape's name appear on each line before the text wraps to the next line. Read/write.
StencilLinesPerMaster | For shapes on stencils in Microsoft Visio, determines how many lines of text of each shape's name can appear below the shape before the text is truncated and "..." is appended. Read/write.
StencilTextColor | Determines the color of text in stencil windows in Microsoft Visio for the current session. Read/write.
SVGExportFormat | Returns or sets a VisSVGExportFormat constant that specifies the options for saving a Microsoft Visio file in SVG format. Read/write.
TransitionsEnabled | Determines whether Microsoft Visio uses an animated transition to show certain shape movements, such as re-layout of shapes. Read/write.
UndoLevels | Determines the number of consecutive actions the user can undo in Microsoft Visio. Read/write.
UseLocalUserInfo |
UserInitials | Determines the user initials associated with the Microsoft Visio file. Read/write.
UserName | Gets or sets the user name of an Application object. Read/write.
ZoomOnRoll | Determines whether zooming in to and out from a Microsoft Visio drawing by rolling the wheel of the mouse is enabled. Read/write.


ApplicationSettings.Application Property (Visio)

 Copy code hover
[image]

ApplicationSettings.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents an ApplicationSettings object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


ApplicationSettings.ApplyBackgroundToDocument Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ApplyBackgroundToDocument Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the selected background or border is applied to all pages in the document (True) or only to the current page (False). Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .ApplyBackgroundToDocument

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

The value of the ApplyBackgroundToDocument property corresponds to the Apply to All Pages or Apply to Current Page commands that appear when the user right-clicks items in the Backgrounds or Borders & Titles gallery on the Design tab.


ApplicationSettings.ApplyThemesOnShapeAdd Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ApplyThemesOnShapeAdd Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets whether to apply themes to new shapes when they are added to the drawing page. Read/write.

Version Information

Version Added: Visio 2007

Syntax

expression .ApplyThemesOnShapeAdd

expression An expression that returns a ApplicationSettings object.

Return Value

Boolean

Remarks

The setting of the ApplyThemesOnShapeAdd property corresponds to the setting of the Apply Theme to New Shapes checkbox in the Themes gallery on the Design tab in the Microsoft Visio user interface.


ApplicationSettings.AsianTextUI Property (Visio)

 Copy code hover
[image]

ApplicationSettings.AsianTextUI Property (Visio)
Send feedback

Published: July 16, 2012

Gets whether Asian text is displayed in the Microsoft Visio user interface. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .AsianTextUI

expression An expression that returns a ApplicationSettings object.

Return Value

VisRegionalUIOptions

Remarks

The following VisRegionalUIOptions constants, which are declared in the Visio type libary, show the possible values for the AsianTextUI property.

Constant | Value | Description
visRegionalUIOptionsHide | 0 | Always hides regional UI.
visRegionalUIOptionsShow | 1 | Always shows regional UI.

You can change language settings in the Microsoft Office Language Preferences dialog box. (Click Start, point to All Programs, point to Microsoft Office, point to Microsoft Office Tools, and then click Microsoft Office Language Preferences.


ApplicationSettings.BIDITextUI Property (Visio)

 Copy code hover
[image]

ApplicationSettings.BIDITextUI Property (Visio)
Send feedback

Published: July 16, 2012

Gets the current setting for display of right-to-left languages. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .BIDITextUI

expression An expression that returns a ApplicationSettings object.

Return Value

VisRegionalUIOptions

Remarks

The following VisRegionalUIOptions constants, which are declared in the Visio type libary, show the possible values for the BIDITextUI property.

Constant | Value | Description
visRegionalUIOptionsHide | 0 | Always hides regional UI.
visRegionalUIOptionsShow | 1 | Always shows regional UI

The setting of the BIDITextUI property corresponds to the regional options setting in the Microsoft Office Language Preferences dialog box. (Click Start, point to All Programs, point to Microsoft Office, point to Microsoft Office Tools, and then click Microsoft Office Language Preferences.

The setting of the BIDITextUI property influences the setting of the ApplicationSettings.ComplexTextUI property. If BIDITextUI is set to visRegionalUIOptionsShow, ComplexTextUI is set to that value as well.


ApplicationSettings.CenterSelectionOnZoom Property (Visio)

 Copy code hover
[image]

ApplicationSettings.CenterSelectionOnZoom Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether when the user zooms in, the selection appears in the center of the window. Read/write.

Syntax

expression .CenterSelectionOnZoom

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

Setting the CenterSelectionOnZoom property is equivalent to selecting Center selection on zoom under Editing options on the Advanced tab in the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.ComplexTextUI Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ComplexTextUI Property (Visio)
Send feedback

Published: July 16, 2012

Gets whether complex text is displayed in the Microsoft Visio user interface. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ComplexTextUI

expression A variable that represents an ApplicationSettings object.

Return Value

VisRegionalUIOptions

Remarks

The following VisRegionalUIOptions constants, which are declared in the Visio type libary, show the possible values for the ComplexTextUI property.

Constant | Value | Description
visRegionalUIOptionsHide | 0 | Always hides regional UI.
visRegionalUIOptionsShow | 1 | Always shows regional UI.

The setting of ComplexTextUI is dependent on the settings of three other properties of the ApplicationSettings object: ApplicationSettings.BIDITextUI, ApplicationSettings.KashidaTextUI, and ApplicationSettings.SATextUI . If any of these properties is set to visRegionalUIOptionsShow, ComplexTextUI is set to that value as well.

You can determine current language settings by getting the value of the Application.LanguageSettings property. Or, you can change language settings in the Microsoft Office Language Prefernces dialog box. (Click Start, point to All Programs, point to Microsoft Office, point to Microsoft Office Tools, and then click Microsoft Office Language Preferences.


ApplicationSettings.ConnectorSplittingEnabled Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ConnectorSplittingEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether connector splitting is enabled in Microsoft Visio. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .ConnectorSplittingEnabled

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

Setting the ConnectorSplittingEnabled property is equivalent to selecting Enable connector splitting under Editing options on the Advanced tab in the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.DefaultSaveFormat Property (Visio)

 Copy code hover
[image]

ApplicationSettings.DefaultSaveFormat Property (Visio)
Send feedback

Published: July 16, 2012

Determines the default format for saving Microsoft Visio files. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .DefaultSaveFormat

expression A variable that represents an ApplicationSettings object.

Return Value

VisDefaultSaveFormats

Remarks

Setting the DefaultSaveFormat property is equivalent to setting the Save files in this format option on the Save tab in the Visio Options dialog box (click the File tab, click Options, and then click Save).

Note Note

The DefaultSaveFormat property setting has no effect on the file type in which Visio files are saved by the Save or SaveAs methods of the Document object. To control the file type in which a document is saved programatically, use the Version property of the Document object.

The following VisDefaultSaveFormats constants, which are declared in the Visio type libary, show the possible values for the DefaultSaveFormat property.

Constant | Value | Description
visDefaultSaveCurrentBinary | 0 | Binary format for current version of Visio.
visDefaultSaveCurrentXML | 2 | XML format for current version of Visio.
visDefaultSavePreviousBinary | 1 | Binary format for previous version of Visio.


ApplicationSettings.DeleteConnectorsEnabled Property (Visio)

 Copy code hover
[image]

ApplicationSettings.DeleteConnectorsEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether connectors are deleted when a shape to which they are connected is deleted. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .DeleteConnectorsEnabled

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

The setting of the DeleteConnectorsEnabled property also determines whether two connectors reconnect when a shape to which they are both connected is deleted.

Connectors that contain text are not deleted when shapes to which they are connected are deleted, even if DeleteConnectorsEnabled is True.

The setting of the DeleteConnectorsEnabled property corresponds to the setting of the Delete connectors when deleting shapes check box under Editing options on the Advanced tab of the Visio Options dialog box. To open the Visio Options dialog box, click the File tab, click Options, and then click Advanced.


ApplicationSettings.DeveloperMode Property (Visio)

 Copy code hover
[image]

ApplicationSettings.DeveloperMode Property (Visio)
Send feedback

Published: July 16, 2012

Determines if certain user interface functions for the development environment in Microsoft Visio are enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .DeveloperMode

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

Setting the DeveloperMode property to True is equivalent to selecting the Run in developer mode check box under General on the Advanced tab in the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.DrawingAids Property (Visio)

 Copy code hover
[image]

ApplicationSettings.DrawingAids Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether drawing aids are currently active in Microsoft Visio. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawingAids

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

Setting the DrawingAids property to True is equivalent to selecting Drawing aidson the General tab of the Snap & Glue dialog box (click the Visual Aids arrow on the View tab).


ApplicationSettings.DrawingBackgroundColor Property (Visio)

 Copy code hover
[image]

ApplicationSettings.DrawingBackgroundColor Property (Visio)
Send feedback

Published: July 16, 2012

Determines the background color of the Microsoft Visio drawing window for the current session. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawingBackgroundColor

expression A variable that represents an ApplicationSettings object.

Return Value

OLE_COLOR

Remarks

Valid values for an OLE_COLOR property within Visio can be one of the following:

  • &H00bbggrr, where bb is the blue value between 0 and 0xFF (255), gg the green value, and rr the red value.

  • &H800000xx, where xx is a valid GetSysColor index.

For details about the GetSysColor function, search for "GetSysColor" in the Microsoft Platform SDK on MSDN.

The OLE_COLOR data type is used for properties that return colors. When a property is declared as OLE_COLOR, the Properties window displays a color-picker dialog box that allows the user to select the color for the property visually, rather than having to remember the numeric equivalent.

In addition, you can use the following Microsoft Visual Basic for Applications (VBA) color constants for OLE_COLOR.

Constant | Value | Description
vbBlack | 0x0 | Black
vbRed | 0xFF | Red
vbGreen | 0xFF00 | Green
vbYellow | 0xFFFF | Yellow
vbBlue | 0xFF0000 | Blue
vbMagenta | 0xFF00FF | Magenta
vbCyan | 0xFFFF00 | Cyan
vbWhite | 0xFFFFFF | White

Setting the BackgroundColor property of the active window to a value other than the default (-1) overrides the DrawingBackgroundColor setting for that window. To be able to reset the background color of the same active window by setting the DrawingBackgroundColor property, you must reset BackgroundColor to its default value, -1. If multiple windows are open, setting BackgroundColor for one window has no effect on the setting for other open windows.

Note Note

The ability to set drawing background color programmatically for users running in high-contrast mode is restricted.

Example

The following VBA macro shows how to use the DrawingBackgroundColor property to get and set the application background color. It also shows how to get an ApplicationSettings object from the Visio Application object, and it demonstrates the relationship between the DrawingBackgroundColor property and the Window.BackgroundColor property. This example assumes there is a drawing window open in Visio and that initially all background color properties are set to their default values.

VBA Copy code Copy code
Public Sub DrawingBackgroundColor_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Set vsoApplicationSettings = Visio.Application.Settings

 'Get the current application background color.
 Debug.Print vsoApplicationSettings.DrawingBackgroundColor

 'Get the active window background color.
 Debug.Print ActiveWindow.BackgroundColor

 'Change the application background color.
 'This will also change the active window color as
 'well as the setting in the Color Settings dialog box
 vsoApplicationSettings.DrawingBackgroundColor = vbRed

 'Change the active window background color.
 ActiveWindow.BackgroundColor = vbMagenta

 'Change the application background color again.
 'This time, there is no change in the current
 'window color, but the dialog box setting changes.
 vsoApplicationSettings.DrawingBackgroundColor = vbYellow

 'Reset Window.BackgroundColor to its default value.
 ActiveWindow.BackgroundColor = -1

 'Change the application background color again.
 'Now both the active window color
 'and the dialog box setting change.
 vsoApplicationSettings.DrawingBackgroundColor = vbBlue

End Sub


ApplicationSettings.DrawingBackgroundColorGradient Property (Visio)

 Copy code hover
[image]

ApplicationSettings.DrawingBackgroundColorGradient Property (Visio)
Send feedback

Published: July 16, 2012

Determines the background gradient color of the Microsoft Visio drawing window for the current session. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawingBackgroundColorGradient

expression A variable that represents an ApplicationSettings object.

Return Value

OLE_COLOR

Remarks

Valid values for an OLE_COLOR property within Visio can be one of the following:

  • &H00bbggrr, where bb is the blue value between 0 and 0xFF (255), gg the green value, and rr the red value.

  • &H800000xx, where xx is a valid GetSysColor index.

For details about the GetSysColor function, search for "GetSysColor" in the Microsoft Platform SDK on MSDN.

The OLE_COLOR data type is used for properties that return colors. When a property is declared as OLE_COLOR, the Properties window displays a color-picker dialog box that allows the user to select the color for the property visually, rather than having to remember the numeric equivalent.

In addition, you can use the following Microsoft Visual Basic for Applications (VBA) color constants for OLE_COLOR.

Constant | Value | Description
vbBlack | 0x0 | Black
vbRed | 0xFF | Red
vbGreen | 0xFF00 | Green
vbYellow | 0xFFFF | Yellow
vbBlue | 0xFF0000 | Blue
vbMagenta | 0xFF00FF | Magenta
vbCyan | 0xFFFF00 | Cyan
vbWhite | 0xFFFFFF | White

Setting the BackgroundColorGradient property of the active window to a value other than the default (-1) overrides the DrawingBackgroundColorGradient setting for that window. To be able to reset the background gradient color of the same active window by setting the DrawingBackgroundColorGradient property, you must reset BackgroundColorGradient to its default value, -1. If multiple windows are open, setting BackgroundColorGradient for one window has no effect on the setting for other open windows.

Note Note

You can specify two colors for the drawing background. If users' screen resolution is adequate, one of the colors will grade into the other from the top to the bottom of the screen. To be able to use this feature, users must set their monitors to display 32-bit color. The ability to set drawing background color programmatically for users running in high-contrast mode is restricted.

Example

The following VBA macro shows how to use the DrawingBackgroundColorGradient property to get and set the application background gradient color. It also shows how to get an ApplicationSettings object from the Visio Application object, and it demonstrates the relationship between the DrawingBackgroundColorGradient property and the Window.BackgroundColorGradient property. This example assumes there is a drawing window open in Visio and that initially all background gradient color properties are set to their default values.

VBA Copy code Copy code
Public Sub DrawingBackgroundColorGradient_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Set vsoApplicationSettings = Visio.Application.Settings

 'Get the current application background gradient color.
 Debug.Print vsoApplicationSettings.DrawingBackgroundColorGradient

 'Get the active window background color gradient.
 Debug.Print ActiveWindow.BackgroundColorGradient

 'Change the application background gradient color.
 'This also changes the active window color as
 'well as the setting in the Color Settings dialog box.
 vsoApplicationSettings.DrawingBackgroundColor = vbRed

 'Change the active window background gradient color.
 ActiveWindow.BackgroundColorGradient = vbMagenta

 'Change the application background gradient color again.
 'This time, there is no change in the current
 'window color, but the dialog box setting changes.
 vsoApplicationSettings.DrawingBackgroundColorGradient = vbYellow

 'Reset Window.BackgroundColorGradient to its default value.
 ActiveWindow.BackgroundColorGradient = -1

 'Change the application background gradient color again.
 'Now both the active window color
 'and the dialog box setting change.
 vsoApplicationSettings.DrawingBackgroundColorGradient = vbBlue

End Sub


ApplicationSettings.DrawingPageColor Property (Visio)

 Copy code hover
[image]

ApplicationSettings.DrawingPageColor Property (Visio)
Send feedback

Published: July 16, 2012

Determines the page color of the Microsoft Visio drawing window for the current session. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawingPageColor

expression A variable that represents an ApplicationSettings object.

Return Value

OLE_COLOR

Remarks

Valid values for an OLE_COLOR property within Visio can be one of the following:

  • &H00bbggrr, where bb is the blue value between 0 and 0xFF (255), gg the green value, and rr the red value.

  • &H800000xx, where xx is a valid GetSysColor index.

For details about the GetSysColor function, search for "GetSysColor" in the Microsoft Platform SDK on MSDN.

The OLE_COLOR data type is used for properties that return colors. When a property is declared as OLE_COLOR, the Properties window displays a color-picker dialog box that allows the user to select the color for the property visually, rather than having to remember the numeric equivalent.

In addition, you can use the following Microsoft Visual Basic for Applications (VBA) color constants for OLE_COLOR.

Constant | Value | Description
vbBlack | 0x0 | Black
vbRed | 0xFF | Red
vbGreen | 0xFF00 | Green
vbYellow | 0xFFFF | Yellow
vbBlue | 0xFF0000 | Blue
vbMagenta | 0xFF00FF | Magenta
vbCyan | 0xFFFF00 | Cyan
vbWhite | 0xFFFFFF | White


ApplicationSettings.EnableAutoConnect Property (Visio)

 Copy code hover
[image]

ApplicationSettings.EnableAutoConnect Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the AutoConnect feature is enabled in the Microsoft Visio user interface (UI). Read/write.

Version Information

Version Added: Visio 2007

Syntax

expression .EnableAutoConnect

expression An expression that returns a ApplicationSettings object.

Return Value

Boolean

Remarks

The EnableAutoConnect property lets you disable programmtically the Visio AutoConnect feature, which is on by default. The setting of the EnableAutoConnect property corresponds to the Enable AutoConnect setting on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.EnableFormulaAutoComplete Property (Visio)

 Copy code hover
[image]

ApplicationSettings.EnableFormulaAutoComplete Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether ShapeSheet formula AutoComplete is enabled. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .EnableFormulaAutoComplete

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

The setting of the EnableFormulaAutoComplete property corresponds to the setting of the ShapeSheet formula AutoComplete check box under Editing options on the Advanced tab of the Visio Options dialog box. To open the Visio Options dialog box, click the File tab, click Options, and then click Advanced.


ApplicationSettings.EnterCommitsText Property (Visio)

 Copy code hover
[image]

ApplicationSettings.EnterCommitsText Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that determines whether pressing Enter commits shape text (True) or writes a new line (False, the default). Read/write.

Syntax

expression .EnterCommitsText

expression A variable that represents a ApplicationSettings object.

Property value

BOOL

See also

Other resources

ApplicationSettings Object
ApplicationSettings Members


ApplicationSettings.FreeformDrawingPrecision Property (Visio)

 Copy code hover
[image]

ApplicationSettings.FreeformDrawingPrecision Property (Visio)
Send feedback

Published: July 16, 2012

Determines the margin of error allowed when the Freeform tool is drawing a straight line before it switches to drawing a spline. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .FreeformDrawingPrecision

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the FreeformDrawingPrecision property is equivalent to setting the Precision option on the Advanced tab in the Visio Options dialog box (click the File tab, and then click Options).

Possible values for the FreeformDrawingPrecision property range from 0 (Tight) to 10 (Loose). The default is 5.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the FreeformDrawingPrecision property to print the current freeform drawing precision setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub FreeformDrawingPrecision_Example()

    Dim vsoApplicationSettings As Visio.ApplicationSettings
    Dim lngPrecisionSetting As Long

    Set vsoApplicationSettings = Visio.Application.Settings
    lngPrecisionSetting = vsoApplicationSettings.FreeformDrawingPrecision

    Debug.Print lngPrecisionSetting

End Sub


ApplicationSettings.FreeformDrawingSmoothing Property (Visio)

 Copy code hover
[image]

ApplicationSettings.FreeformDrawingSmoothing Property (Visio)
Send feedback

Published: July 16, 2012

Determines how precisely mouse movements are smoothed when drawing a spline. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .FreeformDrawingSmoothing

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the FreeformDrawingSmoothing property is equivalent to setting the Smoothing option on the Advanced tab in the Visio Options dialog box (click the File tab, and then click Options).

Possible values for the FreeformDrawingSmoothing property range from 0 (Tight) to 10 (Loose). The default is 5.


ApplicationSettings.KanaFindAndReplace Property (Visio)

 Copy code hover
[image]

ApplicationSettings.KanaFindAndReplace Property (Visio)
Send feedback

Published: July 16, 2012

Gets whether additional options specific to Japanese in the Find and Replace dialog boxes are available. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .KanaFindAndReplace

expression A variable that represents an ApplicationSettings object.

Return Value

VisRegionalUIOptions

Remarks

The following VisRegionalUIOptions constants, which are declared in the Visio type libary, show the possible values for the KanaFindAndReplace property.

Constant | Value | Description
visRegionalUIOptionsHide | 0 | Always hides regional UI.
visRegionalUIOptionsShow | 1 | Always shows regional UI.

Note Note

In Microsoft Office Visio 2003, the KanaFindAndReplace property was read/write, and the property setting corresponded to an option on the Regional tab of the Options dialog box. In Microsoft Office Visio 2007, you can determine current language settings by getting the value of the Application.LanguageSettings property. Or, you can change language settings in the Microsoft Office Language Settings 2007 dialog box. (Click Start, point to All Programs, point to Microsoft Office, point to Microsoft Office Tools, and then click Microsoft Office 2007 Language Settings.


ApplicationSettings.KashidaTextUI Property (Visio)

 Copy code hover
[image]

ApplicationSettings.KashidaTextUI Property (Visio)
Send feedback

Published: July 16, 2012

Gets the current setting for display of Kashida text-justification in certain cursive languages. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .KashidaTextUI

expression An expression that returns a ApplicationSettings object.

Return Value

VisRegionalUIOptions

Remarks

The following VisRegionalUIOptions constants, which are declared in the Visio type libary, show the possible values for the KashidaTextUI property.

Constant | Value | Description
visRegionalUIOptionsHide | 0 | Always hides regional UI.
visRegionalUIOptionsShow | 1 | Always shows regional UI

The setting of the KashidaTextUI property corresponds to the regional options setting in the Microsoft Office Language Settings 2007 dialog box. (Click Start, point to All Programs, point to Microsoft Office, point to Microsoft Office Tools, and then click Microsoft Office 2007 Language Settings.

The setting of the KashidaTextUI property influences the setting of the ApplicationSettings.ComplexTextUI property. If KashidaTextUI is set to visRegionalUIOptionsShow, ComplexTextUI is set to that value as well.


ApplicationSettings.ObjectType Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents an ApplicationSettings object.

Return Value

VisObjectTypes

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


ApplicationSettings.RasterExportBackgroundColor Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportBackgroundColor Property (Visio)
Send feedback

Published: July 16, 2012

Determines the background color that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, JPG, PNG, or TIFF file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportBackgroundColor

expression An expression that returns an ApplicationSettings object.

Return Value

OLE_COLOR

Remarks

The value of the RasterExportBackgroundColor property must be a valid OLE_COLOR color. The default setting for a given session of Microsoft Visio is RGB(255, 255,255), which means that Visio applies a white background color on export.

For any session of Visio, when the RasterExportBackgroundColor property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportBackgroundColor property corresponds to the background color selected in the BMP Output Options, GIF Output Options, JPG Output Options, PNG Output Options, or TIFF Output Options dialog box. (Click the File tab, click Save As, in the Save as type list, select Windows Bitmap (*.bmp; *.dib), Graphics Interchange Format (*.gif), JPEG File Interchange Format (*.jpg), Portable Network Graphics (*.png), or Tag Image File Format (*.tif), and then click Save.)


ApplicationSettings.RasterExportColorFormat Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportColorFormat Property (Visio)
Send feedback

Published: July 16, 2012

Determines the color format that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, JPG, PNG, or TIFF file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportColorFormat

expression An expression that returns an ApplicationSettings object.

Return Value

VisRasterExportColorFormat

Remarks

The value of the RasterExportColorFormat property must be one of the following VisRasterExportColorFormat constants.

Constant | Value | Description | Applicable File Formats
visRasterBiLevel | 0 | Bi-level color format | BMP, PNG, TIFF
visRaster16Color | 1 | 16-color format | BMP, PNG, TIFF
visRaster256Color | 2 | 256-color format | BMP, PNG, TIFF
visRaster24Bit | 3 | 24-bit color format; the default for PNG, TIFF, and BMP | BMP, PNG, TIFF
visRasterRGB | 4 | RGB color format; the default for JPG | JPG
visRasterYCC | 5 | YCC color format | JPG
visRasterGrayScale | 6 | Grayscale color format | JPG
visRasterCMYK | 7 | CMYK color format | JPG
visRaster16ColorGrayScale | 8 | 16-color grayscale color format | TIFF
visRaster256ColorGrayScale | 9 | 256-color grayscale color format | TIFF
visRaster16Bit | 10 | 16-bit color format | BMP

For any given session of Microsoft Visio, when the RasterExportColorFormat property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportColorFormat property corresponds to the Color format setting in the BMP Output Options, JPG Output Options, PNG Output Options, or TIFF Output Options dialog box. (Click the File tab, click Save As, in the Save as type list, select Windows Bitmap (*.bmp; *.dib), JPEG File Interchange Format (*.jpg), Portable Network Graphics (*.png), or Tag Image File Format (*.tif), and then click Save.)


ApplicationSettings.RasterExportColorReduction Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportColorReduction Property (Visio)
Send feedback

Published: July 16, 2012

Determines the color reduction that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, PNG, or TIFF file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportColorReduction

expression An expression that returns an ApplicationSettings object.

Return Value

VisRasterExportColorReduction

Remarks

When you apply color reduction, you reduce the number of colors present in an image in order to make the resulting file smaller in size.

The value of the RasterExportColorReduction property can be one of the following VisRasterExportColorReduction constants.

Constant | Value | Description
visRasterAdaptive | 0 | Adaptive color reduction; the default for GIF files
visRasterDiffusion | 1 | Diffusion color reduction
visRasterHalftone | 2 | Halftone color reduction

For BMP, PNG, and TIFF files, the default is no color reduction.

For any given session of Microsoft Visio, when the RasterExportColorReduction property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportColorReduction property corresponds to the Color reduction setting in the BMP Output Options, GIF Output Options, PNG Output Options, or TIFF Output Options dialog box. (Click the File tab, click Save As, in the Save as type list, select Windows Bitmap (*.bmp; *.dib), Graphics Interchange Format (*.gif), Portable Network Graphics (*.png), or Tag Image File Format (*.tif), and then click Save.)


ApplicationSettings.RasterExportDataCompression Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportDataCompression Property (Visio)
Send feedback

Published: July 16, 2012

Determines the data compression algorithm that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP or TIFF file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportDataCompression

expression An expression that returns an ApplicationSettings object.

Return Value

VisRasterExportDataCompression

Remarks

The value of the RasterExportDataCompression property must be one of the following VisRasterExportDataCompression constants.

Constant | Value | Description | Applicable File Format
visRasterNone | 0 | No compression, the default for BMP. | BMP
visRasterRLE | 1 | RLE compression. | BMP
visRasterGroup3 | 2 | Group 3 compression. | TIFF
visRasterPackbits | 3 | Packbits compression. | TIFF
visRasterGroup4 | 4 | Group 4 compression. | TIFF
visRasterLZW | 5 | LZW compression. | TIFF
visRasterModifiedHuffman | 6 | Modified Huffman compression. | TIFF

For any given session of Microsoft Visio, when the RasterExportDataCompression property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportDataCompression property corresponds to the Data compression setting in the BMP Output Options or TIFF Output Options dialog box. (Click the File tab, click Save As, in the Save as type list, select Windows Bitmap (*.bmp; *.dib) or Tag Image File Format (*.tif), and then click Save.)


ApplicationSettings.RasterExportDataFormat Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportDataFormat Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the exported raster image is interlaced or non-interlaced when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a GIF or PNG file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportDataFormat

expression An expression that returns an ApplicationSettings object.

Return Value

VisRasterExportDataFormat

Remarks

The value of the RasterExportDataFormat property must be one of the following VisRasterExportDataFormat constants.

Constant | Value | Description
visRasterInterlace | 0 | Interlace format, the default.
visRasterNonInterlace | 1 | Non-interlace format.

For any given session of Microsoft Visio, when the RasterExportDataFormat property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportDataFormat property corresponds to the Data format setting in the GIF Output Options or PNG Output Options dialog box. (Click the File tab, click Save As, in the Save as type list, select Graphics Interchange Format (*.gif) or Portable Network Graphics (*.png), and then click Save.)


ApplicationSettings.RasterExportFlip Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportFlip Property (Visio)
Send feedback

Published: July 16, 2012

Determines the flip that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, JPG, PNG, or TIFF file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportFlip

expression An expression that returns an ApplicationSettings object.

Return Value

VisRasterExportFlip

Remarks

The value of the RasterExportFlip property must be either visRasterNoFlip or some combination (one, the other, or the sum of both) of the remaining two of the following VisRasterExportFlip constants.

Constant | Value | Description
visRasterNoFlip | 0 | No flip, the default.
visRasterFlipHorizontal | 1 | Flip horizontally.
visRasterFlipVertical | 2 | Flip vertically.

For any given session of Microsoft Visio, when the RasterExportFlip property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportFlip property corresponds to the flip selected in the BMP Output Options, GIF Output Options, JPG Output Options, PNG Output Options, or TIFF Output Options dialog box. (Click the File tab, click Save As, in the Save as type list, select Windows Bitmap (*.bmp; *.dib), Graphics Interchange Format (*.gif), JPEG File Interchange Format (*.jpg), Portable Network Graphics (*.png), or Tag Image File Format (*.tif), and then click Save.)


ApplicationSettings.RasterExportOperation Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportOperation Property (Visio)
Send feedback

Published: July 16, 2012

Determines the export operation that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a JPG file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportOperation

expression An expression that returns an ApplicationSettings object.

Return Value

VisRasterExportOperation

Remarks

The value of the RasterExportOperation property must be one of the following VisRasterExportOperation constants.

Constant | Value | Description
visRasterBaseline | 0 | Baseline operation, the default.
visRasterProgressive | 1 | Progressive operation.

For any given session of Microsoft Visio, when the RasterExportOperation property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportOperation property corresponds to the Operation setting in the JPG Output Options dialog box in the Microsoft Visio user interface. (Click the File tab, click Save As, in the Save as type list, select JPEG File Interchange Format (*.jpg), and then click Save.)


ApplicationSettings.RasterExportQuality Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportQuality Property (Visio)
Send feedback

Published: July 16, 2012

Determines the export quality that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a JPG file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportQuality

expression An expression that returns an ApplicationSettings object.

Return Value

Long

Remarks

The default setting of the RasterExportQuality property is 75%. The range of values is between 0% and 100%. Set the property value to a Long that corresponds to the quality percentage that you want.

For any given session of Microsoft Visio, when the RasterExportQuality property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportQuality property corresponds to the Quality setting in the JPG Output Options dialog box in the Microsoft Visio user interface. (Click the File tab, click Save As, in the Save as type list, select JPEG File Interchange Format (*.jpg), and then click Save.)


ApplicationSettings.RasterExportRotation Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportRotation Property (Visio)
Send feedback

Published: July 16, 2012

Determines the rotation that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a BMP, GIF, JPG, PNG, or TIFF file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportRotation

expression An expression that returns an ApplicationSettings object.

Return Value

VisRasterExportRotation

Remarks

The value of the RasterExportRotation property must be one of the following VisRasterExportRotation constants.

Constant | Value | Description
visRasterNoRotation | 0 | No rotation, the default.
visRasterRotateLeft | 1 | Rotate left.
visRasterRotateRight | 2 | Rotate right.

For any given session of Microsoft Visio, when the RasterExportRotation property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportRotation property corresponds to the style of rotation selected in the Rotation list in the Output Options dialog box for the corresponding file type in the Microsoft Visio user interface. (Click the File tab, click Save As, in the Save as type list, select the file type, and then click Save.)


ApplicationSettings.RasterExportTransparencyColor Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportTransparencyColor Property (Visio)
Send feedback

Published: July 16, 2012

Determines the transparency color that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a GIF or PNG file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportTransparencyColor

expression An expression that returns an ApplicationSettings object.

Return Value

OLE_COLOR

Remarks

Microsoft Visio ignores this setting if RasterExportUseTransparencyColor is False.

The value of the RasterExportTransparencyColor property must be a valid OLE_COLOR color. The default is RGB(255,255,255), which means that Visio applies a white transparency color on export.

For any given session of Microsoft Visio, when the RasterExportTransparencyColor property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportTransparencyColor property corresponds to the transparency color selected in the GIF Output Options or PNG Output Options dialog box. (Click the File tab, click Save As, in the Save as type list, select Graphics Interchange Format (*.gif) or Portable Network Graphics (*.png), and then click Save.)


ApplicationSettings.RasterExportUseTransparencyColor Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RasterExportUseTransparencyColor Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio applies, to the exported image, the transparency color that is specified in the RasterExportTransparencyColor property when you call the Export method of the Master, Page, Selection, or Shape object to export the specified object to a GIF or PNG file. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RasterExportUseTransparencyColor

expression An expression that returns an ApplicationSettings object.

Return Value

Boolean

Remarks

The default is False, which means that Microsoft Visio does not apply the transparency color to the page on export.

For any given session of Microsoft Visio, when the RasterExportUseTransparencyColor property value is set, either programmatically or in the user interface, the setting then becomes the new default for the remainder of the session. However, it is not persisted to the next session.

The setting of the RasterExportUseTransparencyColor property corresponds to whether the Transparency color box in the GIF Output Options or the PNG Output Options dialog box is selected. (Click the File tab, click Save As, in the Save as type list, select Graphics Interchange Format (*.gif) or Portable Network Graphics (*.png), and then click Save.)


ApplicationSettings.RecentFilesListSize Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RecentFilesListSize Property (Visio)
Send feedback

Published: July 16, 2012

Determines the number of entries in the Recent Documents list in the Microsoft Visio user interface. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .RecentFilesListSize

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the RecentFilesListSize property is equivalent to setting the Show this number of Recent Documents box under Display on the Advanced tab of the Visio Options dialog box (click the File tab, click Options, and then click Advanced). the maximum setting is 12.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the RecentFilesListSize property to print the current size of the recently used file list in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub RecentFilesListSize_Example()

    Dim vsoApplicationSettings As Visio.ApplicationSettings
    Dim lngListSize As Long

    Set vsoApplicationSettings = Visio.Application.Settings
    lngListSize = vsoApplicationSettings.RecentFilesListSize

    Debug.Print lngListSize

End Sub


ApplicationSettings.RecentTemplatesListSize Property (Visio)

 Copy code hover
[image]

ApplicationSettings.RecentTemplatesListSize Property (Visio)
Send feedback

Published: July 16, 2012

Determines the number of entries in the Recent Templates list in the Microsoft Visio user interface. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RecentTemplatesListSize

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

The value of the RecentTemplatesListSize property corresponds to the setting of the Show this number of Recent Templates box under Display on the Advanced tab of the Visio Options dialog box. To open the Visio Options dialog box, click the File tab, click Options, and then click Advanced. The maximum number of recently used templates that can be displayed is 12.

Example

The following Visual Basic for Applications (VBA) macro shows how to use the RecentTemplatesListSize property to print the current size of the recently used template list in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub RecentTemplatesListSize_Example()

    Dim vsoApplicationSettings As Visio.ApplicationSettings
    Dim lngListSize As Long

    Set vsoApplicationSettings = Visio.Application.Settings
    lngListSize = vsoApplicationSettings.RecentTemplatesListSize

    Debug.Print lngListSize

End Sub


ApplicationSettings.SATextUI Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SATextUI Property (Visio)
Send feedback

Published: July 16, 2012

Gets the current setting for display of South Asian languages. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .SATextUI

expression An expression that returns a ApplicationSettings object.

Return Value

VisRegionalUIOptions

Remarks

The following VisRegionalUIOptions constants, which are declared in the Visio type libary, show the possible values for the SATextUI property.

Constant | Value | Description
visRegionalUIOptionsHide | 0 | Always hides regional UI.
visRegionalUIOptionsShow | 1 | Always shows regional UI

The setting of the SATextUI property corresponds to the regional options setting in the Microsoft Office Language Preferences dialog box. (Click Start, point to All Programs, point to Microsoft Office, point to Microsoft Office Tools, and then click Microsoft Office Language Preferences).

The setting of the SATextUI property influences the setting of the ApplicationSettings.ComplexTextUI property. If SATextUI is set to visRegionalUIOptionsShow, ComplexTextUI is set to that value as well.


ApplicationSettings.ShowChooseDrawingTypePane Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ShowChooseDrawingTypePane Property (Visio)
Send feedback

Published: July 16, 2012

Determines if the New tab appears when the user opens Microsoft Visio. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .ShowChooseDrawingTypePane

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

Setting the ShowChooseDrawingTypePane property is equivalent to setting the Show New screen on launch option on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.ShowFileOpenWarnings Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ShowFileOpenWarnings Property (Visio)
Send feedback

Published: July 16, 2012

Determines if warning messages appear when the user attempts to open files in XML format that contain errors, such as invalid XML code. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .ShowFileOpenWarnings

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

Setting the ShowFileOpenWarnings property is equivalent to setting the Show file open warnings option on the Advanced tab in the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.ShowFileSaveWarnings Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ShowFileSaveWarnings Property (Visio)
Send feedback

Published: July 16, 2012

Determines if warning messages appear when the user attempts to save in XML format drawings that contain errors, such as invalid XML code. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .ShowFileSaveWarnings

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

Setting the ShowFileSaveWarnings property is equivalent to setting the Show file save warnings option on the Advanced tab in the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.ShowMoreShapeHandlesOnHover Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ShowMoreShapeHandlesOnHover Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets whether to show additional shape handles when the mouse is paused over a shape. Read/write.

Version Information

Version Added: Visio 2007

Syntax

expression .ShowMoreShapeHandlesOnHover

expression An expression that returns an ApplicationSettings object.

Return Value

Boolean

Remarks

The setting of the ShowMoreShapeHandlesOnHover property corresponds to the setting of the Show more shape handles on hover checkbox on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options) in the Microsoft Visio user interface.


ApplicationSettings.ShowShapeSearchPane Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ShowShapeSearchPane Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets whether the Shape Search pane is visible in the Microsoft Visio user interface (UI). Read/write.

Version Information

Version Added: Visio 2007

Syntax

expression .ShowShapeSearchPane

expression An expression that returns an ApplicationSettings object.

Return Value

Boolean

Remarks

The setting of the ShowShapeSearchPage property corresponds to the setting of the Show Shape Search pane checkbox under Shape search on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.ShowSmartTags Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ShowSmartTags Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether display of smart tags in Microsoft Visio is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .ShowSmartTags

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

Setting the ShowSmartTags property is equivalent to setting the Smart Tags option under Show on the Advanced tab in the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.SnapStrengthExtensionsX Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthExtensionsX Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the x-axis that shape extension lines pull when snapping is enabled. Read/Write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthExtensionsX

expression A variable that represents a ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthExtensionsX property is equivalent to setting the Extensions option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthExtensionsX property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 13.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthExtensionsX property to print the current snap strength extensions x-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthExtensionsX_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthExtensionsX

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthExtensionsY Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthExtensionsY Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the y-axis that shape extension lines pull when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthExtensionsY

expression A variable that represents a ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthExtensionsY property is equivalent to setting the Extensions option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthExtensionsY property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 13.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthExtensionsY property to print the current snap strength extensions y-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthExtensionsY_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthExtensionsY

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthGeometryX Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthGeometryX Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the x-axis that shape geometry pulls when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthGeometryX

expression A variable that represents a ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthGeometryX property is equivalent to setting the Geometry option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthGeometryX property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 8.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthGeometryX property to print the current snap strength geometry x-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthGeometryX_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthGeometryX

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthGeometryY Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthGeometryY Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the y-axis that shape geometry pulls when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthGeometryY

expression A variable that represents a ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthGeometryY property is equivalent to setting the Geometry option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthGeometryY property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 8.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthGeometryY property to print the current snap strength geometry y-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthGeometryY_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthGeometryY

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthGridX Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthGridX Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the x-axis that gridlines pull when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthGridX

expression A variable that represents a ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthGridX property is equivalent to setting the Grid option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthGridX property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 5.

Example

ThisMicrosoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthGridX property to print the current snap strength grid x-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthGridX_Example()

    Dim vsoApplicationSettings As Visio.ApplicationSettings
    Dim lngSnapStrength As Long

    Set vsoApplicationSettings = Visio.Application.Settings
    lngSnapStrength = vsoApplicationSettings.SnapStrengthGridX

    Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthGridY Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthGridY Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the y-axis that gridlines pull when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthGridY

expression A variable that represents a ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthGridY property is equivalent to setting the Grid option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthGridY property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 5.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthGridY property to print the current snap strength grid y-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthGridY_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthGridY

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthGuidesX Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthGuidesX Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the x-axis that guides pull when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthGuidesX

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthGuidesX property is equivalent to setting the Guides option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthGuidesX property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 10.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthGuidesX property to print the current snap strength guides x-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthGuidesX_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthGuidesX

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthGuidesY Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthGuidesY Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the y-axis that guides pull when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthGuidesY

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthGuidesY property is equivalent to setting the Guides option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthGuidesY property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 10.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthGuidesY property to print the current snap strength guides y-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthGuidesY_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthGuidesY

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthPointsX Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthPointsX Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the x-axis that points pull when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthPointsX

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthPointsX property is equivalent to setting the Points option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthPointsX property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 10.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthPointsX property to print the current snap strength points x-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthPointsX_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthPointsX

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthPointsY Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthPointsY Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the y-axis that points pull when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthPointsY

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthPointsY property is equivalent to setting the Points option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthPointsY property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 10.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthPointsY property to print the current snap strength points y-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthPointsY_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthPointsY

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthRulerX Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthRulerX Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the x-axis that rulers pull when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthRulerX

expression A variable that represents a ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthRulerX property is equivalent to setting the Rulers option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthRulerX property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 4.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthRulerX property to print the current snap strength ruler x-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthRulerX_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthRulerX

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.SnapStrengthRulerY Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SnapStrengthRulerY Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the distance in pixels along the y-axis that rulers pull when snapping is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SnapStrengthRulerY

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the SnapStrengthRulerY property is equivalent to setting the Rulers option under Snap strength on the Advanced tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab). Setting snap strength in the UI sets both x and y values to the same value.

The minimum allowable value for the SnapStrengthRulerY property is 0 (zero), and the maximum is 999. Attempting to set a value outside that range returns an error. The default value is 4.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SnapStrengthRulerY property to print the current snap strength ruler y-axis setting in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub SnapStrengthRulerY_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Dim lngSnapStrength As Long

 Set vsoApplicationSettings = Visio.Application.Settings
 lngSnapStrength = vsoApplicationSettings.SnapStrengthRulerY

 Debug.Print lngSnapStrength

End Sub


ApplicationSettings.Stat Property (Visio)

 Copy code hover
[image]

ApplicationSettings.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .Stat

expression A variable that represents an ApplicationSettings object.

Return Value

Integer

Remarks

Possible values returned by the Stat property are declared by the Visio type library in VisStatCodes.

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


ApplicationSettings.StencilBackgroundColor Property (Visio)

 Copy code hover
[image]

ApplicationSettings.StencilBackgroundColor Property (Visio)
Send feedback

Published: July 16, 2012

Determines the background color of the Microsoft Visio stencil window for the current session. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .StencilBackgroundColor

expression A variable that represents an ApplicationSettings object.

Return Value

OLE_COLOR

Remarks

The StencilBackgroundColorGradient property setting does not persist from one session of Visio to the next.

Valid values for an OLE_COLOR property within Visio can be one of the following:

  • &H00bbggrr, where bb is the blue value between 0 and 0xFF (255), gg the green value, and rr the red value.

  • &H800000xx, where xx is a valid GetSysColor index.

For details about the GetSysColor function, search for "GetSysColor" in the Microsoft Platform SDK on MSDN.

The OLE_COLOR data type is used for properties that return colors. When a property is declared as OLE_COLOR, the Properties window displays a color-picker dialog box that allows the user to select the color for the property visually, rather than having to remember the numeric equivalent.

In addition, you can use the following Microsoft Visual Basic for Applications (VBA) color constants for OLE_COLOR.

Constant | Value | Description
vbBlack | 0x0 | Black
vbRed | 0xFF | Red
vbGreen | 0xFF00 | Green
vbYellow | 0xFFFF | Yellow
vbBlue | 0xFF0000 | Blue
vbMagenta | 0xFF00FF | Magenta
vbCyan | 0xFFFF00 | Cyan
vbWhite | 0xFFFFFF | White

You can set the background color for an individual stencil window by using the ActiveWindow.Windows(n).BackgroundColor property, where n represents the index number of the stencil window in the Windows collection. When a stencil window is opened as a floating window, it can be an active window, and you can set its background color by using the ActiveWindow.BackgroundColor property. If you have opened a stencil window in this manner, setting the BackgroundColor property of this stencil window to a value other than the default (-1) overrides the StencilBackgroundColor setting for that window. To reset the background color of the same active stencil window by setting the StencilBackgroundColor property, you must reset BackgroundColor to its default value, -1. If multiple stencil windows of this type are open, setting BackgroundColor for one window has no effect on the setting for other open windows.

Note Note

You can specify two colors for the stencil background. If users' screen resolution is adequate, one of the colors will grade into the other from the top to the bottom of the screen. To be able to use this feature, users must set their monitors to display 32-bit color. The ability to set stencil background color programmatically for users running in high-contrast mode is restricted.


ApplicationSettings.StencilBackgroundColorGradient Property (Visio)

 Copy code hover
[image]

ApplicationSettings.StencilBackgroundColorGradient Property (Visio)
Send feedback

Published: July 16, 2012

Determines the background gradient color of the Microsoft Visio stencil window for the current session. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .StencilBackgroundColorGradient

expression A variable that represents an ApplicationSettings object.

Return Value

OLE_COLOR

Remarks

The StencilBackgroundColorGradient property setting does not persist from one session of Visio to the next.

Valid values for an OLE_COLOR property within Visio can be one of the following:

  • &H00bbggrr, where bb is the blue value between 0 and 0xFF (255), gg the green value, and rr the red value.

  • &H800000xx, where xx is a valid GetSysColor index.

For details about the GetSysColor function, search for "GetSysColor" in the Microsoft Platform SDK on MSDN.

The OLE_COLOR data type is used for properties that return colors. When a property is declared as OLE_COLOR, the Properties window displays a color-picker dialog box that allows the user to select the color for the property visually, rather than having to remember the numeric equivalent.

In addition, you can use the following Microsoft Visual Basic for Applications (VBA) color constants for OLE_COLOR.

Constant | Value | Description
vbBlack | 0x0 | Black
vbRed | 0xFF | Red
vbGreen | 0xFF00 | Green
vbYellow | 0xFFFF | Yellow
vbBlue | 0xFF0000 | Blue
vbMagenta | 0xFF00FF | Magenta
vbCyan | 0xFFFF00 | Cyan
vbWhite | 0xFFFFFF | White

You can set the background gradient color for an individual stencil window by using the ActiveWindow.Windows(n).BackgroundColorGradient property, where n represents the index number of the stencil window in the Windows collection. When a stencil window is opened as a floating window, it can be an active window, and you can set its background gradient color by using the ActiveWindow.BackgroundColorGradient property. If you have opened a stencil window in this manner, setting the BackgroundColor property of the active stencil window to a value other than the default (-1) overrides the StencilBackgroundColorGradient setting for that window. To be able to reset the background gradient color of the same active stencil window by setting the StencilBackgroundColorGradient property, you must reset BackgroundColorGradient to its default value, -1. If multiple stencil windows of this type are open, setting BackgroundColorGradient for one window has no effect on the setting for other open windows.

Note Note

You can specify two colors for the stencil background. If users' screen resolution is adequate, one of the colors will grade into the other from the top to the bottom of the screen. To be able to use this feature, users must set their monitors to display 32-bit color. The ability to set stencil background color programmatically for users running in high-contrast mode is restricted.


ApplicationSettings.StencilCharactersPerLine Property (Visio)

 Copy code hover
[image]

ApplicationSettings.StencilCharactersPerLine Property (Visio)
Send feedback

Published: July 16, 2012

For shapes on stencils, determines approximately how many characters of each shape's name appear on each line before the text wraps to the next line. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .StencilCharactersPerLine

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the StencilCharactersPerLine property is equivalent to setting the Characters per line option under Stencil spacing on the Advanced tab in the Visio Options dialog box (click the File tab, and then click Options).

The minimum value for StencilCharactersPerLine is 5 characters per line and the maximum is 20. By default, Visio displays 12 characters per line.

This property affects the overall spacing of shapes on a stencil, which affects how many shapes the user can see without scrolling.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the StencilCharactersPerLine property to print the current number of stencil characters per line in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub StencilCharactersPerLine_Example()

    Dim vsoApplicationSettings As Visio.ApplicationSettings
    Dim lngCharsPerLine As Long

    Set vsoApplicationSettings = Visio.Application.Settings
    lngCharsPerLine = vsoApplicationSettings.StencilCharactersPerLine

    Debug.Print lngCharsPerLine

End Sub


ApplicationSettings.StencilLinesPerMaster Property (Visio)

 Copy code hover
[image]

ApplicationSettings.StencilLinesPerMaster Property (Visio)
Send feedback

Published: July 16, 2012

For shapes on stencils in Microsoft Visio, determines how many lines of text of each shape's name can appear below the shape before the text is truncated and "..." is appended. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .StencilLinesPerMaster

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the StencilLinesPerMaster property is equivalent to setting the Lines per master option under Stencil spacing on the Advanced tab in the Visio Options dialog box (click the File tab, and then click Options).

The minimum value for StencilLinesPerMaster is 1 line per master and the maximum is 4. By default, Visio displays 2 lines per master.

This property affects the overall spacing of shapes on a stencil, which affects how many shapes users can see without scrolling.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the StencilCharactersPerLine property to print the current number of stencil lines per master in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub StencilLinesPerMaster_Example()

    Dim vsoApplicationSettings As Visio.ApplicationSettings
    Dim lngLinesPerMaster As Long

    Set vsoApplicationSettings = Visio.Application.Settings
    lngLinesPerMaster = vsoApplicationSettings.StencilLinesPerMaster

    Debug.Print lngLinesPerMaster

End Sub


ApplicationSettings.StencilTextColor Property (Visio)

 Copy code hover
[image]

ApplicationSettings.StencilTextColor Property (Visio)
Send feedback

Published: July 16, 2012

Determines the color of text in stencil windows in Microsoft Visio for the current session. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .StencilTextColor

expression A variable that represents a ApplicationSettings object.

Return Value

OLE_COLOR

Remarks

The StencilTextColor property setting does not persist from one session of Visio to the next.

Valid values for an OLE_COLOR property within Visio can be one of the following:

  • &H00bbggrr, where bb is the blue value between 0 and 0xFF (255), gg the green value, and rr the red value.

  • &H800000xx, where xx is a valid GetSysColor index.

For details about the GetSysColor function, search for "GetSysColor" in the Microsoft Platform SDK on MSDN.

The OLE_COLOR data type is used for properties that return colors. When a property is declared as OLE_COLOR, the Properties window displays a color-picker dialog box that allows the user to select the color for the property visually, rather than having to remember the numeric equivalent.

In addition, you can use the following Microsoft Visual Basic for Applications (VBA) color constants for OLE_COLOR.

Constant | Value | Description
vbBlack | 0x0 | Black
vbRed | 0xFF | Red
vbGreen | 0xFF00 | Green
vbYellow | 0xFFFF | Yellow
vbBlue | 0xFF0000 | Blue
vbMagenta | 0xFF00FF | Magenta
vbCyan | 0xFFFF00 | Cyan
vbWhite | 0xFFFFFF | White


ApplicationSettings.SVGExportFormat Property (Visio)

 Copy code hover
[image]

ApplicationSettings.SVGExportFormat Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns or sets a VisSVGExportFormat constant that specifies the options for saving a Microsoft Visio file in SVG format. Read/write.

Syntax

expression .SVGExportFormat

expression A variable that represents a ApplicationSettings object.

Remarks

The value of this property determines whether the resulting SVG file includes both SVG and Visio elements (0, the default), or SVG elements only (1).

Property value

VISSVGEXPORTFORMAT

See also

Concepts

ApplicationSettings Object

Other resources

ApplicationSettings Members


ApplicationSettings.TransitionsEnabled Property (Visio)

 Copy code hover
[image]

ApplicationSettings.TransitionsEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio uses an animated transition to show certain shape movements, such as re-layout of shapes. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .TransitionsEnabled

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

The TransitionsEnabled property setting also determines whether changes of view (for example, those initiated in the Pan & Zoom window) are animated.

The setting of the TransitionsEnabled property corresponds to the setting of the Enable transitions check box under Editing options on the Advanced tab of the Visio Options dialog box. To open the Visio Options dialog box, click the File tab, click Options, and then click Advanced.


ApplicationSettings.UndoLevels Property (Visio)

 Copy code hover
[image]

ApplicationSettings.UndoLevels Property (Visio)
Send feedback

Published: July 16, 2012

Determines the number of consecutive actions the user can undo in Microsoft Visio. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .UndoLevels

expression A variable that represents an ApplicationSettings object.

Return Value

Long

Remarks

Setting the UndoLevels property is equivalent to setting the Undo levels option on the General tab in the Visio Options dialog box (click the File tab, and then click Options).

The minimum possible value for UndoLevels is 0 (zero); the maximum is 99. The default value is 20.

The higher the value of UndoLevels, the more memory is required to store the actions.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the UndoLevels property to print the current number of undo levels in the Immediate window. It also shows how to get an ApplicationSettings object from the Visio Application object.

VBA Copy code Copy code
Public Sub UndoLevels_Example()

    Dim vsoApplicationSettings As Visio.ApplicationSettings
    Dim lngUndoLevels As Long

    Set vsoApplicationSettings = Visio.Application.Settings
    lngUndoLevels = vsoApplicationSettings.UndoLevels

    Debug.Print lngUndoLevels

End Sub


ApplicationSettings.UserInitials Property (Visio)

 Copy code hover
[image]

ApplicationSettings.UserInitials Property (Visio)
Send feedback

Published: July 16, 2012

Determines the user initials associated with the Microsoft Visio file. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .UserInitials

expression A variable that represents an ApplicationSettings object.

Return Value

String

Remarks

Setting the UserInitials property is equivalent to setting the Initials option on the General tab of the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.UserName Property (Visio)

 Copy code hover
[image]

ApplicationSettings.UserName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the user name of an Application object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .UserName

expression A variable that represents an ApplicationSettings object.

Return Value

String

Remarks

Setting the UserName property is equivalent to entering a name in the Name box on the General tab in the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings.ZoomOnRoll Property (Visio)

 Copy code hover
[image]

ApplicationSettings.ZoomOnRoll Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether zooming in to and out from a Microsoft Visio drawing by rolling the wheel of the mouse is enabled. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .ZoomOnRoll

expression A variable that represents an ApplicationSettings object.

Return Value

Boolean

Remarks

Setting the ZoomOnRoll property is equivalent to setting the Zoom on roll with Intellimouse option on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).


ApplicationSettings Methods (Visio)

 Copy code hover
[image]

ApplicationSettings Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
GetRasterExportResolution | Returns the raster export resolution settings.
GetRasterExportSize | Gets the raster export size.
SetRasterExportResolution | Specifies the raster export resolution settings.
SetRasterExportSize | Sets the raster export size.


ApplicationSettings.GetRasterExportResolution Method (Visio)

 Copy code hover
[image]

ApplicationSettings.GetRasterExportResolution Method (Visio)
Send feedback

Published: July 16, 2012

Returns the raster export resolution settings.

Version Information

Version Added: Visio 2010

Syntax

expression .GetRasterExportResolution(pResolution, pWidth, pHeight, pResolutionUnits)

expression An expression that returns an ApplicationSettings object.

Parameters

Name | Required/Optional | Data Type | Description
pResolution | Required | VisRasterExportResolution | Out parameter. The raster export resolution. See Remarks for possible values.
pWidth | Required | Double | Out parameter. The raster export resolution width.
pHeight | Required | Double | Out parameter. The raster export resolution height.
pResolutionUnits | Required | VisRasterExportResolutionUnits | Out parameter. The units used to specify resolution. See Remarks for possible values.
pResolution | Required | VISRASTEREXPORTRESOLUTION |
pWidth | Required | DOUBLE |
pHeight | Required | DOUBLE |
pResolutionUnits | Required | VISRASTEREXPORTRESOLUTIONUNITS |

Return Value

Nothing

Remarks

The pResolution parameter must be one of the following VisRasterExportResolution constants.

Constant | Value | Description
visRasterUseScreenResolution | 0 | Use screen resolution.
visRasterUsePrinterResolution | 1 | Use printer resolution.
visRasterUseSourceResolution | 2 | Use source resolution.
visRasterUseCustomResolution | 3 | Use custom resolution.

If pResolution is a constant other than visRasterUseCustomResolution, GetRasterExportResolution returns null for all other parameters. If pResolution is visRasterUseCustomResolution, GetRasterExportResolution returns non-null values for all parameters.

The pResolutionUnits parameter must be one of the following VisRasterExportResolutionUnits constants.

Constant | Value | Description
visRasterPixelsPerInch | 0 | Pixels per inch.
visRasterPixelsPerCm | 1 | Pixels per centimeter.


ApplicationSettings.GetRasterExportSize Method (Visio)

 Copy code hover
[image]

ApplicationSettings.GetRasterExportSize Method (Visio)
Send feedback

Published: July 16, 2012

Gets the raster export size.

Version Information

Version Added: Visio 2010

Syntax

expression .GetRasterExportSize(pSize, pWidth, pHeight, pSizeUnits)

expression An expression that returns an ApplicationSettings object.

Parameters

Name | Required/Optional | Data Type | Description
pSize | Required | VisRasterExportSize | Out parameter. The raster export size. See Remarks for possible values.
pWidth | Required | Double | Out parameter. The raster export size width.
pHeight | Required | Double | Out parameter. The raster export size height.
pSizeUnits | Required | VisRasterExportSizeUnits | Out parameter. The units used to specify size. See Remarks for possible values.
pSize | Required | VISRASTEREXPORTSIZE |
pWidth | Required | DOUBLE |
pHeight | Required | DOUBLE |
pSizeUnits | Required | VISRASTEREXPORTSIZEUNITS |

Return Value

Nothing

Remarks

The pSize parameter must be one of the following VisRasterExportSize constants.

Constant | Value | Description
visRasterFitToScreenSize | 0 | Use screen size.
visRasterFitToPrinterSize | 1 | Use printer size.
visRasterFitToSourceSize | 2 | Use source size.
visRasterFitToCustomSize | 3 | Use custom size.

If pSize is a constant other than visRasterFitToCustomSize, GetRasterExportSize returns null for all other parameters. If pSize is visRasterFitToCustomSize, GetRasterExportSize returns non-null values for all parameters.

The pSizeUnits parameter must be one of the following VisRasterExportSizeUnits constants.

Constant | Value | Description
visRasterPixel | 0 | Pixels
visRasterCm | 1 | Centimeters
visRasterInch | 2 | Inches


ApplicationSettings.SetRasterExportResolution Method (Visio)

 Copy code hover
[image]

ApplicationSettings.SetRasterExportResolution Method (Visio)
Send feedback

Published: July 16, 2012

Specifies the raster export resolution settings.

Version Information

Version Added: Visio 2010

Syntax

expression .SetRasterExportResolution(resolution, [Width], [Height], [resolutionUnits])

expression An expression that returns an ApplicationSettings object.

Parameters

Name | Required/Optional | Data Type | Description
resolution | Required | VisRasterExportResolution | The raster export resolution. See Remarks for possible values.
Width | Optional | Double | The raster export resolution width. Must be greater than or equal to 1.
Height | Optional | Double | The raster export resolution height. Must be greater than or equal to 1.
resolutionUnits | Optional | VisRasterExportResolutionUnits | The units used to specify resolution. See Remarks for possible values.
resolution | Required | VISRASTEREXPORTRESOLUTION |
Width | Optional | DOUBLE |
Height | Optional | DOUBLE |
resolutionUnits | Optional | VISRASTEREXPORTRESOLUTIONUNITS |

Return Value

Nothing

Remarks

The resolution parameter must be one of the following VisRasterExportResolution constants.

Constant | Value | Description
visRasterUseScreenResolution | 0 | Use screen resolution.
visRasterUsePrinterResolution | 1 | Use printer resolution.
visRasterUseSourceResolution | 2 | Use source resolution.
visRasterUseCustomResolution | 3 | Use custom resolution.

If resolution is a constant other than visRasterUseCustomResolution, SetRasterExportResolution ignores all other parameters.

If resolution is visRasterUseCustomResolution, SetRasterExportResolution accepts values for all parameters, if they meet the noted constraints. If they do not meet these constraints, SetRasterExportResolution returns an Invalid Parameter error.

The resolutionUnits parameter must be one of the following VisRasterExportResolutionUnits constants.

Constant | Value | Description
visRasterPixelsPerInch | 0 | Pixels per inch.
visRasterPixelsPerCm | 1 | Pixels per centimeter.

When the SetRasterExportResolution method runs successfully, the resulting settings will remain in effect until you either run the method again or change the settings in the user interface.


ApplicationSettings.SetRasterExportSize Method (Visio)

 Copy code hover
[image]

ApplicationSettings.SetRasterExportSize Method (Visio)
Send feedback

Published: July 16, 2012

Sets the raster export size.

Version Information

Version Added: Visio 2010

Syntax

expression .SetRasterExportSize(size, [Width], [Height], [sizeUnits])

expression An expression that returns an ApplicationSettings object.

Parameters

Name | Required/Optional | Data Type | Description
size | Required | VisRasterExportSize | The raster export size. See Remarks for possible values.
Width | Optional | Double | The raster export size width. Must be greater than or equal to 1.
Height | Optional | Double | The raster export size height. Must be greater than or equal to 1.
sizeUnits | Optional | VisRasterExportSizeUnits | The units used to specify size. See Remarks for possible values.
size | Required | VISRASTEREXPORTSIZE |
Width | Optional | DOUBLE |
Height | Optional | DOUBLE |
sizeUnits | Optional | VISRASTEREXPORTSIZEUNITS |

Return Value

Nothing

Remarks

The size parameter must be one of the following VisRasterExportSize constants.

Constant | Value | Description
visRasterFitToScreenSize | 0 | Use screen size.
visRasterFitToPrinterSize | 1 | Use printer size.
visRasterFitToSourceSize | 2 | Use source size.
visRasterFitToCustomSize | 3 | Use custom size.

If size is anything other than visRasterFitToCustomSize, SetRasterExportSize ignores all other parameters.

If size is visRasterFitToCustomSize, SetRasterExportSize accepts values for all parameters, if they meet the noted constraints. If they do not meet these constraints, SetRasterExportSize returns an Invalid Parameter error.

The sizeUnits parameter must be one of the following VisRasterExportSizeUnits constants.

Constant | Value | Description
visRasterPixel | 0 | Pixels
visRasterCm | 1 | Centimeters
visRasterInch | 2 | Inches

When the SetRasterExportSize method runs successfully, the resulting settings will remain in effect until you either run the method again or change the settings in the user interface.


Cell Object (Visio)

 Copy code hover
[image]

Cell Object (Visio)
Send feedback

Published: July 16, 2012

Holds a formula that evaluates to some value.

Version Information

Version Added: Visio 2.0

Remarks

The default property of a Cell object is ResultIU.

You can get or set a cell's formula or value. A cell belongs to a Shape, Style, or Row object and represents a property of the shape, style, or row. For example, the height of a shape equals the value of the shape's Height cell.

A program can control a shape's appearance and behavior by working with the formulas in the shape's cells. You can visually inspect most of a shape's cells by opening the shape's ShapeSheet window. Use the Cells or CellsSRC property of a Shape object to retrieve a Cell object. To retrieve a cell in a style, use the Cells property of a Style object.


Cell Members (Visio)

 Copy code hover
[image]

Cell Members (Visio)
Send feedback

Published: July 16, 2012

Holds a formula that evaluates to some value.

Events

Name | Description
CellChanged | Occurs after the value changes in a cell in a document.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.

Methods

Name | Description
GlueTo | Glues one shape to another, from a cell in the first shape to a cell in the second shape.
GlueToPos | Glues one shape to another from a cell in the first shape to an x,y position in the second shape.
Trigger | Evaluates the formula of a cell.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Column | Returns the column index of a cell. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
ContainingRow | Returns the row that contains a cell. Read-only.
Dependents | Returns an array of ShapeSheet cells that are dependent on a particular cell of a Microsoft Visio shape. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
Error | Gets the error code generated by the last evaluation of a cell's formula. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Formula | Gets or sets the formula for a Cell object. Read/write.
FormulaForce | Sets the formula in a Cell object, even if the formula is protected with a GUARD function. Read/write.
FormulaForceU | Sets the universal syntax formula in a Cell object, even if the formula is protected with a GUARD function. Read/write.
FormulaU | Gets or sets the universal syntax formula for a Cell object. Read/write.
InheritedFormulaSource | Returns the cell from which this cell inherited its formula. Read-only.
InheritedValueSource | Returns the cell from which this cell inherited its value. Read-only.
IsConstant | Determines whether a formula of the cell is a constant expression. Read-only.
IsInherited | Determines whether a formula of the cell is inherited from a master or a style. Read-only.
LocalName | Returns the local name of a cell. Read-only.
Name | Specifies the name of an object. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Precedents | Returns an array of ShapeSheet cells upon which the formula of another cell depends. Read-only.
Result | Gets or sets a cell's value. Read/write.
ResultForce | Sets a cell's value, even if the cell's formula is protected with the GUARD function. Read/write.
ResultFromInt | Sets the value of a cell to an integer value. Read/write.
ResultFromIntForce | Sets the value of a cell to an integer value, even if the cell's formula is protected with the GUARD function. Read/write.
ResultInt | Gets the value of a cell expressed as an integer. Read-only.
ResultIU | Gets or sets a cell's value in internal units. Read/write.
ResultIUForce | Sets a cell's value in internal units, even if the cell's formula is protected with the GUARD function. Read/write.
ResultStr | Gets the value of a ShapeSheet cell expressed as a string. Read-only.
ResultStrU | Gets the value of a ShapeSheet cell expressed as a universal string. Read-only.
Row | Returns the row index of a cell. Read-only.
RowName | Gets or sets the name of the row that contains the Cell object. Read/write.
RowNameU | Gets or sets the universal name of the row that contains the Cell object. Read/write.
Section | Returns the index of the cell's section. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.
Style | Gets the style that contains a Cell object. Read-only.
Units | Indicates the unit of measure associated with a Cell object. Read-only.


Cell Properties (Visio)

 Copy code hover
[image]

Cell Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Column | Returns the column index of a cell. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
ContainingRow | Returns the row that contains a cell. Read-only.
Dependents | Returns an array of ShapeSheet cells that are dependent on a particular cell of a Microsoft Visio shape. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
Error | Gets the error code generated by the last evaluation of a cell's formula. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Formula | Gets or sets the formula for a Cell object. Read/write.
FormulaForce | Sets the formula in a Cell object, even if the formula is protected with a GUARD function. Read/write.
FormulaForceU | Sets the universal syntax formula in a Cell object, even if the formula is protected with a GUARD function. Read/write.
FormulaU | Gets or sets the universal syntax formula for a Cell object. Read/write.
InheritedFormulaSource | Returns the cell from which this cell inherited its formula. Read-only.
InheritedValueSource | Returns the cell from which this cell inherited its value. Read-only.
IsConstant | Determines whether a formula of the cell is a constant expression. Read-only.
IsInherited | Determines whether a formula of the cell is inherited from a master or a style. Read-only.
LocalName | Returns the local name of a cell. Read-only.
Name | Specifies the name of an object. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Precedents | Returns an array of ShapeSheet cells upon which the formula of another cell depends. Read-only.
Result | Gets or sets a cell's value. Read/write.
ResultForce | Sets a cell's value, even if the cell's formula is protected with the GUARD function. Read/write.
ResultFromInt | Sets the value of a cell to an integer value. Read/write.
ResultFromIntForce | Sets the value of a cell to an integer value, even if the cell's formula is protected with the GUARD function. Read/write.
ResultInt | Gets the value of a cell expressed as an integer. Read-only.
ResultIU | Gets or sets a cell's value in internal units. Read/write.
ResultIUForce | Sets a cell's value in internal units, even if the cell's formula is protected with the GUARD function. Read/write.
ResultStr | Gets the value of a ShapeSheet cell expressed as a string. Read-only.
ResultStrU | Gets the value of a ShapeSheet cell expressed as a universal string. Read-only.
Row | Returns the row index of a cell. Read-only.
RowName | Gets or sets the name of the row that contains the Cell object. Read/write.
RowNameU | Gets or sets the universal name of the row that contains the Cell object. Read/write.
Section | Returns the index of the cell's section. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.
Style | Gets the style that contains a Cell object. Read-only.
Units | Indicates the unit of measure associated with a Cell object. Read-only.


Cell.Application Property (Visio)

 Copy code hover
[image]

Cell.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Cell object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Cell.Column Property (Visio)

 Copy code hover
[image]

Cell.Column Property (Visio)
Send feedback

Published: July 16, 2012

Returns the column index of a cell. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Column

expression A variable that represents a Cell object.

Return Value

Integer


Cell.ContainingMasterID Property (Visio)

 Copy code hover
[image]

Cell.ContainingMasterID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the Master object that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingMasterID

expression A variable that represents a Cell object.

Return Value

Long

Remarks

If the object is not in a Master object, the ContainingMasterID property returns -1. For example, if a Shape object belongs to the Shapes collection of a Page object, the ContainingMasterID property returns -1.


Cell.ContainingPageID Property (Visio)

 Copy code hover
[image]

Cell.ContainingPageID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the page that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingPageID

expression A variable that represents a Cell object.

Return Value

Long

Remarks

If the object is not in a Page object, the ContainingPageID property returns -1. For example, if a Shape object belongs to a Masters collection, the ContainingPageID property returns -1.


Cell.ContainingRow Property (Visio)

 Copy code hover
[image]

Cell.ContainingRow Property (Visio)
Send feedback

Published: July 16, 2012

Returns the row that contains a cell. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .ContainingRow

expression A variable that represents a Cell object.

Return Value

Row


Cell.Dependents Property (Visio)

 Copy code hover
[image]

Cell.Dependents Property (Visio)
Send feedback

Published: July 16, 2012

Returns an array of ShapeSheet cells that are dependent on a particular cell of a Microsoft Visio shape. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Dependents

expression An expression that returns a Cell object.

Return Value

Cell()

Remarks

The Dependents property returns an array of the cells that recalculate their values when the formula or value of the parent Cell object changes.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Dependents property to display a list of cells that are dependent on the Width cell of a rectangle shape.

VBA Copy code Copy code
Public Sub Dependents_Example()

 Dim acellDependentCells() As Visio.Cell
 Dim vsoCell As Visio.Cell
 Dim vsoShape As Visio.Shape
 Dim intCounter As Integer

 'Draw a rectangle on the active page.
 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)

 'Get the array of cells dependent on the Width cell of the shape
 acellDependentCells = vsoShape.Cells("Width").Dependents

 'List the cell names and their associated formulas
 For intCounter = LBound(acellDependentCells) To UBound(acellDependentCells)

 Set vsoCell = acellDependentCells(intCounter)
 Debug.Print vsoCell.Name & " has this formula: " & vsoCell.Formula

 Next

End Sub


Cell.Document Property (Visio)

 Copy code hover
[image]

Cell.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Cell object.

Return Value

Document


Cell.Error Property (Visio)

 Copy code hover
[image]

Cell.Error Property (Visio)
Send feedback

Published: July 16, 2012

Gets the error code generated by the last evaluation of a cell's formula. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Error

expression A variable that represents a Cell object.

Return Value

Integer

Remarks

When you evaluate a cell's formula, an error code is generated along with the result. The Error property allows you to access this error code. Constants for valid error codes are declared by the Microsoft Visio type library and begin with visError.


Cell.EventList Property (Visio)

 Copy code hover
[image]

Cell.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Cell object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Cell.Formula Property (Visio)

 Copy code hover
[image]

Cell.Formula Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the formula for a Cell object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Formula

expression A variable that represents a Cell object.

Return Value

String

Remarks

If a cell's formula is protected with the GUARD function, you must use the FormulaForce property to change the cell's formula.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Formula property to get a cell's formula string in local syntax or to use a mix of local and universal syntax to set it. Use the FormulaU property to get or parse a formula in universal syntax. When you use FormulaU, the decimal point is always ".", the delimiter is always ",", and you must use universal unit strings (for details on universal strings, see About Units of Measure).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Formula property to set the formula for a ShapeSheet cell. It draws a rectangle on a page and bows, or curves the lines of the rectangle by changing the shape's lines to arcs. Then it draws an inner rectangle within the bowed lines of the first rectangle.

VBA Copy code Copy code

Public Sub Formula_Example()

    Dim vsoPage As Visio.Page
    Dim vsoShape As Visio.Shape
    Dim vsoCell As Visio.Cell
    Dim strBowCell As String
    Dim strBowFormula As String
    Dim intIndex As Integer
    Dim intCounter As Integer

    'Set the value of the strBowCell string.
    strBowCell = "Scratch.X1"

    'Set the value of the strBowFormula string.
    strBowFormula = "=Min(Width, Height) / 5"

    Set vsoPage = ActivePage

    'If there isn't an active page, set vsoPage
    'to the first page of the active document.
    If vsoPage Is Nothing Then
    Set vsoPage = ActiveDocument.Pages(1)
    End If

    'Draw a rectangle on the active page.
    Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

    'Add a Scratch section to the shape's ShapeSheet.
    vsoShape.AddSection visSectionScratch

    'Add a row to the Scratch section.
    vsoShape.AddRow visSectionScratch, visRowScratch, 0

    'Set vsoCell to the Scratch.X1 cell and set its formula.
    Set vsoCell = vsoShape.Cells(strBowCell)
    vsoCell.Formula = strBowFormula

    'Bow in or curve the rectangle's lines by changing
    'each row type from LineTo to ArcTo and entering the bow value.
    For intCounter = 1 To 4
        vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
        Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
        vsoCell.Formula = "-" & strBowCell
    Next intCounter

    'Create an inner rectangle.
    'Set the section index for the inner rectangle's Geometry section.
    intIndex = visSectionFirstComponent + 1

    'Add an inner rectangle Geometry section.
    vsoShape.AddSection intIndex

    'Add the first 2 rows to the section.
    vsoShape.AddRow intIndex, visRowComponent, visTagComponent
    vsoShape.AddRow intIndex, visRowVertex, visTagMoveTo

    'Add 4 LineTo rows to the section.
    For intCounter = 1 To 4
        vsoShape.AddRow intIndex, visRowLast, visTagLineTo
    Next intCounter

    'Set the inner rectangle start point cell formulas.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 0)
    vsoCell.Formula = "Width * 0 + " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 1)
    vsoCell.Formula = "Height * 0 + " & strBowCell

    'Draw the inner rectangle bottom line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 0)
    vsoCell.Formula = "Width * 1 - " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 1)
    vsoCell.Formula = "Height * 0 + " & strBowCell

    'Draw the inner rectangle right side line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 0)
    vsoCell.Formula = "Width * 1 - " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 1)
    vsoCell.Formula = "Height * 1 - " & strBowCell

    'Draw the inner rectangle top line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 0)
    vsoCell.Formula = "Width * 0 + " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 1)
    vsoCell.Formula = "Height * 1 - " & strBowCell

    'Draw the inner rectangle left side line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 0)
    vsoCell.Formula = "Geometry2.X1"
    Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 1)
    vsoCell.Formula = "Geometry2.Y1"

End Sub


Cell.FormulaForce Property (Visio)

 Copy code hover
[image]

Cell.FormulaForce Property (Visio)
Send feedback

Published: July 16, 2012

Sets the formula in a Cell object, even if the formula is protected with a GUARD function. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .FormulaForce

expression A variable that represents a Cell object.

Return Value

String

Remarks

Many of the SmartShapes symbols provided with Microsoft Visio have guarded cells to maintain their smart behavior. When you change the formula in a guarded cell, the shape's behavior might change in unexpected ways.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the FormulaForce property when you want to use local syntax in the formula. Use the FormulaForceU property when you want to use universal syntax in the formula.


Cell.FormulaForceU Property (Visio)

 Copy code hover
[image]

Cell.FormulaForceU Property (Visio)
Send feedback

Published: July 16, 2012

Sets the universal syntax formula in a Cell object, even if the formula is protected with a GUARD function. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .FormulaForceU

expression A variable that represents a Cell object.

Return Value

String

Remarks

Many of the SmartShapes symbols provided with Microsoft Visio have guarded cells to maintain their smart behavior. When you change the formula in a guarded cell, the shape's behavior might change in unexpected ways.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the FormulaForce property when you want to use local syntax in the formula. Use the FormulaForceU property when you want to use universal syntax in the formula.


Cell.FormulaU Property (Visio)

 Copy code hover
[image]

Cell.FormulaU Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the universal syntax formula for a Cell object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .FormulaU expression .FormulaU = stringexpression

expression A variable that represents a Cell object. expression The new formula for the cell.

Return Value

String

Remarks

If a cell's formula is protected with the GUARD function, you must use the FormulaForceU property to change the cell's formula.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Formula property to get a cell's formula string in local syntax or to use a mix of local and universal syntax to set it. Use the FormulaU property to get or parse a formula in universal syntax. When you use FormulaU, the decimal point is always ".", the delimiter is always ",", and you must use universal unit strings (for details on universal strings, see About Units of Measure).

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVCell.FormulaU

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the FormulaU property to set the formula for a ShapeSheet cell. It draws a rectangle on a page and bows, or curves the lines of the rectangle by changing the shape's lines to arcs. Then it draws an inner rectangle within the bowed lines of the first rectangle.

VBA Copy code Copy code

Public Sub FormulaU_Example()

    Dim vsoPage As Visio.Page
    Dim vsoShape As Visio.Shape
    Dim vsoCell As Visio.Cell
    Dim strBowCell As String
    Dim strBowFormula As String
    Dim intIndex As Integer
    Dim intCounter As Integer

    'Set the value of the strBowCell string.
    strBowCell = "Scratch.X1"

    'Set the value of the strBowFormula string.
    strBowFormula = "=Min(Width, Height) / 5"

    Set vsoPage = ActivePage

    'If there isn't an active page, set vsoPage
    'to the first page of the active document.
    If vsoPage Is Nothing Then
    Set vsoPage = ActiveDocument.Pages(1)
    End If

    'Draw a rectangle on the active page.
    Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

    'Add a Scratch section to the shape's ShapeSheet.
    vsoShape.AddSection visSectionScratch

    'Add a row to the Scratch section.
    vsoShape.AddRow visSectionScratch, visRowScratch, 0

    'Set vsoCell to the Scratch.X1 cell and set its formula.
    Set vsoCell = vsoShape.Cells(strBowCell)
    vsoCell.FormulaU = strBowFormula

    'Bow in or curve the rectangle's lines by changing
    'each row type from LineTo to ArcTo and entering the bow value.
    For intCounter = 1 To 4
        vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
        Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
        vsoCell.FormulaU = "-" & strBowCell
    Next intCounter

    'Create an inner rectangle.
    'Set the section index for the inner rectangle's Geometry section.
    intIndex = visSectionFirstComponent + 1

    'Add an inner rectangle Geometry section.
    vsoShape.AddSection intIndex

    'Add the first 2 rows to the section.
    vsoShape.AddRow intIndex, visRowComponent, visTagComponent
    vsoShape.AddRow intIndex, visRowVertex, visTagMoveTo

    'Add 4 LineTo rows to the section.
    For intCounter = 1 To 4
        vsoShape.AddRow intIndex, visRowLast, visTagLineTo
    Next intCounter

    'Set the inner rectangle start point cell formulas.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 0)
    vsoCell.FormulaU = "Width * 0 + " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 1)
    vsoCell.FormulaU = "Height * 0 + " & strBowCell

    'Draw the inner rectangle bottom line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 0)
    vsoCell.FormulaU = "Width * 1 - " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 1)
    vsoCell.FormulaU = "Height * 0 + " & strBowCell

    'Draw the inner rectangle right side line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 0)
    vsoCell.FormulaU = "Width * 1 - " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 1)
    vsoCell.FormulaU = "Height * 1 - " & strBowCell

    'Draw the inner rectangle top line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 0)
    vsoCell.FormulaU = "Width * 0 + " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 1)
    vsoCell.FormulaU = "Height * 1 - " & strBowCell

    'Draw the inner rectangle left side line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 0)
    vsoCell.FormulaU = "Geometry2.X1"
    Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 1)
    vsoCell.FormulaU = "Geometry2.Y1"

End Sub


Cell.InheritedFormulaSource Property (Visio)

 Copy code hover
[image]

Cell.InheritedFormulaSource Property (Visio)
Send feedback

Published: July 16, 2012

Returns the cell from which this cell inherited its formula. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .InheritedFormulaSource

expression A variable that represents a Cell object.

Return Value

Cell

Remarks

If the formula in this cell is a local formula, the InheritedFormulaSource property returns itself.


Cell.InheritedValueSource Property (Visio)

 Copy code hover
[image]

Cell.InheritedValueSource Property (Visio)
Send feedback

Published: July 16, 2012

Returns the cell from which this cell inherited its value. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .InheritedValueSource

expression A variable that represents a Cell object.

Return Value

Cell

Remarks

If the value in this cell is a local value, the InheritedValueSource property returns itself.


Cell.IsConstant Property (Visio)

 Copy code hover
[image]

Cell.IsConstant Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a formula of the cell is a constant expression. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .IsConstant

expression A variable that represents a Cell object.

Return Value

Integer


Cell.IsInherited Property (Visio)

 Copy code hover
[image]

Cell.IsInherited Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a formula of the cell is inherited from a master or a style. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .IsInherited

expression A variable that represents a Cell object.

Return Value

Integer

Remarks

In the ShapeSheet window, values and formulas of cells that have local values appear in blue. Values and formulas of cells that inherit from a master or style appear in black.


Cell.LocalName Property (Visio)

 Copy code hover
[image]

Cell.LocalName Property (Visio)
Send feedback

Published: July 16, 2012

Returns the local name of a cell. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .LocalName

expression A variable that represents a Cell object.

Return Value

String

Remarks

A cell has both a local name and a universal name. The local name differs according to the locale for which Microsoft Windows is installed on the user's system. The universal name is the same regardless of locale.

To get the universal name of a cell, use the Name property.


Cell.Name Property (Visio)

 Copy code hover
[image]

Cell.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a Cell object.

Return Value

String

Remarks

You can get, but not set, the Name property of a Cell object. Some cells are in named rows; you can get and set the name of a named row by using the RowName property.

A cell has both a local name and a universal name. The local name differs depending on the locale for which the running version of Microsoft Windows is installed. The universal name is the same regardless of what locale is installed. To get the universal name of a cell, use the Name property. To get the local name, use the LocalName property.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Cell.ObjectType Property (Visio)

 Copy code hover
[image]

Cell.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Cell object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Cell.PersistsEvents Property (Visio)

 Copy code hover
[image]

Cell.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Cell object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Cell.Precedents Property (Visio)

 Copy code hover
[image]

Cell.Precedents Property (Visio)
Send feedback

Published: July 16, 2012

Returns an array of ShapeSheet cells upon which the formula of another cell depends. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Precedents

expression A variable that represents a Cell object.

Return Value

Cell()

Remarks

The Precedents property returns an array of the cells that cause the parent Cell object to recalculate its value when their formula or value changes.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Precedents property to display a list of cells upon which the "Scratch.X1" cell of a shape depend. The macro draws a rectangle on the active page, adds a Scratch section to the ShapeSheet of the rectangle, and then enters a formula in a cell of that section that is used to bow the sides of the rectangle inward, by changing each of the rectangles sides to an arc. Because the formula used to bow the sides of the rectangle depends on the width and height of the rectangle, the cell that contains the formula, Scratch.X1, is dependent upon the Width and Height cells of the rectangle shape, making these cells precedents.

VBA Copy code Copy code
Public Sub Precedents_Example()

 Dim acellPrecedentCells() As Visio.Cell
 Dim vsoCell As Visio.Cell
 Dim vsoShape As Visio.Shape
 Dim strBowCell As String
 Dim strBowFormula As String
 Dim intCounter As Integer

 'Set the value of the strBowCell string
 strBowCell = "Scratch.X1"

 'Set the value of the strBowFormula string
 strBowFormula = "=Min(Width, Height) / 5"

 'Draw a rectangle on the active page
 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section and then
 vsoShape.AddSection visSectionScratch

 'Add a row to the scratch section
 vsoShape.AddRow visSectionScratch, visRowScratch, 0

 'Place the value of strBowFormula into Scratch.X1
 'Set the Cell object to the Scratch.X1 and set formula
 Set vsoCell = vsoShape.Cells(strBowCell)

 'Set up the offset for the arc
 vsoCell.Formula = strBowFormula

 'Bow in or curve the original rectangle's lines by changing
 'each row to an arc and entering the bow value
 For intCounter = 1 To 4

 vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
 Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
 vsoCell.Formula = "-" & strBowCell

 Next intCounter

 'Get the array of precedent cells
 acellPrecedentCells = vsoShape.Cells("Scratch.X1").Precedents

 'List the cell names and their associated formula
 For intCounter = LBound(acellPrecedentCells) To UBound(acellPrecedentCells)
 Set vsoCell = acellPrecedentCells(intCounter)
 Debug.Print vsoCell.Name & " has this formula: " & vsoCell.Formula
 Next

End Sub


Cell.Result Property (Visio)

 Copy code hover
[image]

Cell.Result Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets a cell's value. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Result(UnitsNameOrCode)

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Required | Variant | The units to use when retrieving or setting the cell's value.

Return Value

Double

Remarks

Use the Result property to set the value of an unguarded cell. If the cell's formula is protected with the GUARD function, the formula is not changed and an error is generated. If the cell contains only a text string, zero (0) is returned. If the string is invalid, an error is generated.

You can specify UnitsNameOrCode as an integer or a string value. For example, the following statements all set UnitsNameOrCode to inches.

retVal = Cell.Result(visInches)

retVal = Cell.Result(65)

retVal = Cell.Result("in") where "in" can also be any of the alternate strings representing inches, such as "inch", "in.", or "intCounter".

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Automation constants for representing units are declared by the Visio type library in member VisUnitCodes .

To specify internal units, pass a zero-length string (""). Internal units are inches for distance and radians for angles. To specify implicit units, you must use the Formula property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Result property.

VBA Copy code Copy code

Public Sub Result_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim intLocalCenterX As Double

 'Draw a rectangle.
 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)

 Set vsoCell = vsoShape.Cells("LocPinX")
 intLocalCenterX = vsoCell.Result("cm")
 Debug.Print intLocalCenterX

 'You can also use the constants defined by the Visio type library.
 intLocalCenterX = vsoCell.Result(visInches)
 Debug.Print intLocalCenterX

End Sub


Cell.ResultForce Property (Visio)

 Copy code hover
[image]

Cell.ResultForce Property (Visio)
Send feedback

Published: July 16, 2012

Sets a cell's value, even if the cell's formula is protected with the GUARD function. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .ResultForce(UnitsNameOrCode)

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Required | Variant | The units to use when setting the cell's value.

Return Value

Double

Remarks

Use the ResultForce method to set a cell's value even if the cell's formula is protected with a GUARD function. If the string is invalid, an error is generated.

Setting the ResultForce property is similar to setting a cell's ResultFromIntForce property. The difference is that the ResultFromIntForce property accepts an integer for the value of the cell, whereas the ResultForce property accepts a floating point number.

You can specify UnitsNameOrCode as an integer or a string value. For example, the following statements all set UnitsNameOrCode to inches.

Cell.ResultForce(visInches) = newValue

Cell.ResultForce(65) = newValue

Cell.ResultForce("in") = newValue where "in" can also be any of the alternate strings representing inches, such as "inch", "in.", or "intCounter".

For a complete list of valid unit strings along with their corresponding Automation constants (integer values), see About Units of Measure.

Automation constants for representing units are declared by the Visio type library in member VisUnitCodes .

To specify internal units, pass a zero-length string (""). Internal units are inches for distance and radians for angles. To specify implicit units, you must use the Formula property.


Cell.ResultFromInt Property (Visio)

 Copy code hover
[image]

Cell.ResultFromInt Property (Visio)
Send feedback

Published: July 16, 2012

Sets the value of a cell to an integer value. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .ResultFromInt(UnitsNameOrCode)

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Required | Variant | The units to use when setting the cell's value.

Return Value

Long

Remarks

Setting the ResultFromInt property is similar to setting a cell's Result property. The difference is that the ResultFromInt property accepts an integer for the value of the cell, whereas the Result property accepts a floating point number.

You can specify UnitsNameOrCode as an integer or a string value. If the string is invalid, an error is generated. For example, the following statements all set UnitsNameOrCode to inches.

Cell.ResultFromInt(visInches) = newValue

Cell.ResultFromInt(65) = newValue

Cell.ResultFromInt("in") = newValue where "in" can also be any of the alternate strings representing inches, such as "inch", "in.", or "intCounter".

For a complete list of valid unit strings along with their corresponding Automation constants (integer values), see About Units of Measure.

Automation constants for representing units are declared by the Visio type library in member VisUnitCodes .

If the cell's formula is protected with a GUARD function, use the ResultFromIntForce property.


Cell.ResultFromIntForce Property (Visio)

 Copy code hover
[image]

Cell.ResultFromIntForce Property (Visio)
Send feedback

Published: July 16, 2012

Sets the value of a cell to an integer value, even if the cell's formula is protected with the GUARD function. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .ResultFromIntForce(UnitsNameOrCode)

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Required | Variant | The units to use when setting the cell's value.

Return Value

Long

Remarks

Use the ResultFromIntForce property to set a cell's value even if the cell's formula is protected with a GUARD function. Otherwise, it is identical in behavior to the ResultFromInt property.

Setting the ResultFromIntForce property is similar to setting a cell's ResultForce property. The difference is that the ResultFromIntForce property accepts an integer for the value of the cell, whereas the ResultForce property accepts a floating point number.


Cell.ResultInt Property (Visio)

 Copy code hover
[image]

Cell.ResultInt Property (Visio)
Send feedback

Published: July 16, 2012

Gets the value of a cell expressed as an integer. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ResultInt(UnitsNameOrCode, fRound)

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Required | Variant | The units to use when retrieving the cell's value.
fRound | Required | Integer | Zero (0) to truncate the value; non-zero to round it.

Return Value

Long

Remarks

Getting the ResultInt property is similar to a getting a cell's Result property. The difference is that the ResultInt property returns an integer for the value of the cell, whereas the Result property returns a floating point number.

You can specify UnitsNameOrCode as an integer or a string value. If the string is invalid, an error is generated. For example, the following statements all set UnitsNameOrCode to inches.

lngRet = Cell.ResultInt(visInches, fRound)

lngRet = Cell.ResultInt(65, fRound)

lngRet = Cell.ResultInt("in", fRound) where "in" can also be any of the alternate strings representing inches, such as "inch", "in.", or "intCounter".

For a complete list of valid unit strings along with their corresponding Automation constants (integer values), see About Units of Measure.

Automation constants for representing units are declared by the Visio type library in member VisUnitCodes .

The following constants for fRound are declared in the Visio type library in member VisRoundFlags.

Constant | Value | Description
visTruncate | 0 | Truncate the result.
visRound | 1 | Round the result.


Cell.ResultIU Property (Visio)

 Copy code hover
[image]

Cell.ResultIU Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets a cell's value in internal units. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .ResultIU

expression A variable that represents a Cell object.

Return Value

Double

Remarks

Use the ResultIU property to set the value of an unguarded cell. If a cell's formula is protected with a GUARD function, the formula is not changed and an error is generated. To set the value of a guarded cell in internal units, use the ResultIUForce property.

The units default to the Microsoft Visio internal units, which are inches for distance and radians for angles.


Cell.ResultIUForce Property (Visio)

 Copy code hover
[image]

Cell.ResultIUForce Property (Visio)
Send feedback

Published: July 16, 2012

Sets a cell's value in internal units, even if the cell's formula is protected with the GUARD function. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .ResultIUForce

expression A variable that represents a Cell object.

Return Value

Double

Remarks

The cell's units default to the Microsoft Visio internal units, which are inches for distance and radians for angles.


Cell.ResultStr Property (Visio)

 Copy code hover
[image]

Cell.ResultStr Property (Visio)
Send feedback

Published: July 16, 2012

Gets the value of a ShapeSheet cell expressed as a string. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ResultStr(UnitsNameOrCode)

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Required | Variant | The units to use when retrieving the value.

Return Value

String

Remarks

Getting the ResultStr property is similar to getting a cell's Result property. The difference is that ResultStr property returns a string for the value of the cell, whereas the Result property returns a floating point number.

You can specify UnitsNameOrCode as an integer or a string value. If the string is invalid, an error is generated. For example, the following statements all set UnitsNameOrCode to inches.

stringReturned = Cell.ResultStr(visInches)

stringReturned = Cell.ResultStr(65)

stringReturned = Cell.ResultStr("in") where "in" can also be any of the alternate strings representing inches, such as "inch", "in.", or "intCounter".

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Automation constants for representing units are declared by the Visio type library in member VisUnitCodes .

Passing a zero (0) is sufficient for getting the value of text string cells.

You can use the ResultStr property to convert between units. For example, you can get the value in inches and then get an equivalent value in centimeters.

The ResultStr property is useful for filling controls such as edit boxes with the value of a cell.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows two different ways to use the ResultStr property to get the value of a ShapeSheet cell that contains a shape's shape data (formerly Custom Properties).

To run this macro, open a blank drawing and the Computers and Monitors (US Units) stencil, and then insert a user form that contains a label, text box, and list box. Set the width of the list box to 150.

Note Note

The Computers and Monitors (US Units) stencil is available only in Visio Professional 2013.

VBA Copy code Copy code

Public Sub ResultStr_Example()

 Dim vsoStencil As Visio.Document
 Dim vsoMaster As Visio.Master
 Dim vsoPages As Visio.Pages
 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim intRows As Integer
 Dim intCounter As Integer

 'Get the Pages collection for the document.
 'ThisDocument refers to the current document.
 Set vsoPages = ThisDocument.Pages

 'Get a reference to the first page of the Pages collection.
 Set vsoPage = vsoPages(1)

 'Get the Document object for the stencil.
 Set vsoStencil = Documents("Comps_U.VSS")

 'Get the Master object for the desktop PC shape.
 Set vsoMaster = vsoStencil.Masters("PC")

 'Drop the shape in the approximate middle of the page.
 'Coordinates passed to the Drop method are always in inches.
 'The Drop method returns a reference to the new shape object.
 Set vsoShape = vsoPage.Drop(vsoMaster, 4.25, 5.5)

 'This example shows two methods of extracting shape data.
 'The first method retrieves the value of a shape-data item by name.
 'Note that Prop.Manufacturer implies Prop.Manufacturer.Value.
 Set vsoCell = vsoShape.Cells("Prop.Manufacturer")

 'Get the cell value as a string
 'and put it into the text box on the form.
 UserForm1.TextBox1.Text = vsoCell.ResultStr(Visio.visNone)

 'Set the caption of the label.
 UserForm1.Label1.Caption = "Prop.Manufacturer"

 'The second method of accessing shape data uses
 'section, row, cell. This method is best when you want
 'to iterate through all the shape data.
 intRows = vsoShape.RowCount(Visio.visSectionProp)

 'Make sure the list box is cleared.
 UserForm1.ListBox1.Clear

 'Loop through all the rows and add the value of Prop.Manufacturer
 'to the list box. Rows are numbered starting with 0.
 For intCounter = 0 To intRows - 1
 Set vsoCell = vsoShape.CellsSRC(Visio.visSectionProp, intCounter, visCustPropsValue)
 UserForm1.ListBox1.AddItem vsoCell.LocalName & vbTab & _
 vsoCell.ResultStr(Visio.visNone)
 Next intCounter

 'Display the user form.
 UserForm1.Show

End Sub


Cell.ResultStrU Property (Visio)

 Copy code hover
[image]

Cell.ResultStrU Property (Visio)
Send feedback

Published: July 16, 2012

Gets the value of a ShapeSheet cell expressed as a universal string. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .ResultStrU(UnitsNameOrCode)

expression An expression that returns a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Required | Variant | The units to use when retrieving the value.

Return Value

String

Remarks

Getting the ResultStrU property is similar to getting a cell's Result property. The difference is that the ResultStrU property returns a string for the value of the cell, whereas the Result property returns a floating point number.

You can specify UnitsNameOrCode as an integer or a string value. If the string is invalid, an error is generated. For example, the following statements all set UnitsNameOrCode to inches.

stringReturned = Cell.ResultStrU(visInches)

stringReturned = Cell.ResultStrU(65)

stringReturned = Cell.ResultStrU("in") where "in" can also be any of the alternate strings representing inches, such as "inch", "in.", or "intCounter".

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Automation constants for representing units are declared by the Visio type library in member VisUnitCodes .

Passing a zero (0) is sufficient for getting the value of text string cells.

You can use the ResultStrU property to convert between units. For example, you can get the value in inches and then get an equivalent value in centimeters.

The ResultStrU property is useful for filling controls such as edit boxes with the value of a cell.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the ResultStr property to get an object's value expressed as a locale-specific string. Use the ResultStrU property to get an object's value expressed as a universal string.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows two different ways to use the ResultStrU property to get the value of a ShapeSheet cell that contains a shape data item (formerly, a custom property) .

To run this macro, open a blank drawing and the Computers and Monitors (US Units) stencil, and then insert a user form that contains a label, text box, and list box. Set the width of the list box to 150.

Note Note

The Computers and Monitors (US Units) stencil is available only in Visio Professional 2013.

VBA Copy code Copy code

Public Sub ResultStrU_Example()

    Dim vsoStencil As Visio.Document
    Dim vsoMaster As Visio.Master
    Dim vsoPages As Visio.Pages
    Dim vsoPage As Visio.Page
    Dim vsoShape As Visio.Shape
    Dim vsoCell As Visio.Cell
    Dim intRows As Integer
    Dim intCounter As Integer

    'Get the Pages collection for the document.
    'ThisDocument refers to the current document.
    Set vsoPages = ThisDocument.Pages

    'Get a reference to the first page of the Pages collection.
    Set vsoPage = vsoPages(1)

    'Get the Document object for the stencil.
    Set vsoStencil = Documents("Comps_U.VSS")

    'Get the Master object for the desktop PC shape.
    Set vsoMaster = vsoStencil.Masters("PC")

    'Drop the shape in the approximate middle of the page.
    'Coordinates passed to the Drop method are always in inches.
    'The Drop method returns a reference to the new shape object.
    Set vsoShape = vsoPage.Drop(vsoMaster, 4.25, 5.5)

    'This example shows two methods of extracting shape data
    'The first method retrieves the value of a shape data item by name.
    'Note that Prop.Manufacturer implies Prop.Manufacturer.Value.
    Set vsoCell = vsoShape.Cells("Prop.Manufacturer")

    'Get the cell value as a string
    'and put it into the text box on the form.
    UserForm1.TextBox1.Text = vsoCell.ResultStrU(Visio.visNone)

    'Set the caption of the label.
    UserForm1.Label1.Caption = "Prop.Manufacturer"

    'The second method of accessing shape data uses
    'section, row, cell. This method is best when you want
    'to iterate through all the shape data.
    intRows = vsoShape.RowCount(Visio.visSectionProp)

    'Make sure the list box is cleared.
    UserForm1.ListBox1.Clear

    'Loop through all the rows and add the value of Prop.Manufacturer
    'to the list box. Rows are numbered starting with 0.
    For intCounter = 0 To intRows - 1
        Set vsoCell = vsoShape.CellsSRC(Visio.visSectionProp, intCounter, visCustPropsValue)
        UserForm1.ListBox1.AddItem vsoCell.LocalName & vbTab & _
            vsoCell.ResultStrU(Visio.visNone)
    Next intCounter

    'Display the user form.
    UserForm1.Show

End Sub


Cell.Row Property (Visio)

 Copy code hover
[image]

Cell.Row Property (Visio)
Send feedback

Published: July 16, 2012

Returns the row index of a cell. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Row

expression A variable that represents a Cell object.

Return Value

Integer


Cell.RowName Property (Visio)

 Copy code hover
[image]

Cell.RowName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of the row that contains the Cell object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .RowName

expression A variable that represents a Cell object.

Return Value

String

Remarks

If the cell is in a row in a shape's User-Defined Cells, Shape Data, or Connection Points section, the RowName property can get or set the name of the row. If the cell is not in one of these sections, attempting to get or set the name generates an error.

The Connection Points section can contain either named or unnamed rows, but not a combination of the two. Getting the name of an unnamed Connection Points row returns a zero-length string ("") and does not generate an error. Setting the name of an unnamed row in a Connection Points row assigns the name to the target row and converts all remaining rows in the section to named rows, using their default names (Row_1, Row_2, and so on). Assigning a zero-length string ("") to a named row in a Connection Points section resets the named row to its default name, but has no effect on an unnamed Connection Points row.

When you change a row name, any cell objects referring to cells in that row become invalid and you must reassign them. Also, if other Connection Points rows become named as a result of a row name change, you must also reassign references to cells in those rows.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the RowName property to get or set an object's local row name. Use the RowNameU property to get or set an object's universal row name.


Cell.RowNameU Property (Visio)

 Copy code hover
[image]

Cell.RowNameU Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the universal name of the row that contains the Cell object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .RowNameU

expression A variable that represents a Cell object.

Return Value

String

Remarks

If the cell is in a row in a shape's User-defined Cells, Shape Data, or Connection Points section, the RowNameU property can get or set the universal name of the row. If the cell is not in one of these sections, attempting to get or set the name generates an error.

The Connection Points section can contain either named or unnamed rows, but not a combination of the two. Getting the name of an unnamed Connection Points row returns a zero-length string ("") and does not generate an error. Setting the name of an unnamed row in a Connection Points row assigns the name to the target row and converts all remaining rows in the section to named rows, using their default names (Row_1, Row_2, and so on). Assigning a zero-length string ("") to a named row in a Connection Points section resets the named row to its default name, but has no effect on an unnamed Connection Points row.

When you change a row name, any cell objects referring to cells in that row become invalid and you must reassign them. Also, if other Connection Points rows become named as a result of a row name change, you must also reassign references to cells in those rows.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the RowName property to get or set an object's local row name. Use the RowNameU property to get or set an object's universal row name.


Cell.Section Property (Visio)

 Copy code hover
[image]

Cell.Section Property (Visio)
Send feedback

Published: July 16, 2012

Returns the index of the cell's section. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Section

expression A variable that represents a Cell object.

Return Value

Integer

Remarks

Constants that represent sections are prefixed with visSection and are declared by the Microsoft Visio type library in VisSectionIndices.


Cell.Shape Property (Visio)

 Copy code hover
[image]

Cell.Shape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Shape

expression A variable that represents a Cell object.

Return Value

Shape

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Shape property to get the Shape objects that own a Cell and a Characters object.

VBA Copy code Copy code

Public Sub Shape_Example()

 Dim vsoRectangle As Visio.Shape
 Dim vsoOval As Visio.Shape
 Dim vsoShapeFromCell As Visio.Shape
 Dim vsoShapeFromCharacters As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim vsoCharacters As Visio.Characters

 'Create 2 different shapes and add different text to each shape.
 Set vsoRectangle = ActivePage.DrawRectangle(2, 3, 5, 4)
 Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
 vsoRectangle.Text = "Rectangle Shape"
 vsoOval.Text = "Oval Shape"

 'Get a Cell object from the first shape.
 Set vsoCell = vsoRectangle.Cells("Width")

 'Get a Characters object from the second shape.
 Set vsoCharacters = vsoOval.Characters

 'Use the Shape property to get the Shape object.
 Set vsoShapeFromCell = vsoCell.Shape
 Set vsoShapeFromCharacters = vsoCharacters.Shape

 'Use each shape's text to verify the proper Shape
 'object was returned.
 Debug.Print vsoShapeFromCell.Text
 Debug.Print vsoShapeFromCharacters.Text

End Sub


Cell.Stat Property (Visio)

 Copy code hover
[image]

Cell.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Cell object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Cell.Style Property (Visio)

 Copy code hover
[image]

Cell.Style Property (Visio)
Send feedback

Published: July 16, 2012

Gets the style that contains a Cell object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Style

expression A variable that represents a Cell object.

Return Value

Style

Remarks

If a style consists of different text, line, and fill styles, the Style property returns the fill style.

If a Cell object is in a style, its Style property returns the style that contains the cell, and its Shape property returns Nothing.

If a Cell object is in a shape, its Shape property returns the shape that contains the cell, and its Style property returns Nothing.


Cell.Units Property (Visio)

 Copy code hover
[image]

Cell.Units Property (Visio)
Send feedback

Published: July 16, 2012

Indicates the unit of measure associated with a Cell object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Units

expression A variable that represents a Cell object.

Return Value

Integer

Remarks

The Units property can be used to determine the unit of measure currently associated with a cell's value. The various unit codes are declared by the Visio type library in member VisUnitCodes . For example, a cell's width might be expressed in inches (visInches) or in centimeters (visCentimeters). In some cases, a program might behave differently depending on whether a cell's value is in metric or in imperial units.

For a list of valid unit codes, see About Units of Measure.


Cell Methods (Visio)

 Copy code hover
[image]

Cell Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
GlueTo | Glues one shape to another, from a cell in the first shape to a cell in the second shape.
GlueToPos | Glues one shape to another from a cell in the first shape to an x,y position in the second shape.
Trigger | Evaluates the formula of a cell.


Cell.GlueTo Method (Visio)

 Copy code hover
[image]

Cell.GlueTo Method (Visio)
Send feedback

Published: July 16, 2012

Glues one shape to another, from a cell in the first shape to a cell in the second shape.

Version Information

Version Added: Visio 2.0

Syntax

expression .GlueTo(CellObject)

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
CellObject | Required | [IVCELL] | An expression that returns a Cell object that represents the part of the shape to glue to.

Return Value

Nothing

Remarks

Following is a list of possible connections.

Following is a list of possible connections.

From the begin or end cell of a 1-D shape to...

  • A connection point cell.

  • A cell of a guide or guide point: When the begin or end cell of a 1-D shape is glued to a cell of a guide or guide point, two connections are created—one from the BeginX or EndX cell to the guide's Angle cell, and one from the BeginY or EndY cell to the guide's Angle cell.

  • The pin of a 2-D shape (creates dynamic glue): The shape being glued from must be routable (ObjType includes visLOFlagsRoutable ) or have a dynamic glue type (GlueType includes visGlueTypeWalking ), and does not prohibit dynamic glue (GlueType does not include visGlueTypeNoWalking ). Gluing to PinX creates dynamic glue with a horizontal walking preference and gluing to PinY creates dynamic glue with a vertical walking preference.

  • Any cell of a vertex row in a Geometry section: A connection point is created that is glued to. Either the begin or end cell can be designated as the cell to glue from. The GlueTo method establishes new formulas in both the X and Y cells of the connection row.

  • The begin or end cell of a 1-D shape: A connection point is created that is glued to. Either the begin or end cell can be designated as the cell to glue from. The GlueTo method establishes new formulas in both the X and Y cells of the connection row.

  • The edge (a cell in the Alignment section) of a 2-D shape: A connection point is created that is glued to. Either the begin or end cell can be designated as the cell to glue from. The GlueTo method establishes new formulas in both the X and Y cells of the connection row.

From the edge (a cell in the Alignment section) of a 2-D shape to a cell of a guide or guide point.

From an outward or inward/outward connection point cell of a 1-D shape to an inward or inward/outward connection point cell that is not a cell of a guide or guide point: When these cells are glued, two connections are created—one from the BeginX cell of the 1-D shape to the Connections.Xi cell, and the other from the EndX cell of the 1-D shape to the Connections.Yi cell.

From an outward or inward/outward connection point cell of a 2-D shape to an inward or inward/outward type connection point cell that is not a cell of a guide or guide point: If the outward connection point has a direction, two connection points are created—one from the Angle cell to the Connections.Xi cell and the other from the PinX cell to the Connections.Yi cell.

From a control point cell to...

  • A connection point cell.

  • A cell of a guide or guide point: When a control point is glued to a cell of a guide or guide point other than a connection point cell, two connections are created—one to the guide's PinX and one to the guide's PinY.

  • Any cell of a vertex row in a Geometry section: A connection point is created that is glued to. Any cell in the control point row can be designated as the cell to glue from. The GlueTo method establishes new formulas in both the X and Y cells of the connection row.

  • The begin or end cell of a 1-D shape that isn't a guide or guide point: A connection point is created that is glued to. Any cell in the control point row can be designated as the cell to glue from. The GlueTo method establishes new formulas in both the X and Y cells of the connection row.

  • The edge (a cell in the Alignment section) of a 2-D shape: A connection point is created that is glued to. Any cell in the control point row can be designated as the cell to glue from. The GlueTo method establishes new formulas in both the X and Y cells of the connection row.

For details about connection point type and direction, see the Connection Points section.

Example

The following macro shows how to use the GlueTo method to glue shapes together.

VBA Copy code Copy code

Public Sub GlueTo_Example()

    Dim vso1DShape As Visio.Shape
    Dim vso2DShape1 As Visio.Shape
    Dim vso2DShape2 As Visio.Shape
    Dim vsoCellGlueFromBegin As Visio.Cell
    Dim vsoCellGlueFromEnd As Visio.Cell
    Dim vsoCellGlueToObject As Visio.Cell
    Dim vsoCellGlueToObject2 As Visio.Cell

    'Draw a line.
    Set vso1DShape = ActivePage.DrawLine(3, 5, 5, 3)

    'Draw the lower rectangle.
    Set vso2DShape1 = ActivePage.DrawRectangle(1, 1, 4, 2)

    'Draw the upper rectangle.
    Set vso2DShape2 = ActivePage.DrawRectangle(5, 5, 8, 6)

    'Get the Cell objects needed to make the connections.
    Set vsoCellGlueFromBegin = vso1DShape.Cells("BeginX")
    Set vsoCellGlueFromEnd = vso1DShape.Cells("EndX")
    Set vsoCellGlueToObject = vso2DShape1.Cells("Geometry1.X3")
    Set vsoCellGlueToObject2 = vso2DShape2.Cells("Geometry1.X1")

    'Use the GlueTo method to glue the begin point of the 1-D shape
    'to the top right vertex (Geometry1.X3) of the lower 2-D shape.
    vsoCellGlueFromBegin.GlueTo vsoCellGlueToObject

    'Use the GlueTo method to glue the endpoint of the 1-D shape
    'to the bottom left vertex (Geometry1.X1) of the upper 2-D shape.
    vsoCellGlueFromEnd.GlueTo vsoCellGlueToObject2

    'You can also use the GlueTo method to glue
    'by referencing a connection point cell.
    Set vso1DShape = ActivePage.DrawLine(3, 5, 5, 3)
    Set vsoCellGlueFromEnd = vso1DShape.Cells("EndX")
    Set vsoCellGlueToObject = vso2DShape1.Cells("Connections.X1")
    vsoCellGlueFromEnd.GlueTo vsoCellGlueToObject

End Sub


Cell.GlueToPos Method (Visio)

 Copy code hover
[image]

Cell.GlueToPos Method (Visio)
Send feedback

Published: July 16, 2012

Glues one shape to another from a cell in the first shape to an x,y position in the second shape.

Version Information

Version Added: Visio 2.0

Syntax

expression .GlueToPos(SheetObject, xPercent, yPercent)

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
SheetObject | Required | [IVSHAPE] | An expression that returns the Shape object to be glued to.
xPercent | Required | Double | The x-coordinate of the position to glue to.
yPercent | Required | Double | The y-coordinate of the position to glue to.

Return Value

Nothing

Remarks

The GlueToPos method creates a new connection point at the location determined by xPercent and yPercent, which represent decimal fractions of the specified shape's width and height, respectively, rather than coordinates. For example, the following creates a connection point at the center of SheetObject and glues the part of the shape that cellObject represents to that point:

cellObject.GlueToPos SheetObject, 0.5, 0.5

Gluing the X cell of a Controls section row or a BeginX or EndX cell automatically glues the Y cell of the Controls section row or the BeginY or EndY cell, respectively. (The reverse is also true.)

Example

The following example shows how to use the GlueToPos method to glue shapes together.

VBA Copy code Copy code

Public Sub GlueToPos_Example()

 Dim vso1DShape As Visio.Shape
 Dim vso2DShape1 As Visio.Shape
 Dim vso2DShape2 As Visio.Shape
 Dim vsoCellGlueFromBegin As Visio.Cell
 Dim vsoCellGlueFromEnd As Visio.Cell

 'Draw a line.
 Set vso1DShape = ActivePage.DrawLine(3, 5, 5, 3)

 'Draw the lower rectangle.
 Set vso2DShape1 = ActivePage.DrawRectangle(1, 1, 4, 2)

 'Draw the upper rectangle.
 Set vso2DShape2 = ActivePage.DrawRectangle(5, 5, 8, 6)

 'Get the Cell objects needed to make the connections.
 Set vsoCellGlueFromBegin = vso1DShape.Cells("BeginX")
 Set vsoCellGlueFromEnd = vso1DShape.Cells("EndX")

 'Use the GlueToPos method to glue the begin point of the 1-D shape
 'to the top center of the lower 2-D shape.
 vsoCellGlueFromBegin.GlueToPos vso2DShape1, 0.5, 1

 'Use the GlueToPos method to glue the endpoint of the 1-D shape
 'to the bottom center of the upper 2-D shape.
 vsoCellGlueFromEnd.GlueToPos vso2DShape2, 0.5, 0

End Sub


Cell.Trigger Method (Visio)

 Copy code hover
[image]

Cell.Trigger Method (Visio)
Send feedback

Published: July 16, 2012

Evaluates the formula of a cell.

Version Information

Version Added: Visio 4.0

Syntax

expression .Trigger

expression A variable that represents a Cell object.

Return Value

Nothing

Remarks

Triggering a cell simply evaluates the formula of that cell. If the formula contains other actions such as running an add-on, those actions occur.


Cell Events (Visio)

 Copy code hover
[image]

Cell Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
CellChanged | Occurs after the value changes in a cell in a document.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.


Cell.CellChanged Event (Visio)

 Copy code hover
[image]

Cell.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


Cell.FormulaChanged Event (Visio)

 Copy code hover
[image]

Cell.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Characters Object (Visio)

 Copy code hover
[image]

Characters Object (Visio)
Send feedback

Published: July 16, 2012

Represents a shape's text with the text fields expanded to the number of characters they display in a drawing window.

Remarks

To retrieve a Characters object, use the Characters property of a Shape object.

The default property of a Characters object is Text.

The Begin and End properties of a Characters object determine the range of the shape's text that is represented by the Characters object. Initially, the range contains all of the shape's text; you can set the Begin and End properties to specify a subrange of the text.

After you retrieve a Characters object, you can use its Text property to retrieve or set the shape's text. Use the Copy, Cut, or Paste method to copy, cut, or paste the Characters object's text to or from the Clipboard. Use the CharProps or ParaProps property to change the Characters object's formatting.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this object maps to the following types:

  • Microsoft.Office.Interop.Visio.IVCharacters


Characters Members (Visio)

 Copy code hover
[image]

Characters Members (Visio)
Send feedback

Published: July 16, 2012

Represents a shape's text with the text fields expanded to the number of characters they display in a drawing window.

Events

Name | Description
TextChanged | Occurs after the text of a shape is changed in a document.

Methods

Name | Description
AddCustomField | Replaces the text represented by a Characters object with a custom formula field that uses universal syntax.
AddCustomFieldU | Replaces the text represented by a Characters object with a custom formula field that uses universal syntax.
AddField | Replaces the text represented by a Characters object with a new field of the category, code, and format you specify.
AddFieldEx | Replaces the text represented by a Charactersobject with a new field of the category, code, format, language ID, and calendar ID you specify.
Copy | Copies a text range to the Clipboard.
Cut | Deletes a text range and places it on the Clipboard.
Delete | Deletes an object or selection.
Paste | Pastes the text range on the Clipboard into an object.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Begin | Gets or sets the beginning index of a Characters object, which represents a range of text in a shape. Read/write.
CharCount | Returns the number of characters in an object. Read-only.
CharProps | Sets a character property of a Characters object to a new value. Write-only.
CharPropsRow | Returns the index of the row in the Character section of a ShapeSheet window that contains character formatting information for a Characters object. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
End | Returns or sets the ending index of the indicated Characters object representing a range of text in a shape. Read/write.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
FieldCategory | Returns the field category for a field represented by an object. Read-only.
FieldCode | Returns the field code for a field represented by an object. Read-only.
FieldFormat | Returns the field format for a field represented by an object. Read-only.
FieldFormula | Returns the formula of the custom field represented by an object. Read-only.
FieldFormulaU | Returns the universal-syntax formula of the custom field represented by an object. Read-only.
IsField | Determines whether a Characters object represents the expanded text of a single field with no additional non-field characters. Read-only.
ObjectType | Returns an object's type. Read-only.
ParaProps | Sets the paragraph property of a Characters object to a new value. Read/write.
ParaPropsRow | Returns the index of the row in the Paragraph section of a ShapeSheet window that contains paragraph-formatting information for a Characters object. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
RunBegin | Returns the beginning index of a type of run—a sequence of characters that share a particular attribute, such as character, paragraph, or tab formatting; or a word, paragraph, or field. Read-only.
RunEnd | Returns the ending index of a type of run—a sequence of characters that share a particular attribute, such as character, paragraph, or tab formatting; or a word, paragraph, or field. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.
TabPropsRow | Returns the index of the row in the Tabs section of the ShapeSheet that contains tab formatting information for a Characters object. Read-only.
Text | Returns the range of text represented by a Characters object, which may be a subset of the shape's text depending on the values of the Characters object's Begin and End properties.Read/write.


Characters Properties (Visio)

 Copy code hover
[image]

Characters Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Begin | Gets or sets the beginning index of a Characters object, which represents a range of text in a shape. Read/write.
CharCount | Returns the number of characters in an object. Read-only.
CharProps | Sets a character property of a Characters object to a new value. Write-only.
CharPropsRow | Returns the index of the row in the Character section of a ShapeSheet window that contains character formatting information for a Characters object. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
End | Returns or sets the ending index of the indicated Characters object representing a range of text in a shape. Read/write.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
FieldCategory | Returns the field category for a field represented by an object. Read-only.
FieldCode | Returns the field code for a field represented by an object. Read-only.
FieldFormat | Returns the field format for a field represented by an object. Read-only.
FieldFormula | Returns the formula of the custom field represented by an object. Read-only.
FieldFormulaU | Returns the universal-syntax formula of the custom field represented by an object. Read-only.
IsField | Determines whether a Characters object represents the expanded text of a single field with no additional non-field characters. Read-only.
ObjectType | Returns an object's type. Read-only.
ParaProps | Sets the paragraph property of a Characters object to a new value. Read/write.
ParaPropsRow | Returns the index of the row in the Paragraph section of a ShapeSheet window that contains paragraph-formatting information for a Characters object. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
RunBegin | Returns the beginning index of a type of run—a sequence of characters that share a particular attribute, such as character, paragraph, or tab formatting; or a word, paragraph, or field. Read-only.
RunEnd | Returns the ending index of a type of run—a sequence of characters that share a particular attribute, such as character, paragraph, or tab formatting; or a word, paragraph, or field. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.
TabPropsRow | Returns the index of the row in the Tabs section of the ShapeSheet that contains tab formatting information for a Characters object. Read-only.
Text | Returns the range of text represented by a Characters object, which may be a subset of the shape's text depending on the values of the Characters object's Begin and End properties.Read/write.


Characters.Application Property (Visio)

 Copy code hover
[image]

Characters.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Characters object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Characters.Begin Property (Visio)

 Copy code hover
[image]

Characters.Begin Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the beginning index of a Characters object, which represents a range of text in a shape. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .Begin

expression A variable that represents a Characters object.

Return Value

Long

Remarks

The Begin property determines the beginning of the text range represented by a Characters object. The value of the Begin property is an index that represents the boundary between two characters, similar to an insertion point in text. Like selected text in a drawing window, a Characters object represents the sequence of characters that are affected by subsequent actions, such as the Cut or Copy method. When you retrieve a Characters object, its current text range includes all the shape's text. You can change the text range by setting the Characters object's Begin and End properties. Changing the text range of a Characters object has no effect on the text of the corresponding shape.

The Begin property can have a value from zero (0) to the value of the CharCount property for the corresponding shape. An index of 0 is before the first character in the shape's text. An index that is the same as the CharCount property is after the last character in the shape's text. If you specify a value less than 0, Microsoft Visio uses 0. If you specify a value that is inside the expanded characters of a field, Visio sets the value of the Begin property to the start of the field.

The value of the Begin property must always be less than or equal to the value of the End property. If you attempt to set the value of the Begin property to a value greater than the End property, Visio sets both the Begin and End properties to the value specified for the Begin property.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVCharacters.Begin


Characters.CharCount Property (Visio)

 Copy code hover
[image]

Characters.CharCount Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of characters in an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .CharCount

expression A variable that represents a Characters object.

Return Value

Long

Remarks

For a Shape object, the CharCount property returns the number of characters in the shape's text. For a Characters object, the CharCount property returns the number of characters in the text range represented by that object.

The value returned by the CharCount property includes the expanded number of characters for any fields in the object's text. For example, if the text contains a field that displays the file name of a drawing, the CharCount property includes the number of characters in the file name, rather than the one-character escape sequence used to represent a field in the Text property of a Shape object.


Characters.CharProps Property (Visio)

 Copy code hover
[image]

Characters.CharProps Property (Visio)
Send feedback

Published: July 16, 2012

Sets a character property of a Characters object to a new value. Write-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .CharProps(CellIndex)

expression An expression that returns a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
CellIndex | Required | Integer | The index of the cell in the Character section to set. See Remarks for possible values.

Return Value

Integer

Remarks

Depending on the extent of the text range and the format, setting the CharProps property may cause rows to be added or removed from a shape's Character ShapeSheet section.

The CharProps property is a write-only property. To retrieve formatting properties of a Characters object, use the CharPropsRow property.

The values of the CellIndex argument correspond to cells in the Character section of the ShapeSheet window, and the values of the CharProps property correspond to the values that can be entered in those cells.

Constants for CellIndex and for the CharProps property value are declared in the Visio type library in VisCellIndices.

CellIndex | Value | intExpression | Value
visCharacterFont | 0 | An integer that represents an index into the Fonts collection installed on a system. Zero (0) represents the default font. | N/A
visCharacterColor | 1 | An integer from 0 to 23 that corresponds to a color in the current color palette. | N/A
visCharacterStyle | 2 | visBold visItalic visUnderLine visSmallCaps | &H1 &H2 &H4 &H8
visCharacterCase | 3 | visCaseNormal visCaseAllCaps visCaseInitialCaps | 0 1 2
visCharacterPos | 4 | visPosNormal visPosSuper visPosSub | 0 1 2
visCharacterSize | 7 | An integer that represents point size. | N/A
visCharacterColorTrans | 17 | An integer from 0 to 100 that corresponds to the degree of transparency of the text color, as a percentage. | N/A
visCharacterDblUnderline | 8 | Boolean | N/A
visCharacterFontScale | 5 | An integer from 0 to 655 that represents the width of the text font, as a percentage, relative to the default (100%). | N/A
visCharacterLangID | 57 | A Long that represents the language the text is in. The language ID (LANGID) for a character is a 16-bit value defined by Windows, consisting of a primary language ID and a secondary language ID. To determine the value for particular languages, see the Platform SDK documentation on MSDN. | N/A
visCharacterLetterspace | 16 | An integer that represents additional space between adjacent letters, in points. | N/A
visCharacterOverline | 9 | Boolean | N/A
visCharacterStrikethru | 10 | Boolean | N/A

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVCharacters.set_CharProps


Characters.CharPropsRow Property (Visio)

 Copy code hover
[image]

Characters.CharPropsRow Property (Visio)
Send feedback

Published: July 16, 2012

Returns the index of the row in the Character section of a ShapeSheet window that contains character formatting information for a Characters object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .CharPropsRow(BiasLorR)

expression An expression that returns a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
BiasLorR | Required | Integer | The direction of the search.

Return Value

Integer

Remarks

If the formatting of the Characters object is represented by more than one row in the Character section of the ShapeSheet window, (in other words, if the Characters object consists of a section of text that spans characters that are formatted differently), the CharPropsRow property returns -1. Under these circumstances, Microsoft Visio ignores the value of the BiasLorR argument. (Characters that have the same character formatting share the same row in the ShapeSheet. Visio creates a new ShapeSheet row only when character formatting changes, for example from bold to italic.)

If the Characters object spans several characters within the same character property row, CharPropsRow returns the index of that row. In this case as well, Visio ignores the BiasLorR argument.

If the Characters object represents an insertion point rather than a sequence of characters (that is, if its Begin and End properties return the same value), use the BiasLorR argument to determine which row index to return.

Constant | Value
visBiasLetVisioChoose | 0
visBiasLeft | 1
visBiasRight | 2

Specify visBiasLeft for the row that covers character formatting for the character to the left of the insertion point, or visBiasRight for the row that covers character formatting for the character to the right of the insertion point.

If you specify visBiasLetVisioChoose, Visio uses the same logic it would apply to new text typed in the user interface starting at the insertion point. Usually, that means that Visio will apply the character formatting of the character to the left of the insertion point to the new text, so CharPropsRow will return the same value it would if passed visBiasLeft. (For an explanation of the meaning of "left" in this context, see the following note.) However, if the insertion point is at the beginning of a new paragraph, CharPropsRow returns the value it would return if passed visBiasRight.

Note Note

In the context of a Characters object, "left" means logically prior. In other words, one character is to the "left" of another if it would have been typed first in the course of normal writing. It is necessary to make this distinction because in some languages, characters are normally written from right to left, and not from left to right.


Characters.ContainingMasterID Property (Visio)

 Copy code hover
[image]

Characters.ContainingMasterID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the Master object that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingMasterID

expression A variable that represents a Characters object.

Return Value

Long

Remarks

If the object is not in a Master object, the ContainingMasterID property returns -1. For example, if a Shape object belongs to the Shapes collection of a Page object, the ContainingMasterID property returns -1.


Characters.ContainingPageID Property (Visio)

 Copy code hover
[image]

Characters.ContainingPageID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the page that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingPageID

expression A variable that represents a Characters object.

Return Value

Long

Remarks

If the object is not in a Page object, the ContainingPageID property returns -1. For example, if a Shape object belongs to a Masters collection, the ContainingPageID property returns -1.


Characters.Document Property (Visio)

 Copy code hover
[image]

Characters.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Characters object.

Return Value

Document


Characters.End Property (Visio)

 Copy code hover
[image]

Characters.End Property (Visio)
Send feedback

Published: July 16, 2012

Returns or sets the ending index of the indicated Characters object representing a range of text in a shape. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .End

expression A variable that represents a Characters object.

Return Value

Long

Remarks

The End property determines the end of the text range represented by a Characters object. The value of the End property is an index that represents the boundary between two characters, similar to an insertion point in text. Like selected text in a drawing window, a Characters object represents the sequence of characters that are affected by subsequent actions, such as the Cut or Copy method. When you retrieve a Characters object, its current text range includes all the shape's text. You can change the text range by setting the Characters object's Begin and End properties. Changing the text range of a Characters object has no effect on the text of the corresponding shape.

The End property can have a value from zero (0) to the value of the CharCount property for the corresponding shape. An index of 0 is positioned before the first character in the shape's text. An index that is the same as the CharCount property is positioned after the last character in the shape's text. If you specify a value less than 0, Microsoft Visio uses 0. If you specify a value that is inside the expanded characters of a field, Visio sets the value of the End property to the end of the field.

The value of the End property must always be greater than or equal to the value of the Begin property. If you attempt to set the value of the End property to a value lower than the Begin property, Visio sets both the End and Begin properties to the value specified for the End property.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVCharacters.End


Characters.EventList Property (Visio)

 Copy code hover
[image]

Characters.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Characters object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Characters.FieldCategory Property (Visio)

 Copy code hover
[image]

Characters.FieldCategory Property (Visio)
Send feedback

Published: July 16, 2012

Returns the field category for a field represented by an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .FieldCategory

expression A variable that represents a Characters object.

Return Value

Integer

Remarks

If the Characters object does not contain a field or contains non-field characters, the FieldCategory property returns an exception. Check the IsField property of the Characters object before getting its FieldCategory property.

Field categories correspond to those in the Category list in the Field dialog box (click Field on the Insert tab).

To add a custom field, use the AddCustomField method.

The following constants for field categories are declared by the Visio type library in VisFieldCategories.

Constant | Value
visFCatCustom | 0
visFCatDateTime | 1
visFCatDocument | 2
visFCatGeometry | 3
visFCatObject | 4
visFCatPage | 5


Characters.FieldCode Property (Visio)

 Copy code hover
[image]

Characters.FieldCode Property (Visio)
Send feedback

Published: July 16, 2012

Returns the field code for a field represented by an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .FieldCode

expression A variable that represents a Characters object.

Return Value

Integer

Remarks

If the Characters object does not contain a field or contains non-field characters, the FieldCode property returns an exception. Check the IsField property of the Characters object before getting its FieldCode property.

Field codes correspond to the fields in the Field list in the Field dialog box (click Field on the Insert tab).

Constants for field codes are declared by the Microsoft Visio type library in VisFieldCodes.


Characters.FieldFormat Property (Visio)

 Copy code hover
[image]

Characters.FieldFormat Property (Visio)
Send feedback

Published: July 16, 2012

Returns the field format for a field represented by an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .FieldFormat

expression A variable that represents a Characters object.

Return Value

Integer

Remarks

If the Characters object does not contain a field or contains non-field characters, the FieldFormat property returns an exception. Check the IsField property of the Characters object before getting its FieldFormat property.

Field formats correspond to the formats in the Format list in the Field dialog box (click Field on the Insert tab).

Constants for field formats are declared by the Microsoft Visio type library in VisFieldFormats.


Characters.FieldFormula Property (Visio)

 Copy code hover
[image]

Characters.FieldFormula Property (Visio)
Send feedback

Published: July 16, 2012

Returns the formula of the custom field represented by an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .FieldFormula

expression A variable that represents a Characters object.

Return Value

String

Remarks

If the Characters object does not contain a field or contains non-field characters, or if the field is not a custom field, the FieldFormula property returns an exception. Check the IsField and FieldCategory properties of the Characters object before getting its FieldFormula property.

The formula returned by the FieldFormula property corresponds to the formula that appears in the Custom formula box in the Field dialog box (click Field on the Insert tab).

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the FieldFormula property to get a formula in local syntax. Use the FieldFormulaU property to get a formula in universal syntax.


Characters.FieldFormulaU Property (Visio)

 Copy code hover
[image]

Characters.FieldFormulaU Property (Visio)
Send feedback

Published: July 16, 2012

Returns the universal-syntax formula of the custom field represented by an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .FieldFormulaU

expression A variable that represents a Characters object.

Return Value

String

Remarks

If the Characters object does not contain a field or contains non-field characters, or if the field is not a custom field, the FieldFormulaU property returns an exception. Check the IsField and FieldCategory properties of the Characters object before getting its FieldFormulaU property.

The formula returned by the FieldFormulaU property corresponds to the formula that appears in the Custom formula box in the Field dialog box (click Field on the Insert tab).

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the FieldFormula property to get a formula in local syntax. Use the FieldFormulaU property to get a formula in universal syntax.


Characters.IsField Property (Visio)

 Copy code hover
[image]

Characters.IsField Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a Characters object represents the expanded text of a single field with no additional non-field characters. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .IsField

expression A variable that represents a Characters object.

Return Value

Integer

Remarks

To change the range of text represented by a Characters object, set its Begin and End properties.


Characters.ObjectType Property (Visio)

 Copy code hover
[image]

Characters.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Characters object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Characters.ParaProps Property (Visio)

 Copy code hover
[image]

Characters.ParaProps Property (Visio)
Send feedback

Published: July 16, 2012

Sets the paragraph property of a Characters object to a new value. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .ParaProps(CellIndex)

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
CellIndex | Required | Integer | The cell value to set.

Return Value

Integer

Remarks

The possible values of the CellIndex argument correspond to named cells in the Paragraph section of the ShapeSheet. Constants for CellIndex are declared by the Visio type library in VisCellIndices.

Constant | Value
visIndentFirst | 0
visIndentLeft | 1
visIndentRight | 2
visSpaceLine | 3
visSpaceBefore | 4
visSpaceAfter | 5
visHorzAlign | 6
visBulletIndex | 7

Depending on the extent of the text range and the format, setting the ParaProps property may cause rows to be added or removed from the Paragraph section of the ShapeSheet.

To retrieve information about an existing format, use the ParaPropsRow property.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVCharacters.set_ParaProps


Characters.ParaPropsRow Property (Visio)

 Copy code hover
[image]

Characters.ParaPropsRow Property (Visio)
Send feedback

Published: July 16, 2012

Returns the index of the row in the Paragraph section of a ShapeSheet window that contains paragraph-formatting information for a Characters object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .ParaPropsRow(BiasLorR)

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
BiasLorR | Required | Integer | The direction of the search.

Return Value

Integer

Remarks

If the formatting for the Characters object is represented by more than one row in the Paragraph section in the ShapeSheet window (in other words, if the Characters object consists of a sequence of characters that spans paragraphs that are formatted differently), the ParaPropsRow property returns -1. Under these circumstances, Microsoft Visio ignores the value of the BiasLorR argument. (Two paragraphs that have the same paragraph formatting share the same row in the ShapeSheet. Visio creates a new ShapeSheet row only when paragraph formatting changes, for example from left-aligned to right-aligned.)

If the Characters object spans several characters within the same paragraph row, ParaPropsRow returns the index of that row. In this case as well, Visio ignores the BiasLorR argument.

If the Characters object represents an insertion point rather than a sequence of characters (its Begin and End properties return the same value), use the BiasLorR argument to determine which row index to return.

Constant | Value
visBiasLetVisioChoose | 0
visBiasLeft | 1
visBiasRight | 2

Specify visBiasLeft for the row that covers paragraph formatting for the character to the left of the insertion point or visBiasRight for the row that covers paragraph formatting for the character to the right of the insertion point.

If you specify visBiasLetVisioChoose, Visio uses the same logic it would apply to new text typed in the user interface starting at the insertion point. Usually, that means that Visio will apply the paragraph formatting of the character to the left of the insertion point to the new text, so ParaPropsRow will return the same value it would if passed visBiasLeft. (For an explanation of the meaning of "left" in this context, see the following note.) However, if the insertion point is at the beginning of a new paragraph, ParaPropsRow returns the value it would return if passed visBiasRight.

Note Note

In the context of a Characters object, "left" means logically prior. In other words, one character is to the "left" of another if it would have been typed first in the course of normal writing. It is necessary to make this distinction because in some languages, characters are normally written from right to left, and not from left to right.


Characters.PersistsEvents Property (Visio)

 Copy code hover
[image]

Characters.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Characters object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Characters.RunBegin Property (Visio)

 Copy code hover
[image]

Characters.RunBegin Property (Visio)
Send feedback

Published: July 16, 2012

Returns the beginning index of a type of run—a sequence of characters that share a particular attribute, such as character, paragraph, or tab formatting; or a word, paragraph, or field. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .RunBegin(RunType)

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
RunType | Required | Integer | The type of run to get.

Return Value

Long

Remarks

In a ShapeSheet window, each row in the Character and Paragraph sections represents a run of the corresponding format in a shape's text. Certain words may be bold or italic, or one paragraph may be centered and another left-aligned. Each change of format represents a run of that format. Similarly, delimiters such as spaces and paragraph marks represent the beginning and end of words, paragraphs, and fields.

In addition, you can retrieve rows that represent runs of character, paragraph, and tab formats by specifying a row index as an argument to the CellsSRC property of a shape.

Use the RunBegin property to determine the beginning of a sequence of identically formatted characters or the beginning of a word, paragraph, or field. You can get the IsField property to determine whether a run is a field.

The index that the RunBegin property returns is less than or equal to the beginning index of a Characters object. If the Begin property of the Characters object is already at the start of a run, the value of the RunBegin property is equal to the value of Begin.

Use the RunType argument to specify the type of run you want. You can use any of the following constants declared by the Visio type library in member VisRunTypes.

Constant | Value | Description
visCharPropRow | 1 | Reports runs of characters with common character properties. Corresponds to the set of characters covered by one row in the shape's Character section.
visParaPropRow | 2 | Reports runs of characters with common paragraph properties. Corresponds to the set of characters covered by one row in the shape's Paragraph section.
visTabPropRow | 3 | Reports runs of characters with common tab properties. Corresponds to the set of characters covered by one row in the shape's Tabs section.
visWordRun | 10 | Reports runs whose boundaries are between successive words in the shape's text. Mimics double-clicking to select text.
visParaRun | 11 | Reports runs whose boundaries are between successive paragraphs in the shape's text. Mimics triple-clicking to select text.
visFieldRun | 20 | Reports runs whose boundaries are between characters that are and are not the result of the expansion of a text field, or between characters that are the result of the expansion of distinct text fields.


Characters.RunEnd Property (Visio)

 Copy code hover
[image]

Characters.RunEnd Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ending index of a type of run—a sequence of characters that share a particular attribute, such as character, paragraph, or tab formatting; or a word, paragraph, or field. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .RunEnd(RunType)

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
RunType | Required | Integer | The type of run to get.

Return Value

Long

Remarks

In a ShapeSheet window, each row in the Character and Paragraph sections represents a run of the corresponding format in a shape's text. Certain words may be bold or italic, or one paragraph may be centered and another left-aligned. Each change of format represents a run of that format. Similarly, delimiters such as spaces and paragraph marks represent the beginning and end of words, paragraphs, and fields.

In addition, you can retrieve rows that represent runs of character, paragraph, and tab formats by specifying a row index as an argument to the CellsSRC property of a shape.

Use the RunEnd property to determine the end of a sequence of identically formatted characters or the end of a word, paragraph, or field. You can get the IsField property to determine whether a run is a field.

The index that the RunEnd property returns is greater than or equal to the ending index of a Characters object. If the End property of the Characters object is already at the end of a run, the value of the RunEnd property is equal to the value of the End property.

Use the RunType argument to specify the type of run you want. You can use any of the constants declared by the Visio type library in VisRunTypes Constants. To find a list of RunType values, see the RunBegin property.


Characters.Shape Property (Visio)

 Copy code hover
[image]

Characters.Shape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Shape

expression A variable that represents a Characters object.

Return Value

Shape

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Shape property to get the Shape objects that own a Cell and a Characters object.

VBA Copy code Copy code

Public Sub Shape_Example()

 Dim vsoRectangle As Visio.Shape
 Dim vsoOval As Visio.Shape
 Dim vsoShapeFromCell As Visio.Shape
 Dim vsoShapeFromCharacters As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim vsoCharacters As Visio.Characters

 'Create 2 different shapes and add different text to each shape.
 Set vsoRectangle = ActivePage.DrawRectangle(2, 3, 5, 4)
 Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
 vsoRectangle.Text = "Rectangle Shape"
 vsoOval.Text = "Oval Shape"

 'Get a Cell object from the first shape.
 Set vsoCell = vsoRectangle.Cells("Width")

 'Get a Characters object from the second shape.
 Set vsoCharacters = vsoOval.Characters

 'Use the Shape property to get the Shape object.
 Set vsoShapeFromCell = vsoCell.Shape
 Set vsoShapeFromCharacters = vsoCharacters.Shape

 'Use each shape's text to verify the proper Shape
 'object was returned.
 Debug.Print vsoShapeFromCell.Text
 Debug.Print vsoShapeFromCharacters.Text

End Sub


Characters.Stat Property (Visio)

 Copy code hover
[image]

Characters.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Characters object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Characters.TabPropsRow Property (Visio)

 Copy code hover
[image]

Characters.TabPropsRow Property (Visio)
Send feedback

Published: July 16, 2012

Returns the index of the row in the Tabs section of the ShapeSheet that contains tab formatting information for a Characters object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .TabPropsRow(BiasLorR)

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
BiasLorR | Required | Integer | The direction of the search.

Return Value

Integer

Remarks

You can retrieve rows that represent runs of tab formatting by specifying a row index as an argument to the CellsSRC property of a shape. You can also view or change tab formats on the Tabs tab of the Text dialog box (on the Home tab, click the Font arrow, and then click Tabs).

If the tab format for the Characters object is represented by more than one tab properties row, the TabPropsRow property returns -1. Under these circumstances, Microsoft Visio ignores the value of the BiasLorR argument. (Two paragraphs that have the same tab formatting share the same row in the ShapeSheet. Visio creates a new ShapeSheet row only when tab formatting changes, for example from left-aligned to right-aligned.)

If the Characters object spans several characters within the same tab properties row, ParaPropsRow returns the index of that row. In this case as well, Visio ignores the BiasLorR argument.

If the Characters object represents an insertion point rather than a sequence of characters (that is, if its Begin and End properties return the same value), use the BiasLOrR argument to determine which row index to return.

Constant | Value
visBiasLetVisioChoose | 0
visBiasLeft | 1
visBiasRight | 2

Specify visBiasLeft for the row that covers tab formatting for the character to the left of the insertion point. Use visBiasRight for the row that covers tab formatting for the character to the right of the insertion point.

If you specify visBiasLetVisioChoose, Visio uses the same logic it would apply to new text typed in the user interface starting at the insertion point. Usually, that means that Visio will apply the tab formatting of the character to the left of the insertion point to the new text, so TabPropsRow will return the same value it would if passed visBiasLeft. (For an explanation of the meaning of "left" in this context, see the following note.) However, if the insertion point is at the beginning of a new paragraph, TabPropsRow returns the value it would return if passed visBiasRight.

Note Note

In the context of a Characters object, "left" means logically prior. In other words, one character is to the "left" of another if it would have been typed first in the course of normal writing. It is necessary to make this distinction because in some languages, characters are normally written from right to left, and not from left to right.


Characters.Text Property (Visio)

 Copy code hover
[image]

Characters.Text Property (Visio)
Send feedback

Published: July 16, 2012

Returns the range of text represented by a Characters object, which may be a subset of the shape's text depending on the values of the Characters object's Begin and End properties.Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Text

expression A variable that represents a Characters object.

Return Value

Variant

Remarks

The text for a Characters object is returned in a Variant of type String, as opposed to in a String. This is typically transparent if you are using Microsoft Visual Basic.

In the text returned by a Characters object, fields are expanded to the number of characters that are visible in the drawing window. For example, if a shape's text contains a field that displays the file name of a drawing, the Text property of a Characters object returns the expanded file name (provided the Begin and End properties were not altered).

If a Characters object represents the text of a shape that is a group, it will always return the text of the group.

Objects from other applications and guides don't have a Text property.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVCharacters.Text

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the Text property of a Characters object.

VBA Copy code Copy code

Public Sub CharactersText_Example()

    Dim vsoOval As Visio.Shape
    Dim vsoCharacters As Visio.Characters

    'Create a shape and add text.
    Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
    vsoOval.Text = "Oval Shape"

    'Get a Characters object from the shape.
    Set vsoCharacters = vsoOval.Characters

    'Get the text from the Characters object.
    Debug.Print vsoCharacters.Text

End Sub


Characters Methods (Visio)

 Copy code hover
[image]

Characters Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddCustomField | Replaces the text represented by a Characters object with a custom formula field that uses universal syntax.
AddCustomFieldU | Replaces the text represented by a Characters object with a custom formula field that uses universal syntax.
AddField | Replaces the text represented by a Characters object with a new field of the category, code, and format you specify.
AddFieldEx | Replaces the text represented by a Charactersobject with a new field of the category, code, format, language ID, and calendar ID you specify.
Copy | Copies a text range to the Clipboard.
Cut | Deletes a text range and places it on the Clipboard.
Delete | Deletes an object or selection.
Paste | Pastes the text range on the Clipboard into an object.


Characters.AddCustomField Method (Visio)

 Copy code hover
[image]

Characters.AddCustomField Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the text represented by a Characters object with a custom formula field that uses universal syntax.

Version Information

Version Added: Visio 3.0

Syntax

expression .AddCustomField(Formula, Format)

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
Formula | Required | String | The formula of the new field.
Format | Required | Integer | The format of the new field.

Return Value

Nothing

Remarks

Using the AddCustomFieldU method is similar to clicking Field on the Insert tab and inserting a custom formula field in text. To add any other type of field (not custom), use the AddField method.

Valid field format constants are defined in the Visio type library in VisFieldFormats.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the AddCustomField method to set a custom field that uses local syntax. Use the AddCustomFieldU method to set a custom field that uses universal syntax.


Characters.AddCustomFieldU Method (Visio)

 Copy code hover
[image]

Characters.AddCustomFieldU Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the text represented by a Characters object with a custom formula field that uses universal syntax.

Version Information

Version Added: Visio 3.0

Syntax

expression .AddCustomFieldU(Formula, Format)

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
Formula | Required | String | The formula of the new field.
Format | Required | Integer | The format of the new field.

Return Value

Nothing

Remarks

Using the AddCustomFieldU method is similar to clicking Field on the Insert tab and inserting a custom formula field in text. To add any other type of field (not custom), use the AddField method.

Valid field format constants are defined in the Visio type library in VisFieldFormats.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the AddCustomField method to set a custom field that uses local syntax. Use the AddCustomFieldU method to set a custom field that uses universal syntax.


Characters.AddField Method (Visio)

 Copy code hover
[image]

Characters.AddField Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the text represented by a Characters object with a new field of the category, code, and format you specify.

Version Information

Version Added: Visio 3.0

Syntax

expression .AddField(Category, Code, Format)

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
Category | Required | Integer | VisFieldCategories. The category for the new field.
Code | Required | Integer | VisFieldCodes. The code for the new field.
Format | Required | Integer | VisFieldFormats. The format for the new field.

Return Value

Nothing

Remarks

Using the AddField method is similar to clicking Field on the Insert tab and inserting any of the following categories of fields in the text:

  • Date/Time

  • Document Info

  • Geometry

  • Object Info

  • Page Info

To add a custom formula field, use the AddCustomFieldmethod.

To specify language and calendary versions for Date/Time fields, use the AddFieldEx method.

Constant values for Category, Code, and Format are declared by the Visio type library in VisFieldCategories, VisFieldCodes, and VisFieldFormats respectively.


Characters.AddFieldEx Method (Visio)

 Copy code hover
[image]

Characters.AddFieldEx Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the text represented by a Charactersobject with a new field of the category, code, format, language ID, and calendar ID you specify.

Version Information

Version Added: Visio 2003

Syntax

expression .AddFieldEx(Category, Code, Format, LangID, CalendarID)

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
Category | Required | VisFieldCategories | The category for the new field.
Code | Required | VisFieldCodes | The code for the new field.
Format | Required | VisFieldFormats | The format for the new field.
LangID | Optional | Long | The language to use for the new field.
CalendarID | Optional | Long | The calendar to use for the new field.

Return Value

Nothing

Remarks

Constant values for Category, Code, and Format are declared by the Visio type library in VisFieldCategories, VisFieldCodes, and VisFieldFormats respectively.

The LangID argument should be one of the standard IDs used by Microsoft Windows to encode different language versions. For example, the language ID is &H0409 for the U.S. version of Microsoft Visio. To see a list of possible language IDs, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN.

The CalendarID argument should be one of the following values, which are declared in VisCellVals in the Visio type library. The default value is visCalWestern, which sets the calendar to the Western calendar.

Constant | Value | Description
visCalWestern | 0 | Western
visCalArabicHijri | 1 | Arabic Hijiri
visCalHebrewLunar | 2 | Hebrew Lunar
visCalChineseTaiwan | 3 | Taiwan Calendar
visCalJapaneseEmperor | 4 | Japanese Emperor Reign
visCalThaiBuddhism | 5 | Thai Buddhist
visCalKoreanDanki | 6 | Korean Danki
visCalSakaEra | 7 | Saka Era
visCalTranslitEnglish | 8 | English transliterated
visCalTranslitFrench | 9 | French transliterated

Using the AddFieldEx method is similar to clicking Field on the Insert tab and inserting any of the following categories of fields into the text:

  • Date/Time

  • Document Info

  • Geometry

  • Object Info

  • Page Info

To add a custom formula field, use the AddCustomField or AddCustomFieldU method. When you do not pass values (or pass default values) for the optional LangID and CalendarID arguments, AddFieldEx acts exactly like AddField.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AddFieldEx property to format a date field in a shape. It draws a rectangle on the drawing page and then inserts a field that displays the current date in Greek, using the Western calendar.

Copy code Copy code
Public Sub AddFieldEx_Example()

 Dim vsoCharacters As Visio.Characters
 Dim vsoShape As Visio.Shape

 ActiveWindow.DeselectAll

 Set vsoShape = Application.ActivePage.DrawRectangle(3, 5, 5, 3)
 vsoShape.Text = "Date: "

 Set vsoCharacters = vsoShape.Characters

 'Set Begin property equal to End property to
 'append new text to existing text.
 vsoCharacters.Begin = vsoCharacters.End

 'Add a field for the current date, in Greek,
 'using the Western calendar and the long date format.
 vsoCharacters.AddFieldEx visFCatDateTime, visFCodeCurrentDate, visFmtMsoDateLong, 1032, visCalWestern

End Sub


Characters.Copy Method (Visio)

 Copy code hover
[image]

Characters.Copy Method (Visio)
Send feedback

Published: July 16, 2012

Copies a text range to the Clipboard.

Version Information

Version Added: Visio 2.0

Syntax

expression .Copy

expression A variable that represents a Characters object.

Return Value

Nothing

Remarks

To make a copy without using the Clipboard, use the Duplicate method.


Characters.Cut Method (Visio)

 Copy code hover
[image]

Characters.Cut Method (Visio)
Send feedback

Published: July 16, 2012

Deletes a text range and places it on the Clipboard.

Version Information

Version Added: Visio 2.0

Syntax

expression .Cut

expression A variable that represents a Characters object.

Return Value

Nothing

Remarks

When used with a Characters object, the Cut method places the text range represented by that object on the Clipboard.


Characters.Delete Method (Visio)

 Copy code hover
[image]

Characters.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object or selection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a Characters object.

Return Value

Nothing


Characters.Paste Method (Visio)

 Copy code hover
[image]

Characters.Paste Method (Visio)
Send feedback

Published: July 16, 2012

Pastes the text range on the Clipboard into an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Paste

expression A variable that represents a Characters object.

Return Value

Nothing


Characters Events (Visio)

 Copy code hover
[image]

Characters Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
TextChanged | Occurs after the text of a shape is changed in a document.


Characters.TextChanged Event (Visio)

 Copy code hover
[image]

Characters.TextChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the text of a shape is changed in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _TextChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Characters object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose text changed.

Remarks

The TextChanged event is fired when the raw text of a shape changes, such as when the characters Microsoft Visio stores for the shape change. If a shape's characters change because a user is typing, the TextChanged event does not fire until the text editing session terminates.

When a field is added to or removed from a shape's text, its raw text changes; hence, a TextChanged event fires. However, no TextChanged event fires when the text in a field changes. For example, a shape has a text field that shows its width. A TextChanged event does not fire when the shape's width changes, because the raw text stored for the shape has not changed, even though the apparent (expanded) text of the shape does change. Use the CellChanged event for one of the cells in the Text Fields section to detect when the text in a text field changes.

To access a shape's raw text, use the Text property. To access the text of a shape in which text fields have been expanded, use the Characters.Text property. You can determine the location and properties of text fields in a shape's text by using the Shape.Characters object.

In Visio 5.0 and earlier versions, the raw characters reported by the Text property for a field included four characters, the first being the escape character. Starting with Visio 2000, only a single escape character is present in the raw text stream.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the TextChanged event.

For performance considerations, the Document object's event set does not include the TextChanged event. To sink the TextChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


CoauthMergeEvent Object (Visio)

 Copy code hover
[image]

CoauthMergeEvent Object (Visio)
See also Send feedback

Published: July 16, 2012

Represents the merging of changes by various authors to a document or documents. Passed as a parameter to the Document.AfterDocumentMerge and Documents.AfterDocumentMerge events.

See also

Other resources

CoauthMergeEvent Members


CoauthMergeEvent Members (Visio)

 Copy code hover
[image]

CoauthMergeEvent Members (Visio)
Send feedback

Published: July 16, 2012

Represents the merging of changes by various authors to a document or documents. Passed as a parameter to the Document.AfterDocumentMerge and Documents.AfterDocumentMerge events.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
BaseDocument | Returns a Document object that represents the state of the original document before any changes by any users are merged into it. Read-only.
DownloadDocument | Returns a Document object that represents a document that includes changes from all users other than the current user. Read-only.
ObjectType | Returns the type of an object. Read-only.
Stat | Returns status information for an object. Read-only.
WorkingDocument | Returns a Document object that represents a merged document that includes changes by the current user only. Read-only.


CoauthMergeEvent Properties (Visio)

 Copy code hover
[image]

CoauthMergeEvent Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
BaseDocument | Returns a Document object that represents the state of the original document before any changes by any users are merged into it. Read-only.
DownloadDocument | Returns a Document object that represents a document that includes changes from all users other than the current user. Read-only.
ObjectType | Returns the type of an object. Read-only.
Stat | Returns status information for an object. Read-only.
WorkingDocument | Returns a Document object that represents a merged document that includes changes by the current user only. Read-only.


CoauthMergeEvent.Application Property (Visio)

 Copy code hover
[image]

CoauthMergeEvent.Application Property (Visio)
Send feedback

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Syntax

expression .Application

expression A variable that represents a CoauthMergeEvent object.


CoauthMergeEvent.BaseDocument Property (Visio)

 Copy code hover
[image]

CoauthMergeEvent.BaseDocument Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns a Document object that represents the state of the original document before any changes by any users are merged into it. Read-only.

Syntax

expression .BaseDocument

expression A variable that represents a CoauthMergeEvent object.

Property value

IVDOCUMENT

See also

Other resources

CoauthMergeEvent Object
CoauthMergeEvent Members


CoauthMergeEvent.DownloadDocument Property (Visio)

 Copy code hover
[image]

CoauthMergeEvent.DownloadDocument Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns a Document object that represents a document that includes changes from all users other than the current user. Read-only.

Syntax

expression .DownloadDocument

expression A variable that represents a CoauthMergeEvent object.

Property value

IVDOCUMENT

See also

Other resources

CoauthMergeEvent Object
CoauthMergeEvent Members


CoauthMergeEvent.ObjectType Property (Visio)

 Copy code hover
[image]

CoauthMergeEvent.ObjectType Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns the type of an object. Read-only.

Syntax

expression .ObjectType

expression A variable that represents a CoauthMergeEvent object.

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Property value

INT16

See also

Other resources

CoauthMergeEvent Object
CoauthMergeEvent Members


CoauthMergeEvent.Stat Property (Visio)

 Copy code hover
[image]

CoauthMergeEvent.Stat Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Syntax

expression .Stat

expression A variable that represents a CoauthMergeEvent object.

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Property value

INT16

See also

Other resources

CoauthMergeEvent Object
CoauthMergeEvent Members


CoauthMergeEvent.WorkingDocument Property (Visio)

 Copy code hover
[image]

CoauthMergeEvent.WorkingDocument Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns a Document object that represents a merged document that includes changes by the current user only. Read-only.

Syntax

expression .WorkingDocument

expression A variable that represents a CoauthMergeEvent object.

Remarks

Changes to the merged document returned by the WorkingDocument property are what fire the Document.AfterDocumentMerge or Documents.AfterDcoumentMerge event represented by the specified CoauthMergeEvent object.

Property value

IVDOCUMENT

See also

Other resources

CoauthMergeEvent Object
CoauthMergeEvent Members


Color Object (Visio)

 Copy code hover
[image]

Color Object (Visio)
Send feedback

Published: July 16, 2012

Represents a color in the color palette for a Microsoft Visio document.

Version Information

Version Added: Visio 4.0

Remarks

The default property of a Color object is PaletteEntry.


Color Members (Visio)

 Copy code hover
[image]

Color Members (Visio)
Send feedback

Published: July 16, 2012

Represents a color in the color palette for a Microsoft Visio document.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Blue | Gets or sets the intensity of the blue component of a Color object. Read/write.
Document | Gets the Document object that is associated with an object. Read-only.
Flags | Gets or sets the flags that specify how you use a Color object. Read/write.
Green | Gets or sets the intensity of the green component of a Color object. Read/write.
Index | Gets the ordinal position of a Color object in the Colors collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PaletteEntry | Gets or sets the red, green, blue, and flags components of a color. Read/write.
Red | Gets or sets the intensity of the red component of a Color object. Read/write.
Stat | Returns status information for an object. Read-only.


Color Properties (Visio)

 Copy code hover
[image]

Color Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Blue | Gets or sets the intensity of the blue component of a Color object. Read/write.
Document | Gets the Document object that is associated with an object. Read-only.
Flags | Gets or sets the flags that specify how you use a Color object. Read/write.
Green | Gets or sets the intensity of the green component of a Color object. Read/write.
Index | Gets the ordinal position of a Color object in the Colors collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PaletteEntry | Gets or sets the red, green, blue, and flags components of a color. Read/write.
Red | Gets or sets the intensity of the red component of a Color object. Read/write.
Stat | Returns status information for an object. Read-only.


Color.Application Property (Visio)

 Copy code hover
[image]

Color.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Color object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Color.Blue Property (Visio)

 Copy code hover
[image]

Color.Blue Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the intensity of the blue component of a Color object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Blue

expression A variable that represents a Color object.

Return Value

Integer

Remarks

The Blue property can be a value from 0 to 255.

A color is represented by red, green, and blue components. It also has a flag that indicates how the color is to be used. These correspond to members of the Microsoft Windows PALETTEENTRY data structure. For details, search for "PALETTEENTRY" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Color.Document Property (Visio)

 Copy code hover
[image]

Color.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Color object.

Return Value

Document


Color.Flags Property (Visio)

 Copy code hover
[image]

Color.Flags Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the flags that specify how you use a Color object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Flags

expression A variable that represents a Color object.

Return Value

Integer

Remarks

The Flags property of a Color object corresponds to the peFlags member of a Microsoft Windows PALETTEENTRY data structure. For details, search for "PALETTEENTRY" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Color.Green Property (Visio)

 Copy code hover
[image]

Color.Green Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the intensity of the green component of a Color object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Green

expression A variable that represents a Color object.

Return Value

Integer

Remarks

The Green property can be a value from 0 to 255.

A color is represented by red, green, and blue components. It also has flags that indicate how the color is to be used. These correspond to members of the Microsoft Windows PALETTEENTRY data structure. For details, search for "PALETTEENTRY" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Color.Index Property (Visio)

 Copy code hover
[image]

Color.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Color object in the Colors collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Color object.

Return Value

Long

Remarks

The Colors collection is indexed starting with 0.


Color.ObjectType Property (Visio)

 Copy code hover
[image]

Color.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Color object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Color.PaletteEntry Property (Visio)

 Copy code hover
[image]

Color.PaletteEntry Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the red, green, blue, and flags components of a color. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .PaletteEntry

expression A variable that represents a Color object.

Return Value

Long

Remarks

A color is represented by 1-byte red, green, and blue components. It also has a 1-byte flags field that indicates how you use the color. These correspond to members of the Windows PALETTEENTRY data structure. For details, search for "PALETTEENTRY" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.

The value passed is four tightly packed BYTE fields. The correspondence between the PaletteEntry property and red, green, blue, and flags values is:

VBA Copy code Copy code
    paletteentry == r+256(b+256(g+256f))


Color.Red Property (Visio)

 Copy code hover
[image]

Color.Red Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the intensity of the red component of a Color object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Red

expression A variable that represents a Color object.

Return Value

Integer

Remarks

The Red property can be a value from zero (0) to 255.

A color is represented by red, green, and blue components. It also has flags that indicate how the color is to be used. These correspond to members of the Microsoft Windows PALETTEENTRY data structure. For details, search for "PALETTEENTRY" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Color.Stat Property (Visio)

 Copy code hover
[image]

Color.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Color object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Colors Object (Visio)

 Copy code hover
[image]

Colors Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Color object for each color in the palette for a Microsoft Visio document.

Version Information

Version Added: Visio 4.0

Remarks

To retrieve a Colors collection, use the Colors property of a Document object.

The default property of Colors is Item.


Colors Members (Visio)

 Copy code hover
[image]

Colors Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Color object for each color in the palette for a Microsoft Visio document.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.


Colors Properties (Visio)

 Copy code hover
[image]

Colors Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.


Colors.Application Property (Visio)

 Copy code hover
[image]

Colors.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Colors object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Colors.Count Property (Visio)

 Copy code hover
[image]

Colors.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Colors object.

Return Value

Long

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Colors.Document Property (Visio)

 Copy code hover
[image]

Colors.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Colors object.

Return Value

Document


Colors.Item Property (Visio)

 Copy code hover
[image]

Colors.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(Index)

expression A variable that represents a Colors collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Contains the index of the object to retrieve.

Return Value

Color

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


Colors.ObjectType Property (Visio)

 Copy code hover
[image]

Colors.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Colors object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Colors.Stat Property (Visio)

 Copy code hover
[image]

Colors.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Colors object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Comment Object (Visio)

 Copy code hover
[image]

Comment Object (Visio)
See also Send feedback

Published: July 16, 2012

Represents a single comment in a Visio document.

See also

Other resources

Comment Object Members


Comment Members (Visio)

 Copy code hover
[image]

Comment Members (Visio)
Send feedback

Published: July 16, 2012

Represents a single comment in a Visio document.

Methods

Name | Description
Delete | Deletes the specified comment.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
AssociatedObject | Returns the object associated with the specified comment. Read-only Object.
AuthorInitials | Returns the initials of the author of the specified comment. Read-only String.
AuthorName | Returns the name of the author of the comment. Read-only String.
AuthorSipAddress | Returns the SIP (Session Initiation Protocol) address of the author of the comment. Read-only String.
AuthorSMTPAddress | Returns the SMTP (Simple Mail Transfer Protocol) address of the author of the comment. Read-only String.
Collapsed | Returns or sets whether the specified comment is collapsed. Read-write Boolean.
CreateDate | Returns the date the specified comment was created. Read-only Date.
Document | Returns the document that contains the comment. Read-only Document.
EditDate | Returns the most recent date on which the specified comment was edited. Read-only Date.
ObjectType | Returns visObjTypeComment, the type of a Comment object. Read-only.
Stat | Returns status information for an object. Read-only Integer.
Text | Returns or sets the text of the specified comment. Read/write String.


Comment Properties (Visio)

 Copy code hover
[image]

Comment Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
AssociatedObject | Returns the object associated with the specified comment. Read-only Object.
AuthorInitials | Returns the initials of the author of the specified comment. Read-only String.
AuthorName | Returns the name of the author of the comment. Read-only String.
AuthorSipAddress | Returns the SIP (Session Initiation Protocol) address of the author of the comment. Read-only String.
AuthorSMTPAddress | Returns the SMTP (Simple Mail Transfer Protocol) address of the author of the comment. Read-only String.
Collapsed | Returns or sets whether the specified comment is collapsed. Read-write Boolean.
CreateDate | Returns the date the specified comment was created. Read-only Date.
Document | Returns the document that contains the comment. Read-only Document.
EditDate | Returns the most recent date on which the specified comment was edited. Read-only Date.
ObjectType | Returns visObjTypeComment, the type of a Comment object. Read-only.
Stat | Returns status information for an object. Read-only Integer.
Text | Returns or sets the text of the specified comment. Read/write String.


Comment.Application Property (Visio)

 Copy code hover
[image]

Comment.Application Property (Visio)
See also Send feedback

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Syntax

expression .Application

expression A variable that represents a Comment object.

See also

Other resources

Comment Object


Comment.AssociatedObject Property (Visio)

 Copy code hover
[image]

Comment.AssociatedObject Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns the object associated with the specified comment. Read-only Object.

Syntax

expression .AssociatedObject

expression A variable that represents a Comment object.

Property value

OBJECT

See also

Other resources

Comment Object


Comment.AuthorInitials Property (Visio)

 Copy code hover
[image]

Comment.AuthorInitials Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns the initials of the author of the specified comment. Read-only String.

Syntax

expression .AuthorInitials

expression A variable that represents a Comment object.

Property value

STRING

See also

Other resources

Comment Object


Comment.AuthorName Property (Visio)

 Copy code hover
[image]

Comment.AuthorName Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns the name of the author of the comment. Read-only String.

Syntax

expression .AuthorName

expression A variable that represents a Comment object.

Property value

STRING

See also

Other resources

Comment Object


Comment.AuthorSipAddress Property (Visio)

 Copy code hover
[image]

Comment.AuthorSipAddress Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns the SIP (Session Initiation Protocol) address of the author of the comment. Read-only String.

Syntax

expression .AuthorSipAddress

expression A variable that represents a Comment object.

Property value

STRING

See also

Other resources

Comment Object


Comment.AuthorSMTPAddress Property (Visio)

 Copy code hover
[image]

Comment.AuthorSMTPAddress Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns the SMTP (Simple Mail Transfer Protocol) address of the author of the comment. Read-only String.

Syntax

expression .AuthorSMTPAddress

expression A variable that represents a Comment object.

Property value

STRING

See also

Other resources

Comment Object


Comment.Collapsed Property (Visio)

 Copy code hover
[image]

Comment.Collapsed Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the specified comment is collapsed. Read-write Boolean.

Syntax

expression .Collapsed

expression A variable that represents a Comment object.

Property value

BOOL

See also

Other resources

Comment Object


Comment.CreateDate Property (Visio)

 Copy code hover
[image]

Comment.CreateDate Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns the date the specified comment was created. Read-only Date.

Syntax

expression .CreateDate

expression A variable that represents a Comment object.

Property value

DATE

See also

Other resources

Comment Object


Comment.Document Property (Visio)

 Copy code hover
[image]

Comment.Document Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns the document that contains the comment. Read-only Document.

Syntax

expression .Document

expression A variable that represents a Comment object.

Property value

IVDOCUMENT

See also

Other resources

Comment Object


Comment.EditDate Property (Visio)

 Copy code hover
[image]

Comment.EditDate Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns the most recent date on which the specified comment was edited. Read-only Date.

Syntax

expression .EditDate

expression A variable that represents a Comment object.

Property value

DATE

See also

Other resources

Comment Object


Comment.ObjectType Property (Visio)

 Copy code hover
[image]

Comment.ObjectType Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns visObjTypeComment, the type of a Comment object. Read-only.

Syntax

expression .ObjectType

expression A variable that represents a Comment object.

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Property value

INT16

See also

Other resources

Comment Object


Comment.Stat Property (Visio)

 Copy code hover
[image]

Comment.Stat Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only Integer.

Syntax

expression .Stat

expression A variable that represents a Comment object.

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Property value

INT16

See also

Other resources

Comment Object


Comment.Text Property (Visio)

 Copy code hover
[image]

Comment.Text Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns or sets the text of the specified comment. Read/write String.

Syntax

expression .Text

expression A variable that represents a Comment object.

Property value

STRING

See also

Other resources

Comment Object


Comment Methods (Visio)

 Copy code hover
[image]

Comment Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified comment.


Comment.Delete Method (Visio)

 Copy code hover
[image]

Comment.Delete Method (Visio)
See also Send feedback

Published: July 16, 2012

Deletes the specified comment.

Syntax

expression .Delete

expression A variable that represents a Comment object.

Return value

VOID

See also

Other resources

Comment Object


Comments Object (Visio)

 Copy code hover
[image]

Comments Object (Visio)
See also Send feedback

Includes a Comment object for each comment in a Microsoft Visio document.

See also

Other resources

Comments Members


Comments Members (Visio)

 Copy code hover
[image]

Comments Members (Visio)
Send feedback

Includes a Comment object for each comment in a Microsoft Visio document.

Methods

Name | Description
Add | Adds a new Comment object to the Comments collection, and returns the new object.
DeleteAll | Deletes all the comments from the active document.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only Long.
Document | Returns the Document object that is associated with an object. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only Comment.
ObjectType | Returns visObjTypeComments, the type of a Comments object. Read-only.
Stat | Returns status information for an object. Read-only Integer.


Comments Properties (Visio)

 Copy code hover
[image]

Comments Properties (Visio)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only Long.
Document | Returns the Document object that is associated with an object. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only Comment.
ObjectType | Returns visObjTypeComments, the type of a Comments object. Read-only.
Stat | Returns status information for an object. Read-only Integer.


Comments.Application Property (Visio)

 Copy code hover
[image]

Comments.Application Property (Visio)
See also Send feedback

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Syntax

expression .Application

expression A variable that represents a Comments object.

See also

Other resources

Comments Collection


Comments.Count Property (Visio)

 Copy code hover
[image]

Comments.Count Property (Visio)
See also Send feedback

Returns the number of objects in a collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a Comments object.

Property value

INT32

See also

Other resources

Comments Collection


Comments.Document Property (Visio)

 Copy code hover
[image]

Comments.Document Property (Visio)
See also Send feedback

Returns the Document object that is associated with an object. Read-only.

Syntax

expression .Document

expression A variable that represents a Comments object.

Property value

IVDOCUMENT

See also

Other resources

Comments Collection


Comments.Item Property (Visio)

 Copy code hover
[image]

Comments.Item Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns an object from a collection. The Item property is the default property for all collections. Read-only Comment.

Syntax

expression .Item

expression A variable that represents a Comments object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Contains the index of the object to retrieve.

Return Value

Comment

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)

Property value

IVCOMMENT

See also

Other resources

Comments Collection


Comments.ObjectType Property (Visio)

 Copy code hover
[image]

Comments.ObjectType Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns visObjTypeComments, the type of a Comments object. Read-only.

Syntax

expression .ObjectType

expression A variable that represents a Comments object.

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Property value

INT16

See also

Other resources

Comments Collection


Comments.Stat Property (Visio)

 Copy code hover
[image]

Comments.Stat Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only Integer.

Syntax

expression .Stat

expression A variable that represents a Comments object.

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Property value

INT16

See also

Other resources

Comments Collection


Comments Methods (Visio)

 Copy code hover
[image]

Comments Methods (Visio)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new Comment object to the Comments collection, and returns the new object.
DeleteAll | Deletes all the comments from the active document.


Comments.Add Method (Visio)

 Copy code hover
[image]

Comments.Add Method (Visio)
See also Send feedback

Adds a new Comment object to the Comments collection, and returns the new object.

Syntax

expression .Add(Text)

expression A variable that represents a Comments object.

Parameters

Name | Required/Optional | Data type | Description
Text | Required | STRING | The text of the comment to add.

Return value

COMMENT

See also

Other resources

Comments Collection


Comments.DeleteAll Method (Visio)

 Copy code hover
[image]

Comments.DeleteAll Method (Visio)
See also Send feedback

Deletes all the comments from the active document.

Syntax

expression .DeleteAll

expression A variable that represents a Comments object.

Parameters

Name | Required/Optional | Data type | Description

Return value

VOID

See also

Other resources

Comments Collection


Connect Object (Visio)

 Copy code hover
[image]

Connect Object (Visio)
Send feedback

Published: July 16, 2012

Represents a connection between two shapes in a drawing, such as a line and a box in an organization chart.

Version Information

Version Added: Visio 2.0

Remarks

Retrieve a Connect object from the Connects collection returned by the Connects and FromConnects properties of a Shape object, or the Connects collection of a Page or Master object.

The default property of a Connect object is FromSheet.

Use the GlueTo or GlueToPos method of a Cell object to connect one shape to another in a drawing.


Connect Members (Visio)

 Copy code hover
[image]

Connect Members (Visio)
Send feedback

Published: July 16, 2012

Represents a connection between two shapes in a drawing, such as a line and a box in an organization chart.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
FromCell | Returns the cell from which a connection originates. Read-only.
FromPart | Returns the part of a shape from which a connection originates. Read-only.
FromSheet | Returns the shape from which a connection or connections originate. Read-only.
Index | Gets the ordinal position of a Connect object in the Connects collection. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.
ToCell | Gets the cell to which a connection is made. Read-only.
ToPart | Returns the part of a shape to which a connection is made. Read-only.
ToSheet | Returns the shape to which one or more connections are made. Read-only.


Connect Properties (Visio)

 Copy code hover
[image]

Connect Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
FromCell | Returns the cell from which a connection originates. Read-only.
FromPart | Returns the part of a shape from which a connection originates. Read-only.
FromSheet | Returns the shape from which a connection or connections originate. Read-only.
Index | Gets the ordinal position of a Connect object in the Connects collection. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.
ToCell | Gets the cell to which a connection is made. Read-only.
ToPart | Returns the part of a shape to which a connection is made. Read-only.
ToSheet | Returns the shape to which one or more connections are made. Read-only.


Connect.Application Property (Visio)

 Copy code hover
[image]

Connect.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Connect object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Connect.ContainingMasterID Property (Visio)

 Copy code hover
[image]

Connect.ContainingMasterID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the Master object that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingMasterID

expression A variable that represents a Connect object.

Return Value

Long

Remarks

If the object is not in a Master object, the ContainingMasterID property returns -1. For example, if a Shape object belongs to the Shapes collection of a Page object, the ContainingMasterID property returns -1.


Connect.ContainingPageID Property (Visio)

 Copy code hover
[image]

Connect.ContainingPageID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the page that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingPageID

expression A variable that represents a Connect object.

Return Value

Long

Remarks

If the object is not in a Page object, the ContainingPageID property returns -1. For example, if a Shape object belongs to a Masters collection, the ContainingPageID property returns -1.


Connect.Document Property (Visio)

 Copy code hover
[image]

Connect.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Connect object.

Return Value

Document


Connect.FromCell Property (Visio)

 Copy code hover
[image]

Connect.FromCell Property (Visio)
Send feedback

Published: July 16, 2012

Returns the cell from which a connection originates. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .FromCell

expression A variable that represents a Connect object.

Return Value

Cell

Remarks

A connection is defined by a reference in a cell in the shape from which the connection originates to a cell in the shape to which the connection is made. The FromCell property returns the Cell object for the cell from which the connection originates.

Following is a list of possible connections and the values of their related FromCell properties.

A connection is defined by a reference in a cell in the shape from which the connection originates to a cell in the shape to which the connection is made. The FromCell property returns the Cell object for the cell from which the connection originates.

Following is a list of possible connections and the values of their related FromCell properties.

From the begin or end cell of a 1-D shape to...

  • A connection point cell: The FromCell property returns either the BeginX or EndX cell, depending on which endpoint was glued.

  • A cell of a guide or guide point: When the begin or end cell of a 1-D shape is glued to a cell of a guide or guide point, two connections are created—one from the endpoint's X cell to the guide's Angle cell, and one from the endpoint's Y cell to the guide's Angle cell. The FromCell property of one Connect object returns the BeginX or EndX cell and, the FromCell property of the other Connect object returns the BeginY or EndY cell, depending on which endpoint is glued.

  • The pin of a 2-D shape (creates dynamic glue): The shape from which the glue originates must be routable or have a dynamic glue type. The FromCell property returns either the BeginX or EndX cell, depending on which endpoint was glued.

  • Any cell of a vertex row in a Geometry section: The FromCell property returns either the BeginX or EndX cell, depending on which endpoint was glued.

  • The begin or end cell of a 1-D shape: The FromCell property returns either the BeginX or EndX cell, depending on which endpoint was glued.

  • The edge (a cell in the Alignment section) of a 2-D shape: The FromCell property returns either the BeginX or EndX cell, depending on which endpoint was glued.

From the edge (a cell in the Alignment section) of a 2-D shape to a cell of a guide or guide point:

The FromCell property returns the Alignment cell that is glued to the guide.

From an outward or inward/outward connection point cell of a 1-D shape to an inward or inward/outward connection point cell that is not a cell of a guide or guide point:

When these cells are glued, two connections are created—one from the BeginX cell of the 1-D shape to the Connections.Xi cell, and the other from the EndX cell of the 1-D shape to the Connections.Yi cell. The FromCell property returns BeginX for one Connect object, and EndX for the other.

From an outward or inward/outward connection point cell of a 2-D shape to an inward or inward/outward type connection point cell that is not a cell of a guide or guide point:

If the outward connection point is directionless, the FromCell property returns the PinX cell. If the outward connection point has a direction, then two connection points are created. The FromCell property returns the Angle cell for one Connect object and the PinX cell for the other.

From a control point cell to...

  • A connection point cell: The FromCell property returns the Controls.Xi cell.

  • A cell of a guide or guide point: When a control point is glued to a cell of a guide or guide point other than a connection point cell, two connections are created. The FromCell property of one Connect object returns Controls.Xi and the second Connect object returns Controls.Yi.

  • Any cell of a vertex row in a Geometry section: The FromCell property returns the Controls.Xi cell.

  • The begin or end cell of a 1-D shape that isn't a guide or guide point: The FromCell property returns the Controls.Xi cell.

  • The edge (a cell in the Alignment section) of a 2-D shape: The FromCell property returns the Controls.Xi cell.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to extract connection information from a Microsoft Visio drawing. The example displays the connection information in the Immediate window.

This example assumes there is an active document that contains at least two connected shapes.

VBA Copy code Copy code

Public Sub FromCell_Example()

    Dim vsoShapes As Visio.Shapes
    Dim vsoShape As Visio.Shape
    Dim vsoConnectCell As Visio.Cell
    Dim vsoConnects As Visio.Connects
    Dim vsoConnect As Visio.Connect
    Dim intCurrentShapeID As Integer
    Dim intCounter As Integer
    Set vsoShapes = ActivePage.Shapes

    'For each shape on the page, get all its connections.
    For intCurrentShapeIndex = 1 To vsoShapes.Count
        Set vsoShape = vsoShapes(intCurrentShapeIndex)
        Set vsoConnects = vsoShape.Connects

        'For each connection, get the cell the connection
        'originates from, and print its name in the Immediate window.
        For intCounter = 1 To vsoConnects.Count
            Set vsoConnect = vsoConnects(intCounter)
            Set vsoConnectCell = vsoConnect.FromCell
            Debug.Print "From " & vsoConnectCell.Name
        Next intCounter

    Next intCurrentShapeIndex

End Sub


Connect.FromPart Property (Visio)

 Copy code hover
[image]

Connect.FromPart Property (Visio)
Send feedback

Published: July 16, 2012

Returns the part of a shape from which a connection originates. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .FromPart

expression A variable that represents a Connect object.

Return Value

Integer

Remarks

The following constants declared by the Microsoft Visio type library show return values for the FromPart property.

Constant | Value
visConnectFromError | -1
visFromNone | 0
visLeftEdge | 1
visCenterEdge | 2
visRightEdge | 3
visBottomEdge | 4
visMiddleEdge | 5
visTopEdge | 6
visBeginX | 7
visBeginY | 8
visBegin | 9
visEndX | 10
visEndY | 11
visEnd | 12
visFromAngle | 13
visFromPin | 14
visControlPoint | 100 + zero-based row index (for example, visControlPoint = 100 if the control point is in row 0; visControlPoint = 101 if the control point is in row 1)

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to extract connection information from a Visio drawing. The example displays the connection information in the Immediate window.

This example assumes there is an active document that contains at least two connected shapes.

VBA Copy code Copy code

Public Sub FromPart_Example()

 Dim vsoShapes As Visio.Shapes
 Dim vsoShape As Visio.Shape
 Dim vsoConnectFrom As Visio.Shape
 Dim intFromData As Integer
 Dim strFrom As String
 Dim vsoConnects As Visio.Connects
 Dim vsoConnect As Visio.Connect
 Dim intCurrentShapeIndex As Integer
 Dim intCounter As Integer
 Set vsoShapes = ActivePage.Shapes

 'For each shape on the page, get its connections.
 For intCurrentShapeIndex = 1 To vsoShapes.Count
 Set vsoShape = vsoShapes(intCurrentShapeIndex)
 Set vsoConnects = vsoShape.Connects

 'For each connection, get the shape it originates from
 'and the part of the shape it originates from,
 'and print that information in the Immediate window.
 For intCounter = 1 To vsoConnects.Count
 Set vsoConnect = vsoConnects(intCounter)
 Set vsoConnectFrom = vsoConnect.FromSheet
 intFromData = vsoConnect.FromPart

 'FromPart property values
 If intFromData = visConnectError Then
 strFrom = "error"
 ElseIf intFromData = visNone Then
 strFrom = "none"
 ElseIf intFromData = visLeftEdge Then
 strFrom = "left"
 ElseIf intFromData = visCenterEdge Then
 strFrom = "center"
 ElseIf intFromData = visRightEdge Then
 strFrom = "right"
 ElseIf intFromData = visBottomEdge Then
 strFrom = "bottom"
 ElseIf intFromData = visMiddleEdge Then
 strFrom = "middle"
 ElseIf intFromData = visTopEdge Then
 strFrom = "top"
 ElseIf intFromData = visBeginX Then
 strFrom = "beginX"
 ElseIf intFromData = visBeginY Then
 strFrom = "beginY"
 ElseIf intFromData = visBegin Then
 strFrom = "begin"
 ElseIf intFromData = visEndX Then
 strFrom = "endX"
 ElseIf intFromData = visEndY Then
 strFrom = "endY"
 ElseIf intFromData = visEnd Then
 strFrom = "end"
 ElseIf intFromData >= visControlPoint Then
 strFrom = "controlPt_" & _
 Str(intFromData - visControlPoint + 1)
 Else
 strFrom = "???"
 End If

 Debug.Print vsoConnectFrom.Name & " " & strFrom

 Next intCounter

 Next intCurrentShapeIndex

End Sub


Connect.FromSheet Property (Visio)

 Copy code hover
[image]

Connect.FromSheet Property (Visio)
Send feedback

Published: July 16, 2012

Returns the shape from which a connection or connections originate. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .FromSheet

expression A variable that represents a Connect object.

Return Value

Shape

Remarks

The FromSheet property for a Connect object is straightforward. It always returns the shape from which the Connect object originates.

A Connects collection represents several connections. If every connection represented by the collection originates from the same shape, the FromSheet property for the collection returns that shape. Otherwise, the FromSheet property returns Nothing and does not raise an exception.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the FromSheet property to find the shape a Connect object originates from in a Microsoft Visio drawing. The example displays the connection information in the Immediate window.

This example assumes there is an active document that contains at least two connected shapes. For best results, connect two shapes from the Organization Chart Shapes stencil.

VBA Copy code Copy code

Public Sub FromSheet_Example()

 Dim vsoShapes As Visio.Shapes
 Dim vsoShape As Visio.Shape
 Dim vsoConnectFrom As Visio.Shape
 Dim vsoConnects As Visio.Connects
 Dim vsoConnect As Visio.Connect
 Dim intCurrentShapeIndex As Integer
 Dim intCounter As Integer

 Set vsoShapes = ActivePage.Shapes

 For intCurrentShapeIndex = 1 To vsoShapes.Count
 Set vsoShape = vsoShapes(intCurrentShapeIndex)
 Set vsoConnects = vsoShape.Connects

 For intCounter = 1 To vsoConnects.Count
 Set vsoConnect = vsoConnects(intCounter)
 Set vsoConnectFrom = vsoConnect.FromSheet

 'Print the name of the shape the
 'Connect object originates from.
 Debug.Print vsoConnectFrom.Name

 Next intCounter

 Next intCurrentShapeIndex

End Sub


Connect.Index Property (Visio)

 Copy code hover
[image]

Connect.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Connect object in the Connects collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Connect object.

Return Value

Long

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Connect.ObjectType Property (Visio)

 Copy code hover
[image]

Connect.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Connect object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Connect.Stat Property (Visio)

 Copy code hover
[image]

Connect.Stat Property (Visio)
Send feedback

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Connect object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Connect.ToCell Property (Visio)

 Copy code hover
[image]

Connect.ToCell Property (Visio)
Send feedback

Gets the cell to which a connection is made. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ToCell

expression A variable that represents a Connect object.

Return Value

Cell

Remarks

A connection is defined by a reference in a cell in the shape from which the connection originates to a cell in the shape to which the connection is made. The ToCell property returns the Cell object to which the connection is made.

Following is a list of possible connections and their related ToCell property values.

From the begin or end cell of a 1-D shape to...

  • A connection point cell: The ToCell property returns the Connection.Xi cell.

  • A cell of a guide or guide point: When the begin or end cell of a 1-D shape is glued to a cell of a guide or guide point, two connections are created—one from the endpoint's X cell to the guide's Angle cell, and the other from the endpoint's Y cell to the guide's Angle cell. The ToCell property of both Connect objects returns the Angle cell.

  • The pin of a 2-D shape (creates dynamic glue): The ToCell property returns the PinX cell.

  • Any cell of a vertex row in a Geometry section: A new connection point is created and the ToCell property returns the Connections.Xi cell.

  • The begin or end cell of a 1-D shape: A new connection point is created and the ToCell property returns the Connections.Xi cell.

  • The edge (a cell in the Alignment section) of a 2-D shape: A new connection point is created and the ToCell property returns the Connections.Xi cell.

From the edge (a cell in the Alignment section) of a 2-D shape to acell of a guide or guide point: The ToCell property returns the Angle cell.

From an outward or inward/outward connection point cell of a 1-D shape to An inward or inward/outward connection point cell that is not a cell of a guide or guide point: When these cells are glued, two connections are created—one from the BeginX cell of the 1-D shape to the Connections.Xi cell, and the other from the EndX cell of the 1-D shape to the Connections.Yi cell. The ToCell property returns Connections.Xi for the first Connect object and Connections.Yi for the other.

From an outward or inward/outward connection point cell of a 2-D shape that is not a guide or guide point to an inward or inward/outward type connection point cell that is not a cell of a guide or guide point: If the outward connection point is directionless, the ToCell property returns the Connections.Xi cell. If the outward connection point has a direction, two connection points are created. The ToCell property returns the Connections.Xi cell for both Connect objects.

From a control handle to...

  • A connection point cell: The ToCell property returns the Connections.Xi cell.

  • A cell of a guide or guide point: When a control point is glued to a cell of a guide or guide point, two connections are created—one from the control point's X cell to the guide's PinX and the other from the control point's Y cell to the guide's PinY cell. The ToCell property of the first Connect object returns the guide's PinX cell and, for the second Connect object, the guide's PinY cell.

  • Any cell of a vertex row in a Geometry section: A new connection point is created and the ToCell property returns the Connections.Xi cell.

  • The begin or end cell of a 1-D shape: A new connection point is created and the ToCell property returns the Connections.Xi cell.

  • The edge (a cell in the Alignment section) of a 2-D shape: A new connection point is created and the ToCell property returns the Connections.Xi cell.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to extract connection information from a Microsoft Visio drawing. The example displays the connection information in the Immediate window.

This example assumes there is an active document that contains at least two connected shapes.

VBA Copy code Copy code

Public Sub ToCell_Example()

 Dim vso1DShape As Visio.Shape
 Dim vso2DShape1 As Visio.Shape
 Dim vso2DShape2 As Visio.Shape
 Dim vsoCellGlueFromBegin As Visio.Cell
 Dim vsoCellGlueFromEnd As Visio.Cell
 Dim vsoCellGlueToObject As Visio.Cell
 Dim vsoCellGlueToObject2 As Visio.Cell

 Dim vsoShapes As Visio.Shapes
 Dim vsoShape As Visio.Shape
 Dim vsoConnects As Visio.Connects
 Dim vsoConnect As Visio.Connect
 Dim vsoConnectToCell As Visio.Cell
 Dim intCurrentShapeID As Integer
 Dim intCounter As Integer

 'Draw a line.
 Set vso1DShape = ActivePage.DrawLine(3, 5, 5, 3)

 'Draw the lower rectangle.
 Set vso2DShape1 = ActivePage.DrawRectangle(1, 1, 4, 2)

 'Draw the upper rectangle.
 Set vso2DShape2 = ActivePage.DrawRectangle(5, 5, 8, 6)

 'Get the Cell objects needed to make the connections.
 Set vsoCellGlueFromBegin = vso1DShape.Cells("BeginX")
 Set vsoCellGlueFromEnd = vso1DShape.Cells("EndX")
 Set vsoCellGlueToObject = vso2DShape1.Cells("Geometry1.X3")
 Set vsoCellGlueToObject2 = vso2DShape2.Cells("Geometry1.X1")

 'Use the GlueTo method to glue the begin point of the 1-D shape
 'to the top right vertex (Geometry1.X3) of the lower 2-D shape.
 vsoCellGlueFromBegin.GlueTo vsoCellGlueToObject

 'Use the GlueTo method to glue the endpoint of the 1-D shape
 'to the bottom left vertex (Geometry1.X1) of the upper 2-D shape.
 vsoCellGlueFromEnd.GlueTo vsoCellGlueToObject2

 Set vsoShapes = ActivePage.Shapes

 'For each shape on the page, get its connections.
 For intCurrentShapeID = 1 To vsoShapes.Count

 Set vsoShape = vsoShapes(intCurrentShapeID)
 Set vsoConnects = vsoShape.Connects

 'For each connection, get the cell it connects to.
 For intCounter = 1 To vsoConnects.Count

 Set vsoConnect = vsoConnects(intCounter)
 Set vsoConnectToCell = vsoConnect.ToCell

 'Print connect information in the Immediate window.
 Debug.Print " To "; vsoConnectToCell.Name

 Next intCounter

 Next intCurrentShapeID

End Sub


Connect.ToPart Property (Visio)

 Copy code hover
[image]

Connect.ToPart Property (Visio)
Send feedback

Returns the part of a shape to which a connection is made. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ToPart

expression A variable that represents a Connect object.

Return Value

Integer

Remarks

The ToPart property identifies the part of a shape to which another shape is glued, such as its begin point or endpoint, one of its edges, or a connection point. The following constants declared by the Visio type library in member VisToParts show possible return values for the ToPart property.

Constant | Value
visConnectToError | -1
visToNone | 0
visGuideX | 1
visGuideY | 2
visWholeShape | 3
visGuideIntersect | 4
visToAngle | 7
visConnectionPoint | 100 + row index of connection point

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to extract connection information from a Microsoft Visio drawing. The example displays the connection information in the Immediate window.

This example assumes there is an active document that contains at least two connected shapes.

VBA Copy code Copy code

Public Sub ToPart_Example()

 Dim vsoShapes As Visio.Shapes
 Dim vsoShape As Visio.Shape
 Dim vsoConnectTo As Visio.Shape
 Dim intToData As Integer
 Dim strTo As String
 Dim vsoConnects As Visio.Connects
 Dim vsoConnect As Visio.Connect
 Dim intCurrentShapeID As Integer
 Dim intCounter As Integer

 Set vsoShapes = ActivePage.Shapes

 'For each shape on the page, get its connections.
 For intCurrentShapeID = 1 To vsoShapes.Count

 Set vsoShape = vsoShapes(intCurrentShapeID)
 Set vsoConnects = vsoShape.Connects

 'For each connection, get the shape it connects to
 'and the part of the shape it connects to,
 'and print that information in the Immediate window.
 For intCounter = 1 To vsoConnects.Count

 Set vsoConnect = vsoConnects(intCounter)
 Set vsoConnectTo = vsoConnect.ToSheet
 intToData = vsoConnect.ToPart

 If intToData = visConnectError Then
 strTo = "error"
 ElseIf intToData = visNone Then
 strTo = "none"
 ElseIf intToData = visGuideX Then
 strTo = "guideX"
 ElseIf intToData = visGuideY Then
 strTo = "guideY"
 ElseIf intToData = visWholeShape Then
 strTo = "dynamic glue"
 ElseIf intToData >= visConnectionPoint Then
 strTo = "connection point " & _
 CStr(intToData - visConnectionPoint + 1)
 Else
 strTo = "???"
 End If

 'Print the name and part of the shape the
 'Connect object connects to.
 Debug.Print "To "; vsoConnectTo.Name & " " & strTo & "."

 Next intCounter

 Next intCurrentShapeID

End Sub


Connect.ToSheet Property (Visio)

 Copy code hover
[image]

Connect.ToSheet Property (Visio)
Send feedback

Returns the shape to which one or more connections are made. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ToSheet

expression A variable that represents a Connect object.

Return Value

Shape

Remarks

The ToSheet property for a Connect object always returns the shape to which the connection is made.

The Connects collection represents several connections. If every connection represented by the collection is made to the same shape, the ToSheet property returns that shape. Otherwise, it returns Nothing and does not raise an exception.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ToSheet property to find the shape a Connect object originates from in a Microsoft Visio drawing. The example displays the connection information in the Immediate window.

This example assumes there is an active document that contains at least two connected shapes. For best results, connect two shapes from the Organization Chart Shapes stencil.

VBA Copy code Copy code

Public Sub ToSheet_Example()

 Dim vsoShapes As Visio.Shapes
 Dim vsoShape As Visio.Shape
 Dim vsoConnectTo As Visio.Shape
 Dim vsoConnects As Visio.Connects
 Dim vsoConnect As Visio.Connect
 Dim intCurrentShapeIndex As Integer
 Dim intCounter As Integer
 Set vsoShapes = ActivePage.Shapes

 'For each shape on the page, get its connections.
 For intCurrentShapeIndex = 1 To vsoShapes.Count

 Set vsoShape = vsoShapes(intCurrentShapeIndex)
 Set vsoConnects = vsoShape.Connects

 'For each connection, get the shape it connects to.
 For intCounter = 1 To vsoConnects.Count

 Set vsoConnect = vsoConnects(intCounter)
 Set vsoConnectTo = vsoConnect.ToSheet

 'Print the name of the shape the
 'Connect object connects to.
 Debug.Print vsoConnectTo.Name

 Next intCounter

 Next intCurrentShapeIndex

End Sub


Connects Object (Visio)

 Copy code hover
[image]

Connects Object (Visio)
Send feedback

Includes a Connect object for each connection between two shapes in a drawing, such as a line and a box in an organization chart.

Remarks

The default property of a Connects collection is Item.

Use the Connects property of a Shape object to retrieve a Connects collection with a Connect object for every Shape object to which the indicated Shape object is connected (glued).

Use the FromConnects property of a Shape object to retrieve a Connects collection with a Connect object for every Shape object that is connected (glued) to the indicated Shape object.

Use the Connects property of a Page object to retrieve a Connects collection with an entry for every connection on the Page object.

Use the Connects property of a Master object to retrieve a Connects collection with an entry for every connection in the Master object.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this collection maps to the following types:

  • Microsoft.Office.Interop.Visio.IVConnects.GetEnumerator() (to enumerate the Connect objects.)


Connects Members (Visio)

 Copy code hover
[image]

Connects Members (Visio)
Send feedback

Includes a Connect object for each connection between two shapes in a drawing, such as a line and a box in an organization chart.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
FromSheet | Returns the shape from which a connection or connections originate. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.
ToSheet | Returns the shape to which one or more connections are made. Read-only.


Connects Properties (Visio)

 Copy code hover
[image]

Connects Properties (Visio)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
FromSheet | Returns the shape from which a connection or connections originate. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.
ToSheet | Returns the shape to which one or more connections are made. Read-only.


Connects.Application Property (Visio)

 Copy code hover
[image]

Connects.Application Property (Visio)
Send feedback

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Connects object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Connects.Count Property (Visio)

 Copy code hover
[image]

Connects.Count Property (Visio)
Send feedback

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Connects object.

Return Value

Long

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Connects.Document Property (Visio)

 Copy code hover
[image]

Connects.Document Property (Visio)
Send feedback

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Connects object.

Return Value

Document


Connects.FromSheet Property (Visio)

 Copy code hover
[image]

Connects.FromSheet Property (Visio)
Send feedback

Returns the shape from which a connection or connections originate. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .FromSheet

expression A variable that represents a Connects object.

Return Value

Shape

Remarks

The FromSheet property for a Connect object is straightforward. It always returns the shape from which the Connect object originates.

A Connects collection represents several connections. If every connection represented by the collection originates from the same shape, the FromSheet property for the collection returns that shape. Otherwise, the FromSheet property returns Nothing and does not raise an exception.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the FromSheet property to find the shape a Connect object originates from in a Microsoft Visio drawing. The example displays the connection information in the Immediate window.

This example assumes there is an active document that contains at least two connected shapes. For best results, connect two shapes from the Organization Chart Shapes stencil.

VBA Copy code Copy code

Public Sub FromSheet_Example()

 Dim vsoShapes As Visio.Shapes
 Dim vsoShape As Visio.Shape
 Dim vsoConnectFrom As Visio.Shape
 Dim vsoConnects As Visio.Connects
 Dim vsoConnect As Visio.Connect
 Dim intCurrentShapeIndex As Integer
 Dim intCounter As Integer

 Set vsoShapes = ActivePage.Shapes

 For intCurrentShapeIndex = 1 To vsoShapes.Count
 Set vsoShape = vsoShapes(intCurrentShapeIndex)
 Set vsoConnects = vsoShape.Connects

 For intCounter = 1 To vsoConnects.Count
 Set vsoConnect = vsoConnects(intCounter)
 Set vsoConnectFrom = vsoConnect.FromSheet

 'Print the name of the shape the
 'Connect object originates from.
 Debug.Print vsoConnectFrom.Name

 Next intCounter

 Next intCurrentShapeIndex

End Sub


Connects.Item Property (Visio)

 Copy code hover
[image]

Connects.Item Property (Visio)
Send feedback

Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(Index)

expression A variable that represents a Connects collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Contains the index of the object to retrieve.

Return Value

Connect

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


Connects.ObjectType Property (Visio)

 Copy code hover
[image]

Connects.ObjectType Property (Visio)
Send feedback

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Connects object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Connects.Stat Property (Visio)

 Copy code hover
[image]

Connects.Stat Property (Visio)
Send feedback

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Connects object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Connects.ToSheet Property (Visio)

 Copy code hover
[image]

Connects.ToSheet Property (Visio)
Send feedback

Published: July 16, 2012

Returns the shape to which one or more connections are made. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ToSheet

expression A variable that represents a Connects object.

Return Value

Shape

Remarks

The ToSheet property for a Connect object always returns the shape to which the connection is made.

The Connects collection represents several connections. If every connection represented by the collection is made to the same shape, the ToSheet property returns that shape. Otherwise, it returns Nothing and does not raise an exception.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ToSheet property to find the shape a Connect object originates from in a Microsoft Visio drawing. The example displays the connection information in the Immediate window.

This example assumes there is an active document that contains at least two connected shapes. For best results, connect two shapes from the Organization Chart Shapes stencil.

VBA Copy code Copy code

Public Sub ToSheet_Example()

 Dim vsoShapes As Visio.Shapes
 Dim vsoShape As Visio.Shape
 Dim vsoConnectTo As Visio.Shape
 Dim vsoConnects As Visio.Connects
 Dim vsoConnect As Visio.Connect
 Dim intCurrentShapeIndex As Integer
 Dim intCounter As Integer
 Set vsoShapes = ActivePage.Shapes

 'For each shape on the page, get its connections.
 For intCurrentShapeIndex = 1 To vsoShapes.Count

 Set vsoShape = vsoShapes(intCurrentShapeIndex)
 Set vsoConnects = vsoShape.Connects

 'For each connection, get the shape it connects to.
 For intCounter = 1 To vsoConnects.Count

 Set vsoConnect = vsoConnects(intCounter)
 Set vsoConnectTo = vsoConnect.ToSheet

 'Print the name of the shape the
 'Connect object connects to.
 Debug.Print vsoConnectTo.Name

 Next intCounter

 Next intCurrentShapeIndex

End Sub


ContainerProperties Object (Visio)

 Copy code hover
[image]

ContainerProperties Object (Visio)
Send feedback

Published: July 16, 2012

Represents the set of properties that are specific to a container.

Version Information

Version Added: Visio 2010

Remarks

A container is a shape that has some specific properties that are represented conceptually by a ContainerProperties object. Containers appear as collections of shapes surrounded by borders that are sometimes, but not always, visible. Some, but not all, containers are lists.

You can use the Shape.ContainerProperties property to get a ContainerProperties object that represents the set of container properties of any shape, whether or not it is actually a container.

To create an instance of a container shape on the drawing page, use the Page.DropContainer method.


ContainerProperties Members (Visio)

 Copy code hover
[image]

ContainerProperties Members (Visio)
Send feedback

Published: July 16, 2012

Represents the set of properties that are specific to a container.

Methods

Name | Description
AddMember | Adds a shape or a set of shapes to the container.
Disband | Removes all member shapes from the container and deletes the container shape.
FitToContents | Forces the container to resize so as to tightly include all member shapes, including any applicable margins between the container and the shapes.
GetListMemberPosition | Returns the ordinal position of the specified shape in the list.
GetListMembers | Returns an array of shape identifiers (IDs) of member shapes in the list.
GetListSpacing | Returns the gap between adjacent member shapes in the list.
GetMargin | Returns the minimal distance, in the specified units, between the edges of the container or list and those of its member shapes.
GetMemberShapes | Returns the shape identifiers (IDs) of all members of the container, as specified.
GetMemberState | Returns the membership state of the specified shape with respect to the container shape.
InsertListMember | Adds a shape or set of shapes to the list in the container.
RemoveMember | Removes a shape or set of shapes from the container.
ReorderListMember | Moves a shape or a set of shapes up or down in the list.
RotateFlipList | Rotates or flips the list direction for a list of shapes.
SetListSpacing | Sets the gap between adjacent member shapes in the list.
SetMargin | Sets the gap between the container and member shapes to the specified size, in the specified units.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ContainerStyle | Determines the visual appearance of the container. Read/write.
ContainerType | Determines whether the container is a normal container or a list container. Read-only.
Document | Gets the Document object that is associated with the ContainerProperties object. Read-only.
HeadingStyle | Determines the appearance and position of the heading of the container. Read/write.
ListAlignment | Specifies how to align and arrange a list shape that you want positioned perpendicular to the main list direction. Read/write.
ListDirection | Determines the primary list direction of the container shapes. Read/write.
LockMembership | Gets or sets a value that determines whether container members can be added, removed, or deleted. Read/write.
ObjectType | Returns visObjTypeContainerProperties, the type of this object. Read-only.
OverlappedList | Creates or removes an overlapped list relationship with another list shape, or returns the target list shape that participates in an overlapped list relationship with the source list shape. Read/write.
ResizeAsNeeded | Determines whether the container boundary resizes automatically to fit its contents. Read/write.
Shape | Returns the Microsoft Visio Shape object that is associated with the container. Read-only.
Stat | Returns status information for an object. Read-only.


ContainerProperties Properties (Visio)

 Copy code hover
[image]

ContainerProperties Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ContainerStyle | Determines the visual appearance of the container. Read/write.
ContainerType | Determines whether the container is a normal container or a list container. Read-only.
Document | Gets the Document object that is associated with the ContainerProperties object. Read-only.
HeadingStyle | Determines the appearance and position of the heading of the container. Read/write.
ListAlignment | Specifies how to align and arrange a list shape that you want positioned perpendicular to the main list direction. Read/write.
ListDirection | Determines the primary list direction of the container shapes. Read/write.
LockMembership | Gets or sets a value that determines whether container members can be added, removed, or deleted. Read/write.
ObjectType | Returns visObjTypeContainerProperties, the type of this object. Read-only.
OverlappedList | Creates or removes an overlapped list relationship with another list shape, or returns the target list shape that participates in an overlapped list relationship with the source list shape. Read/write.
ResizeAsNeeded | Determines whether the container boundary resizes automatically to fit its contents. Read/write.
Shape | Returns the Microsoft Visio Shape object that is associated with the container. Read-only.
Stat | Returns status information for an object. Read-only.


ContainerProperties.Application Property (Visio)

 Copy code hover
[image]

ContainerProperties.Application Property (Visio)
Send feedback

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Application

expression A variable that represents a ContainerProperties object.

Return Value

Application


ContainerProperties.ContainerStyle Property (Visio)

 Copy code hover
[image]

ContainerProperties.ContainerStyle Property (Visio)
Send feedback

Determines the visual appearance of the container. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .ContainerStyle

expression An expression that returns a ContainerProperties object.

Return Value

Integer

Remarks

The value of the ContainerStyle property corresponds to the numerical identifier (ID) of the container style that is selected in the Container Styles gallery on the Container Tools Format tab.

The value of the ContainerStyle should always be greater than zero.

If no value is assigned to the ContainerStyle property or it is set to a null value, a runtime error ensues. A runtime error also ensues if you assign the property a value that is less than 1 or greater than the maximum ID number in the Container Styles gallery.


ContainerProperties.ContainerType Property (Visio)

 Copy code hover
[image]

ContainerProperties.ContainerType Property (Visio)
Send feedback

Determines whether the container is a normal container or a list container. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ContainerType

expression An expression that returns a ContainerProperties object.

Return Value

VisContainerTypes

Remarks

The value of the ContainerType property can be one of the following VisContainerTypes constants.

Constant | Value | Description
visContainerTypeNormal | 0 | Member shapes are not arranged in a list.
visContainerTypeList | 1 | Member shapes are arranged in a list.


ContainerProperties.Document Property (Visio)

 Copy code hover
[image]

ContainerProperties.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with the ContainerProperties object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Document

expression An expression that returns a ContainerProperties object.

Return Value

Document


ContainerProperties.HeadingStyle Property (Visio)

 Copy code hover
[image]

ContainerProperties.HeadingStyle Property (Visio)
Send feedback

Published: July 16, 2012

Determines the appearance and position of the heading of the container. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .HeadingStyle

expression An expression that returns a ContainerProperties object.

Return Value

Integer

Remarks

The value of the HeadingStyle property corresponds to the numerical identifier of the heading style that is selected in the Heading Styles gallery in the Container Styles group on the Container Tools Format tab.

The value of the HeadingStyle should always be greater than or equal to zero (0). A value of zero means that the container does not display a heading.

If no value is assigned to the HeadingStyle property or it is set to a null value, a runtime error ensues. A runtime error also ensues if you assign the property a value less than 0 or greater than the maximum ID number in the Heading Styles gallery.


ContainerProperties.ListAlignment Property (Visio)

 Copy code hover
[image]

ContainerProperties.ListAlignment Property (Visio)
Send feedback

Published: July 16, 2012

Specifies how to align and arrange a list shape that you want positioned perpendicular to the main list direction. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .ListAlignment

expression An expression that returns a ContainerProperties object.

Return Value

VisListAlignment

Remarks

Use the ListAlignment property to position shapes along the axis that is perpendicular to the primary list direction. For example, if the primary list direction is horizontal in a given list container, you can use the ListAlignment property to align a shape vertically in that container. The value of the ListAlignment property can be one of the following VisListAlignment constants.

Constant | Value | Description
visListAlignLeftOrTop | 0 | Left-align or top-align shapes.
visListDirCenterOrMiddle | 1 | Center-align or middle-align shapes.
visListDirRightOrBottom | 2 | Right-align or bottom-align shapes.

If the container is not a list, Microsoft Visio returns an Invalid Source error.


ContainerProperties.ListDirection Property (Visio)

 Copy code hover
[image]

ContainerProperties.ListDirection Property (Visio)
Send feedback

Published: July 16, 2012

Determines the primary list direction of the container shapes. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .ListDirection

expression An expression that returns a ContainerProperties object.

Return Value

VisListDirection

Remarks

The value of the ListDirection property can be one of the following VisListDirection constants.

Constant | Value | Description
visListDirLeftToRight | 0 | Shapes are arranged horizontally, from left to right.
visListDirRightToLeft | 1 | Shapes are arranged horizontally, from right to left.
visListDirTopToBottom | 2 | Shapes are arranged vertically, from top to bottom.
visListDirBottomToTop | 3 | Shapes are arranged vertically, from bottom to top.

If the container is not a list, Microsoft Visio returns an Invalid Source error.


ContainerProperties.LockMembership Property (Visio)

 Copy code hover
[image]

ContainerProperties.LockMembership Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets a value that determines whether container members can be added, removed, or deleted. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .LockMembership

expression An expression that returns a ContainerProperties object.

Return Value

Boolean

Remarks

For normal (non-list) containers, setting LockMembership to True does not prevent moving a container member; the container expands to include the moved member, assuming that the setting of ResizeAsNeeded is visContainerAutoResizeExpand or visContainerAutoResizeExpandContract. If ResizeAsNeeded is visContainerAutoResizeNone and you move a container member outside the outlines of the container, the shape remains a member, but the container does not expand to visibly contain it. You cannot add, remove, or delete a member from a locked container.

For list containers, setting LockMembership to True locks container members that are also list members, which prevents moving them and thus reordering of the members. It does not, however, prevent you from moving normal (non-list) members of the container out of the list (although not out of the container). You can also delete normal members.

The setting of the LockMembership property corresponds to the setting of Lock Container in the Membership group on the Container Tools Format tab.


ContainerProperties.ObjectType Property (Visio)

 Copy code hover
[image]

ContainerProperties.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeContainerProperties, the type of this object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression An expression that returns a ContainerProperties object.

Return Value

visObjTypeContainerProperties

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


ContainerProperties.OverlappedList Property (Visio)

 Copy code hover
[image]

ContainerProperties.OverlappedList Property (Visio)
Send feedback

Published: July 16, 2012

Creates or removes an overlapped list relationship with another list shape, or returns the target list shape that participates in an overlapped list relationship with the source list shape. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .OverlappedList

expression An expression that returns a ContainerProperties object.

Return Value

Shape

Remarks

To create an overlapped list relationship, set OverlappedList equal to the target list shape.

To remove an existing overlapped list relationship between the source list shape and the target list shape, set OverlappedList equal to Nothing.

OverlappedList returns Nothing if there is no existing overlapped list relationship between the source shape and any other shape.

OverlappedList returns an Invalid Source error if the source shape is not a list. It returns an Invalid Target error if the target shape is not a list.


ContainerProperties.ResizeAsNeeded Property (Visio)

 Copy code hover
[image]

ContainerProperties.ResizeAsNeeded Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the container boundary resizes automatically to fit its contents. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .ResizeAsNeeded

expression An expression that returns a ContainerProperties object.

Return Value

VisContainerAutoResize

Remarks

The value of the ResizeAsNeeded property can be one of the following VisContainerAutoResize constants.

Constant | Value | Description
visContainerAutoResizeNone | 0 | Do not automatically resize container.
visContainerAutoResizeExpand | 1 | Automatically expand the container size, but do not contract.
visContainerAutoResizeExpandContract | 2 | Automatically expand and contract the container size.

The setting of the ResizeAsNeeded property corresponds to the selection in the Automatic Resize drop-down list in the Size group on the Container Tools Format tab.


ContainerProperties.Shape Property (Visio)

 Copy code hover
[image]

ContainerProperties.Shape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Microsoft Visio Shape object that is associated with the container. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Shape

expression An expression that returns a ContainerProperties object.

Return Value

Shape


ContainerProperties.Stat Property (Visio)

 Copy code hover
[image]

ContainerProperties.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression An expression that represents a ContainerProperties object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


ContainerProperties Methods (Visio)

 Copy code hover
[image]

ContainerProperties Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddMember | Adds a shape or a set of shapes to the container.
Disband | Removes all member shapes from the container and deletes the container shape.
FitToContents | Forces the container to resize so as to tightly include all member shapes, including any applicable margins between the container and the shapes.
GetListMemberPosition | Returns the ordinal position of the specified shape in the list.
GetListMembers | Returns an array of shape identifiers (IDs) of member shapes in the list.
GetListSpacing | Returns the gap between adjacent member shapes in the list.
GetMargin | Returns the minimal distance, in the specified units, between the edges of the container or list and those of its member shapes.
GetMemberShapes | Returns the shape identifiers (IDs) of all members of the container, as specified.
GetMemberState | Returns the membership state of the specified shape with respect to the container shape.
InsertListMember | Adds a shape or set of shapes to the list in the container.
RemoveMember | Removes a shape or set of shapes from the container.
ReorderListMember | Moves a shape or a set of shapes up or down in the list.
RotateFlipList | Rotates or flips the list direction for a list of shapes.
SetListSpacing | Sets the gap between adjacent member shapes in the list.
SetMargin | Sets the gap between the container and member shapes to the specified size, in the specified units.


ContainerProperties.AddMember Method (Visio)

 Copy code hover
[image]

ContainerProperties.AddMember Method (Visio)
Send feedback

Adds a shape or a set of shapes to the container.

Version Information

Version Added: Visio 2010

Syntax

expression .AddMember(pObjectToAdd, addOptions)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
pObjectToAdd | Required | [UNKNOWN] | The shape or shapes to add to the container. Can be of type Shape or Selection.
addOptions | Required | VisMemberAddOptions | Determines whether the container should expand to fully contain the added shapes.

Return Value

Nothing

Remarks

The addOptions parameter value must be one of the following VisMemberAddOptions constants.

Constant | Value | Description
visMemberAddUseResizeSetting | 0 | Defer to the setting of the ContainerProperties.ResizeAsNeeded property.
visMemberAddExpandContainer | 1 | Expand the container to fit the incoming shapes.
visMemberAddDoNotExpand | 2 | Do not expand the container to fit the incoming shapes.

Passing visMemberAddUseResizeSetting or visMemberAddDoNotExpand for addOptions can create a situation in which a shape is a container member but not physically within the container. In such a case, the shape can lose its container membership on subsequent moves or resizing of either the container or the member.

If the container is a list, AddMember adds the specified object to the list container, but not to the list itself. In other words, the shape is contained by the list but is not actually in the list. This is common for shapes in containers that are themselves in a list.

If the ContainerProperties.LockMembership property is True, Microsoft Visio returns a Disabled error.

If the pObjectToAdd parameter does not contain top-level shapes on the page, Visio returns an Invalid Parameter error.

Visio also returns an Invalid Parameter error if you attempt to use the AddMember method to add the container shape itself or subshapes of the container to the container.

Visio returns an Invalid Target error if pObjectToAdd does not match the category requirements of the list or the container. Shapes can be assigned categories, and containers can have required and excluded categories.

Categories are user-defined strings that you can use to categorize shapes and, thereby, to restrict membership in a container. You can define categories in the User.msvShapeCategories cell in the ShapeSheet for a shape. You can define multiple categories for a shape by separating them with semicolons.

Example

The following Visual Basic for Applications (VBA) example shows how to use the AddMember method to add a new member (vsoShape) to an existing container (vsoContainerShape) on a page. The code assumes that vsoShape already overlaps vsoContainerShape.

VBA Copy code Copy code
vsoContainerShape.ContainerProperties.AddMember vsoShape, visMemberAddExpandContainer


ContainerProperties.Disband Method (Visio)

 Copy code hover
[image]

ContainerProperties.Disband Method (Visio)
Send feedback

Removes all member shapes from the container and deletes the container shape.

Version Information

Version Added: Visio 2010

Syntax

expression .Disband

expression A variable that represents a ContainerProperties object.

Return Value

Nothing


ContainerProperties.FitToContents Method (Visio)

 Copy code hover
[image]

ContainerProperties.FitToContents Method (Visio)
Send feedback

Forces the container to resize so as to tightly include all member shapes, including any applicable margins between the container and the shapes.

Version Information

Version Added: Visio 2010

Syntax

expression .FitToContents

expression A variable that represents a ContainerProperties object.

Return Value

Nothing

Remarks

Calling the FitToContents method has no effect on the ResizeAsNeeded property setting for the current session of Microsoft Visio.

The FitToContents method does not work for list shapes.


ContainerProperties.GetListMemberPosition Method (Visio)

 Copy code hover
[image]

ContainerProperties.GetListMemberPosition Method (Visio)
Send feedback

Returns the ordinal position of the specified shape in the list.

Version Information

Version Added: Visio 2010

Syntax

expression .GetListMemberPosition(ShapeMember)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
ShapeMember | Required | Shape | The list member shape for which you want to get the position in the container list.

Return Value

Long

Remarks

If the specified shape is not a member of the list, Microsoft Visio returns an Invalid Parameter error.

List position is one-based.

If the container is not a list, Visio returns an Invalid Source error.


ContainerProperties.GetListMembers Method (Visio)

 Copy code hover
[image]

ContainerProperties.GetListMembers Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of shape identifiers (IDs) of member shapes in the list.

Version Information

Version Added: Visio 2010

Syntax

expression .GetListMembers

expression A variable that represents a ContainerProperties object.

Return Value

Long()

Remarks

GetListMembers returns an empty array if there are no shapes in the list.

If the container is not a list, Microsoft Visio returns an Invalid Source error.


ContainerProperties.GetListSpacing Method (Visio)

 Copy code hover
[image]

ContainerProperties.GetListSpacing Method (Visio)
Send feedback

Returns the gap between adjacent member shapes in the list.

Version Information

Version Added: Visio 2010

Syntax

expression .GetListSpacing(SpacingUnits)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
SpacingUnits | Required | VisUnitCodes | The units in which to measure the gap.

Return Value

Double

Remarks

If the container is not a list, Microsoft Visio returns an Invalid Source error.


ContainerProperties.GetMargin Method (Visio)

 Copy code hover
[image]

ContainerProperties.GetMargin Method (Visio)
Send feedback

Published: July 16, 2012

Returns the minimal distance, in the specified units, between the edges of the container or list and those of its member shapes.

Version Information

Version Added: Visio 2010

Syntax

expression .GetMargin(MarginUnits)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
MarginUnits | Required | VisUnitCodes | The units in which to measure the margin.

Return Value

Double


ContainerProperties.GetMemberShapes Method (Visio)

 Copy code hover
[image]

ContainerProperties.GetMemberShapes Method (Visio)
Send feedback

Published: July 16, 2012

Returns the shape identifiers (IDs) of all members of the container, as specified.

Version Information

Version Added: Visio 2010

Syntax

expression .GetMemberShapes(ContainerFlags)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
ContainerFlags | Required | Long | Specifies which container member shape IDs to return.

Return Value

Long()

Remarks

The ContainerFlags parameter can be one or more of the following VisContainerFlags constants.

Constant | Value | Description
visContainerFlagsDefault | 0 | Returns all shape types and includes items in nested containers.
visContainerFlagsExcludeContainers | 1 | Excludes member shapes that are containers.
visContainerFlagsExcludeConnectors | 2 | Excludes member shapes that are connectors.
visContainerFlagsExcludeCallouts | 4 | Excludes member shapes that are callouts.
visContainerFlagsExcludeElements | 8 | Excludes member shapes that are not containers, lists, connectors, or callouts.
visContainerFlagsExcludeNested | 16 | Excludes any member shapes that are members of containers or lists nested within the container.
visContainerFlagsExcludeListMembers | 32 | Excludes members of a list container that are explicitly members of any list. Does not exclude other shapes in the list container.

GetMemberShapes returns an empty array if there are no member shapes.

Example

The following Visual Basic for Applications (VBA) example shows how to use the GetMemberShapes method to get the IDs of all member shapes in a specified container on the active page, loop through those shapes, and print the ID of each shape in the Immediate window.

VBA Copy code Copy code
For Each memberID In vsoContainerShape.ContainerProperties.GetMemberShapes(visContainerFlagsDefault)
    Set vsoShape = ActivePage.Shapes.ItemFromID(memberID)
    Debug.Print vsoShape.ID
Next


ContainerProperties.GetMemberState Method (Visio)

 Copy code hover
[image]

ContainerProperties.GetMemberState Method (Visio)
Send feedback

Published: July 16, 2012

Returns the membership state of the specified shape with respect to the container shape.

Version Information

Version Added: Visio 2010

Syntax

expression .GetMemberState(Shape)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | Shape | The shape for which to get the membership state.

Return Value

VisContainerMemberState

Remarks

GetMemberState can return one of the following VisContainerMemberState constants.

Constant | Value | Description
visContainerMemberNotAMember | 0 | The shape is not a member of the container.
visContainerMemberInterior | 1 | The member shape is within the bounds of the container.
visContainerMemberOnBoundary | 2 | The member shape is on the boundary of the container.
visContainerMemberOutside | 3 | The member shape is outside the bounds of the container.
visContainerMemberInList | 4 | The member shape is a list member.


ContainerProperties.InsertListMember Method (Visio)

 Copy code hover
[image]

ContainerProperties.InsertListMember Method (Visio)
Send feedback

Published: July 16, 2012

Adds a shape or set of shapes to the list in the container.

Version Information

Version Added: Visio 2010

Syntax

expression .InsertListMember(ObjectToInsert, Position)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToInsert | Required | [UNKNOWN] | The object or selection to insert in the list. Can be a Shape or Selection object.
Position | Required | Long | The insertion point in the list, which is one-based.

Return Value

Nothing

Remarks

If the container is not a list, Microsoft Visio returns an Invalid Source error.

If the ObjectToInsert parameter contains any non-top-level shapes or, if the list is locked, Visio returns an Invalid Parameter error. You cannot insert any of the following objects into a list:

  • Another list.

  • A callout.

  • Routable connectors.

  • Shapes whose PinX or PinY cells have the BOUND, GUARD, or SETATREF function applied.

  • A member of another locked list.

Visio ignores shapes in ObjectToInsert that are already members of the list.

To insert before the first item in the list, pass 1 for the Position parameter. To insert at the end of the list, pass a Position value equal to or greater than the value of the list count plus 1. If you pass an out-of-range position, Visio chooses the nearest valid position.

If ObjectToInsert does not match category requirements for lists, Visio returns an error.

Categories are user-defined strings that you can use to categorize shapes and, thereby, to restrict membership in a container. You can define categories in the User.msvShapeCategories cell in the ShapeSheet for a shape. You can define multiple categories for a shape by separating them with semicolons.


ContainerProperties.RemoveMember Method (Visio)

 Copy code hover
[image]

ContainerProperties.RemoveMember Method (Visio)
Send feedback

Published: July 16, 2012

Removes a shape or set of shapes from the container.

Version Information

Version Added: Visio 2010

Syntax

expression .RemoveMember(ObjectToRemove)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToRemove | Required | [UNKNOWN] | The shape or shapes to remove from the container. Can be a Shape or Selection selection.

Return Value

Nothing

Remarks

The RemoveMember method removes from the container the shapes specified in the ObjectToRemove parameter.

If the container is a list, Microsoft Visio removes the shapes specified in ObjectToRemove both from the list (if it is a list member) and from the list container.

If the ContainerProperties.LockMembership property is True, Visio returns a Disabled error.

If ObjectToRemove does not contain top-level shapes on the page, Visio returns an Invalid Parameter error. However, if ObjectToRemove is not a container member, Visio does not return an error.


ContainerProperties.ReorderListMember Method (Visio)

 Copy code hover
[image]

ContainerProperties.ReorderListMember Method (Visio)
Send feedback

Published: July 16, 2012

Moves a shape or a set of shapes up or down in the list.

Version Information

Version Added: Visio 2010

Syntax

expression .ReorderListMember(ObjectToReorder, Position)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToReorder | Required | [UNKNOWN] | The shape or shapes to reorder in the container. Can be either Shape or Selection objects.
Position | Required | Long | The insertion position in the list, which is one-based.

Return Value

Nothing

Remarks

If the container is not a list, Microsoft Visio returns an Invalid Source error.

If the ObjectToReorder parameter does not contain top-level shapes on the page, if any shape in ObjectToReorder is not a member of the list, or if the list is locked, Visio returns an Invalid Parameter error.

To insert before the first item in the list, pass 1 for the Position parameter.

To insert after the final item in the list, set Position greater than or equal to the count of items.

If you pass an out-of-range value for Position, Visio uses the nearest valid position.

If you pass a non-contiguous selection of list members for ObjectToReorder, Visio makes the selection contiguous in the resulting reordered list, while maintaining relative position. For example, in a list ordered A,B,C,D, if you move B and D to position 1, the resutling list order is B,D,A,C.

Example

The following Visual Basic for Applications (VBA) example shows how to use the ReorderListMember method to move a list member shape to the second position in the list.

VBA Copy code Copy code
vsoListShape.ContainerProperties.ReorderListMember vsoShape, 2


ContainerProperties.RotateFlipList Method (Visio)

 Copy code hover
[image]

ContainerProperties.RotateFlipList Method (Visio)
Send feedback

Published: July 16, 2012

Rotates or flips the list direction for a list of shapes.

Version Information

Version Added: Visio 2010

Syntax

expression .RotateFlipList(Direction)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | VisLayoutDirection | The layout action to take.

Return Value

Nothing

Remarks

If the list contains container shapes only, and no other shapes, and if the ObjType ShapeSheet cell value of the list shape equals zero (0), nothing happens.

If the list contains container shapes only, and no other shapes, and if the ObjType ShapeSheet cell value of the list shape does not equal zero (0), the RotateFlipList method also rotates or flips the contents of the container shapes.

If the list contains a mix of container and non-container shapes, the method does not rotate or flip the contents of the containers but, rather, rotates or flips the entire list.

You can also use this method on lists that are paired in an overlapped list relationship. For rotation, both overlapped lists are rotated by 90 degrees. For flip, the overlapped list direction is not changed.

If the container is not a list, Microsoft Visio returns an Invalid Source error.


ContainerProperties.SetListSpacing Method (Visio)

 Copy code hover
[image]

ContainerProperties.SetListSpacing Method (Visio)
Send feedback

Published: July 16, 2012

Sets the gap between adjacent member shapes in the list.

Version Information

Version Added: Visio 2010

Syntax

expression .SetListSpacing(SpacingUnits, SpacingSize)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
SpacingUnits | Required | VisUnitCodes | The units in which to measure the gap.
SpacingSize | Required | Double | The size of the gap.

Return Value

Nothing

Remarks

If the container is not a list, Microsoft Visio returns an Invalid Source error.


ContainerProperties.SetMargin Method (Visio)

 Copy code hover
[image]

ContainerProperties.SetMargin Method (Visio)
Send feedback

Published: July 16, 2012

Sets the gap between the container and member shapes to the specified size, in the specified units.

Version Information

Version Added: Visio 2010

Syntax

expression .SetMargin(MarginUnits, MarginSize)

expression A variable that represents a ContainerProperties object.

Parameters

Name | Required/Optional | Data Type | Description
MarginUnits | Required | VisUnitCodes | The units in which to measure the margin.
MarginSize | Required | Double | The size of the margin.

Return Value

Nothing


Curve Object (Visio)

 Copy code hover
[image]

Curve Object (Visio)
Send feedback

Published: July 16, 2012

An item in a Path object that represents a consecutive sequence of rows in the Geometry section of its Path object.

Version Information

Version Added: Visio 5.0

Remarks

The default property of Curve object is Point.

If a Curve object is in a collection returned by the Paths property of a Shape object, its coordinates are expressed in the shape's parent coordinate system. If the Curve object is in a collection returned by the PathsLocal property of a Shape object, its coordinates are expressed in the shape's local coordinate system. In both cases, the coordinates are expressed in internal drawing units (inches).

A Curve object describes itself in terms of its parameter domain, which is the range [Start(),End()]. Use the Start property of a Curve object to obtain the curve's starting point and the End property of a Curve object to obtain the curve's ending point.

Use the Point method of a curve object to extrapolate a point along the curve's path. Use the PointAndDerivatives method of a Curve object to determine a point along the curve's path and, optionally, its first and second derivatives.

Use the Points property of a Curve object to obtain a stream of points that approximate the curve's path.


Curve Members (Visio)

 Copy code hover
[image]

Curve Members (Visio)
Send feedback

Published: July 16, 2012

An item in a Path object that represents a consecutive sequence of rows in the Geometry section of its Path object.

Methods

Name | Description
Point | Returns a point at a position along a curve.
PointAndDerivatives | Returns a point and its derivatives at a position along a curve's path.
Points | Returns an array of points that defines a polyline that approximates a Path or Curve object within a given tolerance.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Closed | Determines if an object is closed (that is, if its begin point coincides with its endpoint). Read-only.
End | Returns the endpoint of a Curve object. Read-only.
ObjectType | Returns an object's type. Read-only.
Start | Returns the start of a Curve object's parameter domain. Read-only.


Curve Properties (Visio)

 Copy code hover
[image]

Curve Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Closed | Determines if an object is closed (that is, if its begin point coincides with its endpoint). Read-only.
End | Returns the endpoint of a Curve object. Read-only.
ObjectType | Returns an object's type. Read-only.
Start | Returns the start of a Curve object's parameter domain. Read-only.


Curve.Application Property (Visio)

 Copy code hover
[image]

Curve.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Curve object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Curve.Closed Property (Visio)

 Copy code hover
[image]

Curve.Closed Property (Visio)
Send feedback

Published: July 16, 2012

Determines if an object is closed (that is, if its begin point coincides with its endpoint). Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .Closed

expression A variable that represents a Curve object.

Return Value

Integer

Remarks

Use the Closed property of a Path or Curve object to test for equality (Microsoft Visio uses 10E-6 as its "fuzz" factor) of the object's begin and endpoints. A closed Curve object can be in a Path object that is open, and a Curve object that is open can be in a closed Path object.

The Closed property of a Path object is unrelated to a Path object's fill. A Path object is filled if its Geometryn.NoFill cell is zero (0). If you indicate to Visio to fill an open Path object, it responds as if there is a LineTo cell from the Path object's endpoint to its begin point. When filling a Path object, Visio considers a point to be inside the Path object if a ray drawn from the point in any direction crosses the Path object or any of the shape's other Path objects cross an odd number of times.


Curve.End Property (Visio)

 Copy code hover
[image]

Curve.End Property (Visio)
Send feedback

Published: July 16, 2012

Returns the endpoint of a Curve object. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .End

expression A variable that represents a Curve object.

Return Value

Double

Remarks

The End property of a Curve object returns the endpoint of a curve. A Curve object describes itself in terms of its parameter domain, which is the range [Start(),End()] where End() produces the curve's endpoint.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the End property to determine the endpoint of a curve.

VBA Copy code Copy code

Sub End_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoPaths As Visio.Paths
 Dim vsoPath As Visio.Path
 Dim vsoCurve As Visio.Curve
 Dim dblStartpoint As Double
 Dim dblEndpoint As Double
 Dim intOuterLoopCounter As Integer
 Dim intInnerLoopCounter As Integer

 'Get the Paths collection for this shape.
 Set vsoPaths = ActivePage.DrawOval(1, 1, 4, 4).Paths

 'Iterate through the Path objects in the Paths collection.
 For intOuterLoopCounter = 1 To vsoPaths.Count
 Set vsoPath = vsoPaths.Item(intOuterLoopCounter)
 Debug.Print "Path object " & intOuterLoopCounter

 'Iterate through the curves in a Path object.
 For intInnerLoopCounter = 1 To vsoPath.Count

 Set vsoCurve = vsoPath(intInnerLoopCounter)
 Debug.Print "Curve number " & intInnerLoopCounter

 'Display the start point of the curve.
 dblStartpoint = vsoCurve.Start
 Debug.Print "Startpoint= " & dblStartpoint

 'Display the endpoint of the curve.
 dblEndpoint = vsoCurve.End
 Debug.Print "Endpoint= " & dblEndpoint

 Next intInnerLoopCounter
 Debug.Print "This path has " & intInnerLoopCounter - 1 & " curve object(s)."

 Next intOuterLoopCounter
 Debug.Print "This shape has " & intOuterLoopCounter - 1 & " path object(s)."

End Sub


Curve.ObjectType Property (Visio)

 Copy code hover
[image]

Curve.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Curve object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Curve.Start Property (Visio)

 Copy code hover
[image]

Curve.Start Property (Visio)
Send feedback

Published: July 16, 2012

Returns the start of a Curve object's parameter domain. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .Start

expression A variable that represents a Curve object.

Return Value

Double

Remarks

The Start property of a Curve object returns the value of the starting point in the curve's parameter domain. A Curve object describes itself in terms of its parameter domain, which is the range [Start(),End()], where Start() produces the curve's starting point. Note that the Start value is not a coordinate pair. Rather, it represents the relative position along the curve of the starting point. For a line, for example, the value of Start typically is 0, the value of End is 1, and you can use the Point method of the Curve object to determine the coordinates of any point along the curve by determining the relative location of the point between the start and endpoints.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Start property to display the value of the starting point of a curve. It uses the Point method to find the midpoint of the curve.

VBA Copy code Copy code

Sub Start_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoPaths As Visio.Paths
 Dim vsoPath As Visio.Path
 Dim vsoCurve As Visio.Curve
 Dim dblStartpoint As Double
 Dim dblEndpoint As Double
 Dim dblX As Double
 Dim dblY As Double
 Dim intOuterLoopCounter As Integer
 Dim intInnerLoopCounter As Integer

 'Draw a shape and get its Paths collection.
 Set vsoPaths = ActivePage.DrawOval(1, 1, 4, 4).Paths

 'Iterate through the Path objects in the Paths collection.
 For intOuterLoopCounter = 1 To vsoPaths.Count

 Set vsoPath = vsoPaths.Item(intOuterLoopCounter)
 Debug.Print "Path object " & intOuterLoopCounter

 'Iterate through the curves in a Path object.
 For intInnerLoopCounter = 1 To vsoPath.Count

 Set vsoCurve = vsoPath(intInnerLoopCounter)
 Debug.Print "Curve number " & intInnerLoopCounter

 'Display the start point of the curve.
 dblStartpoint = vsoCurve.Start
 Debug.Print "Startpoint = " & dblStartpoint

 'Display the endpoint of the curve.
 dblEndpoint = vsoCurve.End
 Debug.Print "Endpoint = " & dblEndpoint

 'Find the midpoint of the curve.
 vsoCurve.Point ((dblEndpoint - dblStartpoint) / 2), dblX, dblY
 Debug.Print "Midpoint: x = " & dblx; ", y = " & dblY

 Next intInnerLoopCounter
 Debug.Print "This path has " & intInnerLoopCounter - 1 & " curve object(s)."

 Next intOuterLoopCounter
 Debug.Print "This shape has " & intOuterLoopCounter - 1 & " path object(s)."

End Sub


Curve Methods (Visio)

 Copy code hover
[image]

Curve Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Point | Returns a point at a position along a curve.
PointAndDerivatives | Returns a point and its derivatives at a position along a curve's path.
Points | Returns an array of points that defines a polyline that approximates a Path or Curve object within a given tolerance.


Curve.Point Method (Visio)

 Copy code hover
[image]

Curve.Point Method (Visio)
Send feedback

Published: July 16, 2012

Returns a point at a position along a curve.

Version Information

Version Added: Visio 5.0

Syntax

expression .Point(t, x, y)

expression A variable that represents a Curve object.

Parameters

Name | Required/Optional | Data Type | Description
t | Required | Double | The value in the curve's parameter domain to evaluate.
x | Required | Double | Returns x value of curve at t.
y | Required | Double | Returns y value of curve at t.

Return Value

Nothing

Remarks

A Curve object is described in terms of its parameter domain, which is the range [Start(),End()]. The Point method of a Curve object returns the x,y coordinates at position t, which is any position along the curve's path. The Point method can be used to extrapolate the curve's path outside [Start(),End()].

Example

This Microsoft Visual Basic for Applications (VBA) macro draws a circle (a special case of an oval) on the document's active page. Then it iterates through the Paths collection of the circle and each Path object to display the coordinates of various points along the curve. Because the shape drawn is a circle, it is a Curve object that has only one path.

VBA Copy code Copy code

Sub Point_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoPaths As Visio.Paths
 Dim vsoPath As Visio.Path
 Dim vsoCurve As Visio.Curve
 Dim dblEndpoint As Double
 Dim dblXCoordinate As Double
 Dim dblYCoordinate As Double
 Dim intOuterLoopCounter As Integer
 Dim intInnerLoopCounter As Integer

 'Get the Paths collection for this shape.
 Set vsoPaths = ActivePage.DrawOval(1, 1, 4, 4).Paths

 'Iterate through the Path objects in the Paths collection.
 For intOuterLoopCounter = 1 To vsoPaths.Count
 Set vsoPath = vsoPaths.Item(intOuterLoopCounter)
 Debug.Print "Path object " & intOuterLoopCounter

 'Iterate through the curves in the Path object.
 For intInnerLoopCounter = 1 To vsoPath.Count

 Set vsoCurve = vsoPath(intInnerLoopCounter)
 Debug.Print "Curve number " & intInnerLoopCounter

 'Display the endpoint of the curve
 dblEndpoint = vsoCurve.End
 Debug.Print "Endpoint= " & dblEndpoint

 'Use the Point method to determine the
 'coordinates of an arbitrary point on the curve
 vsoCurve.Point (dblEndpoint/2), dblXCoordinate, dblYCoordinate
 Debug.Print "Point= " & dblXCoordinate, dblYCoordinate

 Next intInnerLoopCounter
 Debug.Print "This path has " & intInnerLoopCounter - 1 & " curve object(s)."

 Next intOuterLoopCounter
 Debug.Print "This shape has " & intOuterLoopCounter - 1 & " path object(s)."

End Sub


Curve.PointAndDerivatives Method (Visio)

 Copy code hover
[image]

Curve.PointAndDerivatives Method (Visio)
Send feedback

Published: July 16, 2012

Returns a point and its derivatives at a position along a curve's path.

Version Information

Version Added: Visio 5.0

Syntax

expression .PointAndDerivatives(t, n, x, y, dxdt, dydt, ddxdt, ddydt)

expression A variable that represents a Curve object.

Parameters

Name | Required/Optional | Data Type | Description
t | Required | Double | The value in the curve's parameter domain to evaluate.
n | Required | Integer | 0: get point; 1: point and 1st derivative; 2: point plus first and second derivative.
x | Required | Double | Returns x value of curve at t.
y | Required | Double | Returns y value of curve at t.
dxdt | Required | Double | Returns first derivative (dx/dt) at t if n > 0.
dydt | Required | Double | Returns first derivative (dy/dt) at t if n> 0.
ddxdt | Required | Double | Returns second derivative (ddx/dt) at t if n> 1.
ddydt | Required | Double | Returns second derivative (ddy/dt) at t if n> 1.

Return Value

Nothing

Remarks

Use the PointAndDerivatives method of the Curve object to obtain the coordinates of a point within the curve's parameter domain and its first and second derivatives.

A Curve object is described in terms of its parameter domain, which is the range [Start(),End()]. The PointAndDerivatives method can be used to extrapolate the curve's path outside [Start(),End()].

Example

This Microsoft Visual Basic for Applications (VBA) macro draws an oval on the document's active page and then retrieves it and iterates through its Paths collection and each Path object to display the coordinates of various points along the curve. Because the shape drawn is an oval, it contains only one path and only one Curve object.

VBA Copy code Copy code

Sub PointAndDerivatives_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoPaths As Visio.Paths
 Dim vsoPath As Visio.Path
 Dim vsoCurve As Visio.Curve
 Dim dblStartpoint As Double
 Dim dblXCoordinate As Double
 Dim dblYCoordinate As Double
 Dim dblFirstDerivativeX As Double
 Dim dblFirstDerivativeY As Double
 Dim dblSecondDerivativeX As Double
 Dim dblSecondDerivativeY As Double
 Dim intOuterLoopCounter As Integer
 Dim intInnerLoopCounter As Integer

 'Get the Paths collection for this shape.
 Set vsoPaths = ActivePage.DrawOval(1, 1, 4, 4).Paths

 'Iterate through the Path objects in the Paths collection.
 For intOuterLoopCounter = 1 To vsoPaths.Count
 Set vsoPath = vsoPaths.Item(intOuterLoopCounter)
 Debug.Print "Path object " & intOuterLoopCounter

 'Iterate through the curves in a Path object.
 For intInnerLoopCounter = 1 To vsoPath.Count

 Set vsoCurve = vsoPath(intInnerLoopCounter)
 Debug.Print "Curve number " & intInnerLoopCounter

 'Display the start point of the curve.
 dblStartpoint = vsoCurve.Start
 Debug.Print "Startpoint= " & dblStartpoint

 'Use the PointAndDerivatives method to obtain
 'a point and the first derivative at that point.
 vsoCurve.PointAndDerivatives (dblStartpoint - 1), 1, _
 dblXCoordinate, dblYCoordinate, dblFirstDerivativeX, dblFirstDerivativeY, dblSecondDerivativeX, dblSecondDerivativeY
 Debug.Print "PointAndDerivative= " & dblXCoordinate, dblYCoordinate, dblFirstDerivativeX, dblFirstDerivativeY

 Next intInnerLoopCounter
 Debug.Print "This path has " & intInnerLoopCounter - 1 & " curve object(s)."

 Next intOuterLoopCounter
 Debug.Print "This shape has " & intOuterLoopCounter - 1 & " path object(s)."

End Sub


Curve.Points Method (Visio)

 Copy code hover
[image]

Curve.Points Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of points that defines a polyline that approximates a Path or Curve object within a given tolerance.

Version Information

Version Added: Visio 5.0

Syntax

expression .Points(Tolerance, xyArray())

expression A variable that represents a Curve object.

Parameters

Name | Required/Optional | Data Type | Description
Tolerance | Required | Double | Specifies how close the returned array of points must approximate the true path.
xyArray() | Required | Double | Returns an array of alternating x and y values specifying points along a path's or curve's stroke.

Return Value

Nothing

Remarks

Use the Points method of the Path or Curve object to obtain an array of x,y coordinates specifying points along the path or curve within a given tolerance. The tolerance and returned x,y values are expressed in internal drawing units (inches).

If you used the Paths property of a Shapes object to obtain the Path or Curve object being queried, the coordinates are expressed in the parent's coordinate system. If you used the PathsLocal property of a Shape object to obtain the Path or Curve object, the coordinates are expressed in the local coordinate system.

If Microsoft Visio is unable to achieve the requested tolerance, Visio approximates the points as close to the requested tolerance as possible. Generally speaking, the lower the tolerance, the more points Visio returns. Visio doesn't accept a tolerance of zero (0).

The array returned includes both the starting and ending points of the path or curve even if it is closed.

Example

This Microsoft Visual Basic for Applications (VBA) macro places a shape on the page, retrieves its Paths collection, and then uses the Points method of the Path object to return an array of points that defines a polyline approximating the Path object.

VBA Copy code Copy code

Public Sub Points_Example()

 Dim vsoShape As Visio.Shape
 Dim adblXYPoints() As Double
 Dim strPointsList As String
 Dim intOuterLoopCounter As Integer
 Dim intInnerLoopCounter As Integer

 Set vsoShape = ActivePage.DrawOval(1, 1, 4, 4)

 For intOuterLoopCounter = 1 To vsoShape.Paths.Count

 vsoShape.Paths(intOuterLoopCounter).Points 0.1, adblXYPoints
 For intInnerLoopCounter = LBound(adblXYPoints) To UBound(adblXYPoints)
 strPointsList = strPointsList & adblXYPoints(intInnerLoopCounter) & Chr(10)
 Next intInnerLoopCounter

 Next intOuterLoopCounter

 Debug.Print strPointsList

End Sub


DataColumn Object (Visio)

 Copy code hover
[image]

DataColumn Object (Visio)
Send feedback

Published: July 16, 2012

Allows custom mapping of the properties of a column of a data recordset to Microsoft Visio ShapeSheet spreadsheet cells.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Remarks

The default property of the DataColumn object is Name, which returns the name of the data column in the associated data recordset.

The Visible property specifies whether the data column is visible in the External Data window.

Many of the properties of the DataColumn object correspond closely to the columns of the Shape Data section of the ShapeSheet of shapes linked to data. For example, the DisplayName property, which specifies the name that appears for the associated data column in the External Data window in the Visio user interface, corresponds to the Label column in the Shape Data section, which controls the label that appears for a particular Shape Data item in the Shape Data dialog box.

You can also set the DisplayName property value in the Column Settings dialog box in the Visio user interface (right-click in the External Data window, and then click Column Settings) .

Note that the read-only Name property specifies the programmatic name for this data column in the data recordset that contains the data column, but that you can specify the value of the read/write DisplayName property.

Note Note

In Visio 2003 and prior versions, Shape Data were called Custom Properties.

Use the GetProperty method to get the value of the data column property you specify. Data column properties must be one of the enumerated values in VisDataColumnProperties, which is declared in the Visio type library.

Use the SetProperty method to set the value of the data column property you specify, from the members of VisDataColumnProperties. The SetProperty topic contains a table that shows a matrix of allowable data column types and property settings. These settings correspond to those you can set in the Types and Settings dialog box for an individual column (select a column in the Column Settings dialog box, and then click Data Type).


DataColumn Members (Visio)

 Copy code hover
[image]

DataColumn Members (Visio)
Send feedback

Published: July 16, 2012

Allows custom mapping of the properties of a column of a data recordset to Microsoft Visio ShapeSheet spreadsheet cells.

Methods

Name | Description
GetProperty | Gets the value of the specified data-column property.
SetProperty | Sets the value of the specified data-column property.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with a DataColumn object. Read-only.
DataRecordset | Returns the DataRecordset object that contains the data column in its DataColumns collection. Read-only.
DisplayName | Specifies the name that appears for the data column on the tab of the parent data recordset in the External Data window in the Microsoft Visio user interface. Read/write.
Document | Gets the Document object that contains the DataColumn object. Read-only.
Hyperlink | Gets or sets whether the data column creates a hyperlink in a shape when the shape is linked to data. Read/write.
Name | Gets the unique name of the data column in its parent data recordset. Read-only.
ObjectType | Returns visObjTypeDataColumn, the type of a DataColumn object. Read-only.
Stat | Returns status information for an object. Read-only.
Visible | Specifies whether the data column appears on the tab for its parent data recordset in the External Data window in the Microsoft Visio user interface. Read/write.


DataColumn Properties (Visio)

 Copy code hover
[image]

DataColumn Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with a DataColumn object. Read-only.
DataRecordset | Returns the DataRecordset object that contains the data column in its DataColumns collection. Read-only.
DisplayName | Specifies the name that appears for the data column on the tab of the parent data recordset in the External Data window in the Microsoft Visio user interface. Read/write.
Document | Gets the Document object that contains the DataColumn object. Read-only.
Hyperlink | Gets or sets whether the data column creates a hyperlink in a shape when the shape is linked to data. Read/write.
Name | Gets the unique name of the data column in its parent data recordset. Read-only.
ObjectType | Returns visObjTypeDataColumn, the type of a DataColumn object. Read-only.
Stat | Returns status information for an object. Read-only.
Visible | Specifies whether the data column appears on the tab for its parent data recordset in the External Data window in the Microsoft Visio user interface. Read/write.


DataColumn.Application Property (Visio)

 Copy code hover
[image]

DataColumn.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with a DataColumn object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Application

expression An expression that returns a DataColumn object.

Return Value

Application


DataColumn.DataRecordset Property (Visio)

 Copy code hover
[image]

DataColumn.DataRecordset Property (Visio)
Send feedback

Published: July 16, 2012

Returns the DataRecordset object that contains the data column in its DataColumns collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataRecordset

expression An expression that returns a DataColumn object.

Return Value

DataRecordset


DataColumn.DisplayName Property (Visio)

 Copy code hover
[image]

DataColumn.DisplayName Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name that appears for the data column on the tab of the parent data recordset in the External Data window in the Microsoft Visio user interface. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DisplayName

expression An expression that returns a DataColumn object.

Return Value

String

Remarks

The DisplayName property value is not necessarily the same as that of the Name property, which is read-only, and which determines the unique identifier of the data column in its parent data recordset.

The value of the DisplayName property corresponds to the value in the Label column in the Shape Data section of the ShapeSheet spreadsheet of a shape that is linked to data. The Label column value determines the label that appears for a particular shape-data item in the Shape Data dialog box for that shape. (Right-click the shape, and then click Shape Data.)

Note Note

In some previous versions of Visio, Shape Data were called Custom Properties.


DataColumn.Document Property (Visio)

 Copy code hover
[image]

DataColumn.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that contains the DataColumn object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Document

expression An expression that returns a DataColumn object.

Return Value

Document


DataColumn.Hyperlink Property (Visio)

 Copy code hover
[image]

DataColumn.Hyperlink Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets whether the data column creates a hyperlink in a shape when the shape is linked to data. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Hyperlink

expression An expression that returns a DataColumn object.

Return Value

Boolean

Remarks

The Hyperlink property setting corresponds to the setting of the Hyperlink check box in the Types and Units dialog box for the column in the Visio UI.


DataColumn.Name Property (Visio)

 Copy code hover
[image]

DataColumn.Name Property (Visio)
Send feedback

Published: July 16, 2012

Gets the unique name of the data column in its parent data recordset. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Name

expression A variable that represents a DataColumn object.

Return Value

String

Remarks

The Name property is the default property of the DataColumn object. The value of Name is unique within a particular data recordset and therefore uniquely identifies the column in the data recordset. The value that Visio assigns for the Name property is the same as, or derived from, the name of the column in the original data source.

For a given column, the value of the Name property is not necessarily the same as that of the DisplayName property, which specifies the name of the column in the External Data window in the Visio user interface, and which is read/write.


DataColumn.ObjectType Property (Visio)

 Copy code hover
[image]

DataColumn.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeDataColumn, the type of a DataColumn object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ObjectType

expression An expression that returns a DataColumn object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


DataColumn.Stat Property (Visio)

 Copy code hover
[image]

DataColumn.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Stat

expression A variable that represents a DataColumn object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


DataColumn.Visible Property (Visio)

 Copy code hover
[image]

DataColumn.Visible Property (Visio)
Send feedback

Published: July 16, 2012

Specifies whether the data column appears on the tab for its parent data recordset in the External Data window in the Microsoft Visio user interface. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Visible

expression A variable that represents a DataColumn object.

Return Value

Boolean

Remarks

If when a shape is linked to data, Visible is set to True, and if Visio adds a row to the Shape Data section of the ShapeSheet spreadsheet of the linked shape for the data column, subsequently setting the Visible property to False causes Visio to remove the ShapeSheet row it added.

If the row in the Shape Data section existed prior to linking, setting the Visible property to False does not result in Visio removing the ShapeSheet row; however, the shape data item the row represents no longer is subject to change when data in the data recordset is refreshed.

When the Visible property is set to False, Visio does not create a ShapeSheet row for the data column when it links shapes to data.


DataColumn Methods (Visio)

 Copy code hover
[image]

DataColumn Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
GetProperty | Gets the value of the specified data-column property.
SetProperty | Sets the value of the specified data-column property.


DataColumn.GetProperty Method (Visio)

 Copy code hover
[image]

DataColumn.GetProperty Method (Visio)
Send feedback

Published: July 16, 2012

Gets the value of the specified data-column property.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetProperty(Property)

expression An expression that returns a DataColumn object.

Parameters

Name | Required/Optional | Data Type | Description
Property | Required | VisDataColumnProperties | The data column property to get. See Remarks for possible values.

Return Value

Variant

Remarks

When you link shapes in a Microsoft Visio drawing to data in a data recordset, Visio maps columns in the data recordset to rows in the Shape Data section of the ShapeSheet spreadsheet, each of which corresponds to a shape-data item.

Note Note

In some previous versions of Visio, shape data were called custom properties.

Data-column properties map data columns to certain cells in the Shape Data section of the ShapeSheet. For example, by passing the GetProperty method the DisplayName property, which is represented by the enumerated value visDataColumnPropertyDisplayName, you can get the value of the Label cell in the Shape Data section of the ShapeSheet for a particular shape data item. In addition, that property sets the label of the shape data item in the Shape Data dialog box, as well as the name of the data column that is displayed in the External Data window in the Visio user interface.

Possible values for the Property parameter are declared in VisDataColumnProperties, and are shown in the following table.

Constant | Value | Description
visDataColumnPropertyCalendar | 3 | Calendar of the data-column property.
visDataColumnPropertyCurrency | 5 | Currency of the data-column property.
visDataColumnPropertyDisplayName | 6 | Display name of the data-column property in the UI.
visDataColumnPropertyHyperlink | 8 | Whether the data-column value becomes a hyperlink in the Visio UI when it is linked to a shape.
visDataColumnPropertyLangID | 2 | Language ID of the data-column property.
visDataColumnPropertyType | 1 | Type of the data-column property.
visDataColumnPropertyUnits | 4 | Units of the data-column property.
visDataColumnPropertyVisible | 7 | Whether the data-column property is visible in the UI.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetProperty method to get the value of the Label cell in the Shape Data section for the first column in the data recordset passed to the method and display it in the Immediate window. Then it uses the SetProperty method to set the value and displays the new value. Changing this value changes the label of the shape data item in the Shape Data dialog box for all shapes linked to rows in the data recordset.

To get and set the Label cell value, the macro passes the visDataColumnPropertyDisplayName value from the VisDataColumnProperties enumeration to the DataColumn.GetProperty and DataColumn.SetProperty methods.

Before running this macro, create at least one data recordset in your VBA project to pass to the macro.

VBA Copy code Copy code

Public Sub GetProperty_Example(vsoDataRecordset As Visio.DataRecordset)
    Dim strPropertyName As String
    Dim strNewName As String
    Dim vsoDataColumn As Visio.DataColumn

    strNewName = "New Property Name"
    Set vsoDataColumn = vsoDataRecordset.DataColumns(1)

    strPropertyName = vsoDataColumn.GetProperty(visDataColumnPropertyDisplayName)
    Debug.Print strPropertyName

    vsoDataColumn.SetProperty visDataColumnPropertyDisplayName, strNewName
    strPropertyName = vsoDataColumn.GetProperty(visDataColumnPropertyDisplayName)
    Debug.Print strPropertyName
End Sub


DataColumn.SetProperty Method (Visio)

 Copy code hover
[image]

DataColumn.SetProperty Method (Visio)
Send feedback

Published: July 16, 2012

Sets the value of the specified data-column property.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .SetProperty(Property, Value)

expression An expression that returns a DataColumn object.

Parameters

Name | Required/Optional | Data Type | Description
Property | Required | VisDataColumnProperties | The data-column property whose value you want set. See Remarks for possible values.
Value | Required | Variant | The value to assign the data-column property. See Remarks for possible values.

Return Value

Nothing

Remarks

When you link shapes in a Microsoft Visio drawing to data in a data recordset, Visio maps columns in the data recordset to rows in the Shape Data section of the ShapeSheet spreadsheet, each of which corresponds to a shape-data item.

Note Note

In some previous versions of Visio, shape data were called custom properties.

Data-column properties map data columns to certain cells in the Shape Data section of the ShapeSheet. For example, by passing the SetProperty method a new value for the DisplayName property, which is represented by the enumerated value visDataColumnPropertyDisplayName, you set the value of the Label cell in the Shape Data section of the ShapeSheet for a particular shape data item. In addition, setting that property sets the label of the shape data item in the Shape Data dialog box, as well as the name of the data column that is displayed in the External Data window in the Visio user interface. These settings correspond to those that you can set in the Column Settings dialog box in the Visio user interface (right-click in the External Data window and then click Column Settings), as well as those that you can make in the Types and Units dialog box for each column (click Data Types in the Column Settings dialog box.)

Possible values for the Property parameter are declared in VisDataColumnProperties, and are shown in the following table.

Constant | Value | Description
visDataColumnPropertyCalendar | 3 | Calendar of the data-column property.
visDataColumnPropertyCurrency | 5 | Currency of the data-column property.
visDataColumnPropertyDisplayName | 6 | Display name of the data-column property in the UI.
visDataColumnPropertyHyperlink | 8 | Whether the data-column value becomes a hyperlink in the Visio UI when it is linked to a shape.
visDataColumnPropertyLangID | 2 | Language ID of the data-column property.
visDataColumnPropertyType | 1 | Data type of the data-column property.
visDataColumnPropertyUnits | 4 | Units of the data-column property.
visDataColumnPropertyVisible | 7 | Whether the data-column property is visible in the UI.

Possible values for the Value parameter depend on the Property parameter value. The following table shows valid data-column property values for each data-column property, depending on the data-column data type.

Data Column Data Type

Number (VisCellVals.visPropTypeNumber)

Date (VisCellVals.visPropTypeDate)

Currency (VisCellVals.visPropTypeCurrency)

Duration (VisCellVals.visPropTypeDuration)

String (VisCellVals.visPropTypeString)

Boolean (VisCellVals.visPropTypeBoolean)

Data Column Property

Type

visPropTypeNumber

visPropTypeDate

visPropTypeCurrency

visPropTypeDuration

visPropTypeString

visPropTypeBoolean

Visible

Boolean

Boolean

Boolean

Boolean

Boolean

Boolean

DisplayName

String

String

String

String

String

String

LangID

Valid LCID number

Currency

Valid 3-letter currency-constant string as used in the CY function in the Visio ShapeSheet spreadsheet.

Calendar

One of the members of VisCellVals, depending on the LangID value. (See table below.)

Units

One of the following members of VisUnitsCodes:

  • visAcre

  • visAngleUnits

  • visCentimeters

  • visCiceros

  • visCicerosAndDidots

  • visDegreeMinSec

  • visDegrees

  • visDrawingUnits

  • visFeet

  • visFeetAndInches

  • visHectare

  • visDidots

  • visInches

  • visInchFrac

  • visKilometers

  • visMeters

  • visMileFrac

  • visMiles

  • visMillimeters

  • visMin

  • visNautMiles

  • visPageUnits

  • visPicas

  • visPicasAndPoints

  • visPoints

  • visRadians

  • visSec

  • visYards

  • visNumber (special behavior - this constant makes the value unitless)

OR Descriptive string—a string used for units, such as cm or sq cm. This string will be validated so that it is one of the supported Visio units. Passing invalid strings causes the method to fail.

One of the following members of VisUnitsCodes:

  • visDurationUnits

  • visElapsedDay

  • visElapsedHour

  • visElapsedMin

  • visElapsedSec

  • visElapsedWeek

OR Descriptive string—a string used for units such as ew. This string will be validated so that it is one of the supported Visio units. Passing an invalid string will cause this method to fail.

HyperLink

Boolean

The LangID and Calendar properties are bound by the validation rules shown in the following table. Languages not shown use the Western calendar only.

Calendar | Hirji | Western | French Transliterated | English Transliterated | Hebrew Lunar | Saka Era | Japanese Emperor Era | Korean Danki | Thai Buddhist
Language |  |  |  |  |  |  |  |  |
All Arabic | x | x | x | x |  |  |  |  |
Bengali(Bangladesh) | x | x |  |  |  |  |  |  |
Divehi | x | x |  |  |  |  |  |  |
All English | x | x |  |  | x | x |  |  |
Persian | x | x |  |  |  |  |  |  |
Hebrew | x |  |  |  | x |  |  |  |
Hindi | x |  |  |  |  | x |  |  |
Japanese |  | x |  |  |  |  | x |  |
Korean |  | x |  |  |  |  |  | x |
Kashmiri (Arabic) | x | x |  |  |  |  |  |  |
Punjabi (Pakistan) | x | x |  |  |  |  |  |  |
Pashto | x | x |  |  |  |  |  |  |
Sindhi | x | x |  |  |  |  |  |  |
Thai |  |  |  |  |  |  |  |  |
Urdu | x | x |  |  |  |  |  |  |
Tamzight | x | x |  |  |  |  |  |  |

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetProperty method to get the value of the Label cell in the Shape Data section for the first column in the data recordset passed to the method and display it in the Immediate window. Then it uses the SetProperty method to set the value and displays the new value. Changing this value changes the label of the shape data item in the Shape Data dialog box for all shapes linked to rows in the data recordset.

To get and set the Label cell value, the macro passes the visDataColumnPropertyDisplayName value from the VisDataColumnProperties enumeration to the DataColumn.GetProperty and DataColumn.SetProperty methods.

Before running this macro, create at least one data recordset in your VBA project to pass to the macro.

VBA Copy code Copy code

Public Sub SetProperty_Example(vsoDataRecordset As Visio.DataRecordset)
    Dim strPropertyName As String
    Dim strNewName As String
    Dim vsoDataColumn As Visio.DataColumn

    strNewName = "New Property Name"
    Set vsoDataColumn = vsoDataRecordset.DataColumns(1)

    strPropertyName = vsoDataColumn.GetProperty(visDataColumnPropertyDisplayName)
    Debug.Print strPropertyName

    vsoDataColumn.SetProperty visDataColumnPropertyDisplayName, strNewName
    strPropertyName = vsoDataColumn.GetProperty(visDataColumnPropertyDisplayName)
    Debug.Print strPropertyName
End Sub


DataColumns Object (Visio)

 Copy code hover
[image]

DataColumns Object (Visio)
Send feedback

Published: July 16, 2012

The collection of DataColumn objects associated with a DataRecordset object.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Remarks

The default property of the DataColumns collection is Item.

A DataRecordset object can contain only one DataColumns collection. The number of DataColumn objects that can belong to a DataColumns collection is limited only by the number of columns in the data source and the hardware constraints of your computer.

You can use the SetColumnProperties method to set multiple properties of the data recordset columns you specify to the values you specify. Note that SetColumnProperties can set values of multiple properties for multiple columns, whereas the DataColumn.SetProperty method sets the value of only one property of one column at a time.


DataColumns Members (Visio)

 Copy code hover
[image]

DataColumns Members (Visio)
Send feedback

Published: July 16, 2012

The collection of DataColumn objects associated with a DataRecordset object.

Methods

Name | Description
SetColumnProperties | Sets one or more data-column properties for one or more data columns.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with the DataColumns collection. Read-only.
Count | Returns the number of DataColumn objects in the DataColumns collection. Read-only.
DataRecordset | Returns the DataRecordset object that contains the DataColumns collection. Read-only.
Document | Gets the Document object that contains the DataColumns collection. Read-only.
Item | Returns the DataColumn object at the specified index position, or of the specified name, in the DataColumns collection. Read-only.
ObjectType | Returns visObjTypeDataColumns, the type of a DataColumns object. Read-only.
Stat | Returns status information for an object. Read-only.


DataColumns Properties (Visio)

 Copy code hover
[image]

DataColumns Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with the DataColumns collection. Read-only.
Count | Returns the number of DataColumn objects in the DataColumns collection. Read-only.
DataRecordset | Returns the DataRecordset object that contains the DataColumns collection. Read-only.
Document | Gets the Document object that contains the DataColumns collection. Read-only.
Item | Returns the DataColumn object at the specified index position, or of the specified name, in the DataColumns collection. Read-only.
ObjectType | Returns visObjTypeDataColumns, the type of a DataColumns object. Read-only.
Stat | Returns status information for an object. Read-only.


DataColumns.Application Property (Visio)

 Copy code hover
[image]

DataColumns.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio associated with the DataColumns collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Application

expression An expression that returns a DataColumns object.

Return Value

Application


DataColumns.Count Property (Visio)

 Copy code hover
[image]

DataColumns.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of DataColumn objects in the DataColumns collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Count

expression An expression that returns a DataColumns object.

Return Value

Long


DataColumns.DataRecordset Property (Visio)

 Copy code hover
[image]

DataColumns.DataRecordset Property (Visio)
Send feedback

Published: July 16, 2012

Returns the DataRecordset object that contains the DataColumns collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataRecordset

expression An expression that returns a DataColumns object.

Return Value

DataRecordset

Remarks

Each DataRecordset object contains one and only one DataColumns collection.


DataColumns.Document Property (Visio)

 Copy code hover
[image]

DataColumns.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that contains the DataColumns collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Document

expression An expression that returns a DataColumns object.

Return Value

Document


DataColumns.Item Property (Visio)

 Copy code hover
[image]

DataColumns.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns the DataColumn object at the specified index position, or of the specified name, in the DataColumns collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Item(IndexOrName)

expression A variable that represents a DataColumns object.

Parameters

Name | Required/Optional | Data Type | Description
IndexOrName | Required | Variant | The index (as a Long) or the name (as a String) of the data column to retrieve.

Return Value

DataColumn

Remarks

Item is the default property of the DataColumns collection.

When you retrieve objects from a collection, you can omit Item from the expression because it is the default property of all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objectReturned = expression(Index)
objectReturned = expression(Name)

The DataColumns collection is indexed starting with 1.


DataColumns.ObjectType Property (Visio)

 Copy code hover
[image]

DataColumns.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeDataColumns, the type of a DataColumns object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ObjectType

expression An expression that returns a DataColumns object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


DataColumns.Stat Property (Visio)

 Copy code hover
[image]

DataColumns.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Stat

expression A variable that represents a DataColumns object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


DataColumns Methods (Visio)

 Copy code hover
[image]

DataColumns Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
SetColumnProperties | Sets one or more data-column properties for one or more data columns.


DataColumns.SetColumnProperties Method (Visio)

 Copy code hover
[image]

DataColumns.SetColumnProperties Method (Visio)
Send feedback

Published: July 16, 2012

Sets one or more data-column properties for one or more data columns.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .SetColumnProperties(ColumnNames(), Properties(), Values())

expression An expression that returns a DataColumns object.

Parameters

Name | Required/Optional | Data Type | Description
ColumnNames() | Required | String | An array of strings that represent data column names.
Properties() | Required | Long | An array of data-column properties, as VisDataColumnProperties. See Remarks for possible values.
Values() | Required | Variant | An array of values to be assigned to the properties. See Remarks for possible values.

Return Value

Nothing

Remarks

The SetColumnProperties method is a more efficient way to set properties for multiple data columns simultaneously than is setting properties one column at a time. Depending on the items you place in each of the three parameter arrays, you can change multiple properties of the same data column or one or more properties of different data columns. For each change you want to make, pass related column-name/property/value triplets at corresponding positions of all three arrays. Note that the size of all three arrays that you pass to the method must be the same, or the method will return an error.

For the ColumnNames() parameter, pass an array of the names of the data columns whose properties you want to change. If you want to change multiple properties of the same column, you can either place the same name in multiple array positions, or you can place the column name in one array position and place empty strings in the succeeding positions that correspond to the array positions of the properties you want to change.

Possible values for items in the Properties() parameter array are declared in VisDataColumnProperties, and are shown in the following table.

Constant | Value | Description
visDataColumnPropertyCalendar | 3 | Calendar of the data-column property.
visDataColumnPropertyCurrency | 5 | Currency of the data-column property.
visDataColumnPropertyDisplayName | 6 | Display name of the data-column property in the UI.
visDataColumnPropertyHyperlink | 8 | Whether the data-column value becomes a hyperlink in the Visio UI when it is linked to a shape.
visDataColumnPropertyLangID | 2 | Language ID of the data-column property.
visDataColumnPropertyType | 1 | Data type of the data-column property.
visDataColumnPropertyUnits | 4 | Units of the data-column property.
visDataColumnPropertyVisible | 7 | Whether the data-column property is visible in the UI.

Possible values for items in the Values() parameter array depend on the corresponding Property() array parameter values. The table in the DataColumn.SetProperty topic shows valid data-column property values for each data-column property, depending on the data-column data type.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to set the value of a single property for two different columns in the most recently added recordset in the DataRecordsets collection of the active document. The macro assumes that the most recently added recordset is one based on data in the ORGDATA.xls spreadsheet that is shipped with Visio. Sample code for adding that data recordset is shown in the DataRecordsets.Add method topic. However, you can use this code with any data recordset that has at least two columns.

The macro changes the display name of the first column to "Dept." and sets the Hyperlink property of the second column to True. Thereafter (if you used ORGDATA as your data source), the e-mail address of shapes linked to data in the data recordset will act as a hyperlink.

Note that changing the display name of a data column changes only its DisplayName property, and does not change the column's programmatic name, which is specified by its Name property.

VBA Copy code Copy code

Public Sub SetColumnProperties_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intCount As Integer

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount)

    Dim astrColumnNames(1) As String
    Dim alngProperties(1) As Long
    Dim avarValues(1) As Variant

    astrColumnNames(0) = vsoDataRecordset.DataColumns(1).DisplayName
    astrColumnNames(1) = vsoDataRecordset.DataColumns(2).DisplayName

    alngProperties(0) = visDataColumnPropertyDisplayName
    alngProperties(1) = visDataColumnPropertyHyperlink

    avarValues(0) = "Dept."
    avarValues(1) = True

    vsoDataRecordset.DataColumns.SetColumnProperties astrColumnNames, alngProperties, avarValues

End Sub


DataConnection Object (Visio)

 Copy code hover
[image]

DataConnection Object (Visio)
Send feedback

Published: July 16, 2012

Abstracts communication between one or more DataRecordset objects and a non-XML data source.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Remarks

The default property of the DataConnection object is ID.

When you add a new DataRecordset object to the DataRecordsets collection (by using a method other than DataRecordsets.AddFromXML) and you do not specify an existing DataConnection object (by passing the connection string associated with it to the DataRecordsets.Add method), Visio creates a new DataConnection object.

The DataConnection object exposes properties that make it possible to access data-source connection settings:

  • The ConnectionString property gets or sets the connection string used to access an existing DataConnection object or to create a new DataConnection object. Note that setting this property to a new value does not immediately change the connection—Visio re-evaluates this property only when the DataRecordset.Refresh method is called.

  • The Timeout property determines how long (in seconds) Visio should attempt to establish a data-source connection before terminating the connection attempt and generating an error. The default is 15 seconds.

  • The FileName property gets or sets the name of the Office Data Connection (ODC) file that contains the data-source connection and query information used to create a new connection and to refresh data from an existing connection.

Multiple DataRecordset objects can share the same DataConnection object. When any of the data recordsets that share a data connection are refreshed, all are refreshed.


DataConnection Members (Visio)

 Copy code hover
[image]

DataConnection Members (Visio)
Send feedback

Published: July 16, 2012

Abstracts communication between one or more DataRecordset objects and a non-XML data source.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with a DataConnection object. Read-only.
ConnectionString | Gets or sets the connection string that you can use to access an existing DataConnection object or to create a new DataConnection object. Read/write.
Document | Gets the Document object that contains the DataConnection object. Read-only.
FileName | Gets the name of the Office Data Connection (ODC) file that contains the connection string and query command string for the data connection. Read-only.
ID | Gets the unique identifier of the DataConnection object assigned by Visio. Read-only.
ObjectType | Returns visObjTypeDataConnection, the type of a DataConnection object. Read-only.
Stat | Returns status information for an object. Read-only.
Timeout | Gets or sets how long (in seconds) to attempt to establish a data connection before terminating the attempt and generating an error. Read/write.


DataConnection Properties (Visio)

 Copy code hover
[image]

DataConnection Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with a DataConnection object. Read-only.
ConnectionString | Gets or sets the connection string that you can use to access an existing DataConnection object or to create a new DataConnection object. Read/write.
Document | Gets the Document object that contains the DataConnection object. Read-only.
FileName | Gets the name of the Office Data Connection (ODC) file that contains the connection string and query command string for the data connection. Read-only.
ID | Gets the unique identifier of the DataConnection object assigned by Visio. Read-only.
ObjectType | Returns visObjTypeDataConnection, the type of a DataConnection object. Read-only.
Stat | Returns status information for an object. Read-only.
Timeout | Gets or sets how long (in seconds) to attempt to establish a data connection before terminating the attempt and generating an error. Read/write.


DataConnection.Application Property (Visio)

 Copy code hover
[image]

DataConnection.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio associated with a DataConnection object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Application

expression An expression that returns a DataConnection object.

Return Value

Application


DataConnection.ConnectionString Property (Visio)

 Copy code hover
[image]

DataConnection.ConnectionString Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the connection string that you can use to access an existing DataConnection object or to create a new DataConnection object. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ConnectionString

expression An expression that returns a DataConnection object.

Return Value

String

Remarks

The value of the ConnectionString property for a given DataRecordset object is the same string that you would pass to the DataRecordsets.Add method to create the data recordset.

The easiest way to determine an appropriate connection string for a particular data source is to use the Data Selector Wizard in the Visio user interface (UI) to make the same connection, recording a macro while running the wizard, and then copying the connection string from the macro code.

Setting the ConnectionString property to a new value has no effect on data already in any data recordsets. To update the data in a data recordset using a new ConnectionString setting, call the DataRecordset.Refresh method.


DataConnection.Document Property (Visio)

 Copy code hover
[image]

DataConnection.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that contains the DataConnection object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Document

expression An expression that returns a DataConnection object.

Return Value

Document


DataConnection.FileName Property (Visio)

 Copy code hover
[image]

DataConnection.FileName Property (Visio)
Send feedback

Published: July 16, 2012

Gets the name of the Office Data Connection (ODC) file that contains the connection string and query command string for the data connection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .FileName

expression An expression that returns a DataConnection object.

Return Value

String

Remarks

An ODC file contains a connection string that specifies how to connect to an OLEDB or ODBC data source and a query command string that specifies how to extract the desired data from the data source. An ODC file uses HTML and XML to store connection and query information. You can view or edit the contents of the file in any text editor. ODC files have the .odc file name extension.

When you use the DataRecordsets.AddFromConnectionFile to create a new data recordset, you pass the method a string pointing to an ODC file as the FileName parameter. That string then becomes the value of the FileName property for the DataConnection associated with the resulting data recordset. If the DataConnection object is not associated with an ODC file, the FileName property returns the name and full path of the data-source file passed to the DataRecordsets.Add method as the value of the "Data Source" attribute of the ConnectionString parameter when the data recordset was created.

You can use the Data Connection Wizard in Microsoft Access or Microsoft Excel to create an ODC file that will connect to and retrieve the data you want.


DataConnection.ID Property (Visio)

 Copy code hover
[image]

DataConnection.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the unique identifier of the DataConnection object assigned by Visio. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ID

expression A variable that represents a DataConnection object.

Return Value

Long

Remarks

DataConnection IDs are never recycled for a particular document.

ID is the default property of the DataConnection object.


DataConnection.ObjectType Property (Visio)

 Copy code hover
[image]

DataConnection.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeDataConnection, the type of a DataConnection object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ObjectType

expression An expression that returns a DataConnection object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


DataConnection.Stat Property (Visio)

 Copy code hover
[image]

DataConnection.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a DataConnection object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


DataConnection.Timeout Property (Visio)

 Copy code hover
[image]

DataConnection.Timeout Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets how long (in seconds) to attempt to establish a data connection before terminating the attempt and generating an error. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Timeout

expression An expression that returns a DataConnection object.

Return Value

Long

Remarks

The default setting for the Timeout property is 15 seconds.


DataRecordset Object (Visio)

 Copy code hover
[image]

DataRecordset Object (Visio)
Send feedback

Published: July 16, 2012

Stores, formats, refreshes, and exposes data queried from a database in Microsoft Visio.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Remarks

Microsoft Visio can connect to data from a variety of sources, including the following:

  • Microsoft Excel worksheets

  • Microsoft Access databases

  • Microsoft SQL Server databases

  • Microsoft SharePoint lists

  • Other OLEDB/ODBC data sources, such as Oracle databases

  • XML files that adhere to the ADO classic XML schema

Every Visio Document object has a DataRecordsets collection, which is empty until a connection is made to a data source. To connect a Visio document to a data source, you add a DataRecordset object to the DataRecordsets collection of the document.

To add a DataRecordset object to the DataRecordsets collection, you can use one of the following three methods, depending on the type of data source you want to connect to (OLEDB/ODBC or XML) and how you want to pass connection string and query command strings to Visio. By using the

  • DataRecordsets.Add method, you can connect to an OLEDB or ODBC data source and pass connection and query command string information to Visio directly as method parameters.

  • DataRecordsets.AddFromConnectionFile method, you can connect to an OLEBD or ODBC data source by passing the method an Office Data Connection (ODC) file that contains the connection and query command string information you want to supply to Visio.

  • DataRecordsets.AddFromXML method, you pass the method an ADO classic XML string that contains all the data that you want to include in the data recordset.

Once you have created a data recordset, the connection string and query command string associated with the data recordset are represented by the DataConnection.ConnectionString and DataRecordset.CommandString properties respectively.

If the data recordset is associated with a DataConnection object—that is, if you added it to the DataRecordsets collection by using either the Add or AddFromConnectionFile method—you can use the DataConnection property of the DataRecordset object to get the associated DataConnection object.

The default property of a DataRecordset object is ID. The ID property value identifies the DataRecordset in the DataRecordsets collection, and is unique within the collection for any given document.

You can use the Name property of the DataRecordset object to associate a display name with the data recordset.

You can use the GetDataRowIDs method to get an array of the IDs of all the rows in a data recordset, where each row represents a single data record. Once you have retrieved the data-row IDs in this manner, you can use the GetRowData method to get all the data stored in each column in the data row.

You can use the DataColumns property of the DataRecordset object to get the DataColumn object associated with the data recordset. The DataColumn object exposes methods and properties that you can use to customize the mapping of data columns to cells in the Shape Data section of the Visio ShapeSheet spreadsheet for shapes linked to data.

Setting a primary key column for a data recordset can help prevent broken links between shapes and data when data is refreshed. You can get and set the primary key column by using the GetPrimaryKey and SetPrimaryKey methods respectively.

When data changes in the data source, you can refresh the data in a connected (non-XML) data recordset to reflect those changes. You can specify that Visio refresh data automatically at a specified interval by setting the RefreshInterval property, or you can refresh data programmatically by calling the Refresh method.

When you refresh data from a data source that has changed since the last time you refreshed data, conflicts can occur. Conflicts can result when a single shape is linked to more than one row in the same data source, or when a shape is linked to a row in the data source that has been deleted. You can discover and resolve the conflicts that arise from refreshing data by using the GetAllRefreshConflicts, GetMatchingRowsForRefreshConflict, and RemoveRefreshConflict methods.

Note Note

When you save a Visio document that contains one or more data recordsets, all the data in the recordset is saved in the Visio file. For recordsets that contain a large amount of data, this can create large Visio files, which can affect performance. Consequently, you should consider filtering large data sources before importing them into Visio.


DataRecordset Members (Visio)

 Copy code hover
[image]

DataRecordset Members (Visio)
Send feedback

Published: July 16, 2012

Stores, formats, refreshes, and exposes data queried from a database in Microsoft Visio.

Events

Name | Description
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
DataRecordsetChanged | Occurs when a data recordset changes as a result of being refreshed.

Methods

Name | Description
Delete | Deletes the DataRecordset object from the DataRecordsets collection of the document. .
GetAllRefreshConflicts | Returns an array that contains shapes linked to data rows that have non-resolved conflicts after a data recordset is refreshed. .
GetDataRowIDs | Gets an array of the IDs of all the rows in the data recordset.
GetMatchingRowsForRefreshConflict | Returns an array of the row IDs of data-recordset rows linked to a shape that are in conflict after the data recordset is refreshed.
GetPrimaryKey | Gets the primary key setting and the name of the primary key column or columns for the data recordset.
GetRowData | Gets the data in all columns in the specified row.
Refresh | Executes the query string associated with the connected (non-XML-based) DataRecordset and updates linked shapes with new data from the data source returned by the query.
RefreshUsingXML | Updates linked shapes with data contained in the string that conforms to the ADO classic XML schema passed to the method as a parameter.
RemoveRefreshConflict | Clears information about a conflict for a data-linked shape from the current document.
SetPrimaryKey | Sets the primary key setting value and the name of the primary key column or columns for the data recordset.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with a DataRecordset object. Read-only.
CommandString | Gets or sets the command string used to query the data source to create a data recordset or refresh an existing one. Read/write.
DataAsXML | Returns an XML string that fully describes a data recordset and conforms to the Microsoft ActiveX® Data Objects (ADO) classic XML schema. Read-only.
DataColumns | Returns the DataColumns collection associated with the DataRecordset object. Read-only.
DataConnection | Returns the DataConnection object associated with the DataRecordset object. Read-only.
Document | Gets the Document object that contains the DataRecordset object. Read-only.
EventList | Returns the EventList collection of the DataRecordset object. Read-only.
ID | Gets the unique identifier of the DataRecordset object assigned by Visio. Read-only.
LinkReplaceBehavior | Gets or sets how existing links between shapes and data rows are handled when methods that link shapes to data is called. Read/write.
Name | Gets or sets the display name of the data recordset. Read/write.
ObjectType | Returns visObjTypeDataRecordset, the type of a DataRecordset object. Read-only.
RefreshInterval | Gets or sets how often Microsoft Visio automatically refreshes the data recordset. Read/write.
RefreshSettings | Gets and sets options that determine how the data recordset is refreshed. Read/write.
Stat | Returns status information for an object. Read-only.
TimeRefreshed | Returns the date and time the data recordset was last refreshed. Read-only.


DataRecordset Properties (Visio)

 Copy code hover
[image]

DataRecordset Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with a DataRecordset object. Read-only.
CommandString | Gets or sets the command string used to query the data source to create a data recordset or refresh an existing one. Read/write.
DataAsXML | Returns an XML string that fully describes a data recordset and conforms to the Microsoft ActiveX® Data Objects (ADO) classic XML schema. Read-only.
DataColumns | Returns the DataColumns collection associated with the DataRecordset object. Read-only.
DataConnection | Returns the DataConnection object associated with the DataRecordset object. Read-only.
Document | Gets the Document object that contains the DataRecordset object. Read-only.
EventList | Returns the EventList collection of the DataRecordset object. Read-only.
ID | Gets the unique identifier of the DataRecordset object assigned by Visio. Read-only.
LinkReplaceBehavior | Gets or sets how existing links between shapes and data rows are handled when methods that link shapes to data is called. Read/write.
Name | Gets or sets the display name of the data recordset. Read/write.
ObjectType | Returns visObjTypeDataRecordset, the type of a DataRecordset object. Read-only.
RefreshInterval | Gets or sets how often Microsoft Visio automatically refreshes the data recordset. Read/write.
RefreshSettings | Gets and sets options that determine how the data recordset is refreshed. Read/write.
Stat | Returns status information for an object. Read-only.
TimeRefreshed | Returns the date and time the data recordset was last refreshed. Read-only.


DataRecordset.Application Property (Visio)

 Copy code hover
[image]

DataRecordset.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio associated with a DataRecordset object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Application

expression An expression that returns a DataRecordset object.

Return Value

Application


DataRecordset.CommandString Property (Visio)

 Copy code hover
[image]

DataRecordset.CommandString Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the command string used to query the data source to create a data recordset or refresh an existing one. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .CommandString

expression An expression that returns a DataRecordset object.

Return Value

String

Remarks

The command string of a data recordset specifies the database table or Microsoft Excel worksheet and the columns within the table or worksheet that contain the data you want to query. The command string is also passed to the DataRecordset.Refresh method when the data in the data recordset is refreshed.

Setting the CommandString property to a new value has no effect on data already in the data recordset. To update the data in a data recordset using a new CommandString setting, call the Refresh method.

The CommandString property does not apply to data recordsets created by using the AddFromXML method.

The following sample command string directs Visio to retrieve all data from an Excel worksheet named Sheet1: "SELECT * FROM [Sheet1$]".


DataRecordset.DataAsXML Property (Visio)

 Copy code hover
[image]

DataRecordset.DataAsXML Property (Visio)
Send feedback

Published: July 16, 2012

Returns an XML string that fully describes a data recordset and conforms to the Microsoft ActiveX® Data Objects (ADO) classic XML schema. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataAsXML

expression An expression that returns a DataRecordset object.

Return Value

String

Remarks

The string returned by DataAsXML contains all the rows in the data recordset with Microsoft Visio row IDs pre-pended to them.

The string returned by DataAsXML contains all the valid rows and columns in the data recordset that was imported as well as an additional column, named _Visio_RowID_, inserted as the first column, that assigns a unique row ID to each row in the data recordset.


DataRecordset.DataColumns Property (Visio)

 Copy code hover
[image]

DataRecordset.DataColumns Property (Visio)
Send feedback

Published: July 16, 2012

Returns the DataColumns collection associated with the DataRecordset object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataColumns

expression An expression that returns a DataRecordset object.

Return Value

DataColumns

Remarks

Every DataRecordset object contains a DataColumns collection of all the DataColumn objects associated with the DataRecordset object. These objects allow you to map data columns to cells in the Shape Data (formerly Custom Properties) section of the Visio ShapeSheet spreadsheet.

Once you get the DataColumns collection, you can use its SetColumnProperties method to set the properties of multiple data columns, or you can get and set the properties of individual data columns by using the DataColumn.GetProperty and DataColumn.SetProperty properties respectively.


DataRecordset.DataConnection Property (Visio)

 Copy code hover
[image]

DataRecordset.DataConnection Property (Visio)
Send feedback

Published: July 16, 2012

Returns the DataConnection object associated with the DataRecordset object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataConnection

expression An expression that returns a DataRecordset object.

Return Value

DataConnection

Remarks

You can get the connection string associated with a data recordset by first using the DataConnection property to get the DataConnection object associated with the data recordset and then getting the DataConnection.ConnectionString property value.

The DataConnection property returns Nothing for "connectionless" DataRecordset objects—those that are created by using the DataRecordsets.AddFromXML method.


DataRecordset.Document Property (Visio)

 Copy code hover
[image]

DataRecordset.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that contains the DataRecordset object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Document

expression An expression that returns a DataRecordset object.

Return Value

Document


DataRecordset.EventList Property (Visio)

 Copy code hover
[image]

DataRecordset.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of the DataRecordset object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .EventList

expression An expression that returns a DataRecordset object.

Return Value

EventList

Remarks

Once you retrieve the EventList collection, to receive a notification when one of the events in that collection fires, you can pass the ID of the Event object that represents that event to the EventList.AddAdvise method as its EventCode parameter.


DataRecordset.ID Property (Visio)

 Copy code hover
[image]

DataRecordset.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the unique identifier of the DataRecordset object assigned by Visio. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ID

expression A variable that represents a DataRecordset object.

Return Value

Long

Remarks

DataRecordset IDs are never recycled for a particular document.

ID is the default property of the DataRecordset object.


DataRecordset.LinkReplaceBehavior Property (Visio)

 Copy code hover
[image]

DataRecordset.LinkReplaceBehavior Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets how existing links between shapes and data rows are handled when methods that link shapes to data is called. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .LinkReplaceBehavior

expression An expression that returns a DataRecordset object.

Return Value

VisLinkReplaceBehavior

Remarks

The following constants for link replacement behaviors are declared by the Visio type library in VisLinkReplaceBehavior:

Constant | Value | Description
visLinkReplaceAlways | 1 | Always replace links when linking to a shape that has existing links
visLinkReplaceNever | 0 | Never replace links when linking to a shape that has existing links
visLinkReplacePrompt | 2 | Prompt the user before replacing links when the user attempts to create links in the Visio user interface (UI).

These options correspond to those available in the Properties dialog box for the tab corresponding to the data recordset in the External Data window. (In the External Data window, on the tab for the data recordset, right-click, point to Data Source, and then click Properties.)

Methods affected by this property setting include Selection.LinkToData, Shape.LinkToData, and Selection.AutomaticLink.

In the UI, when users attempt to link to data shapes that have existing links to data and the setting is visLinkReplacePrompt, Visio responds by opening a dialog box to inform users that their actions will break the existing links and ask if they want to proceed. Because opening a dialog box is not an appropriate response to a method call, when you link shapes by calling any of these methods, Visio treats the setting visLinkReplacePrompt as if it were visLinkReplaceAlways. That is, these two settings differ in how they affect behavior in the UI, but not programmatic behavior. The default is always to replace existing links when linking is performed programmatically, but to prompt when linking is performed in the UI.

When LinkReplaceBehavior is set to visLinkReplaceNever, both of the LinkToData methods are disabled and calls to them fail.

The LinkReplaceBehavior setting also affects the default setting of the Replace Existing Links check box on the second screen of the Automatic Link wizard in the Visio UI (on the Data tab, click Automatically Link). If LinkReplaceBehavior is set to visLinkReplaceAlways or visLinkReplacePrompt, this box is selected by default. If the LinkReplaceBehavior property is set to visLinkReplaceNever, the check box is cleared by default. Users can change the wizard's default behavior by selecting or clearing the check box.

In addition, the LinkReplaceBehavior setting determines how the Selection.AutomaticLink method functions. As is the case for the LinkToData methods, when LinkReplaceBehavior is set to visLinkReplaceAlways or visLinkReplacePrompt, AutomaticLink replaces existing links. And when LinkReplaceBehavior is set to visLinkReplaceNever, AutomaticLink does not replace existing links.

The difference between the LinkToData methods and the AutomaticLink method, however, is that for AutomaticLink, you can override the LinkReplaceBehavior setting by passing either the visAutoLinkReplaceExistingLinks or the visAutoLinkDontReplaceExistingLinks constant from the VisAutoLinkBehaviors enumeration to the method as the AutoLinkBehavior parameter.

So, for example, if LinkReplaceBehavior is set to visLinkReplaceNever, you can specify that AutomaticLink nevertheless replaces existing links by passing it visAutoLinkReplaceExistingLinks.


DataRecordset.Name Property (Visio)

 Copy code hover
[image]

DataRecordset.Name Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the display name of the data recordset. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Name

expression A variable that represents a DataRecordset object.

Return Value

String

Remarks

The display name of a DataRecordset object is the name that you passed as the Name parameter to the DataRecordsets.Add, DataRecordsets.AddFromConnectionFile , or DataRecordsets.AddFromXML method when you first created the data recordset; or the name that you subsequently assigned by setting this property. If you do not assign a name when you create a data recordset, Microsoft Visio assigns a default name, such asSheet1, which would be the assigned name if you imported data from a Microsoft Excel workbook.

If you specify (in the AddOptions parameter of one of the Add methods) that the External Data window be displayed in the Visio user interface, the display name appears on the tab of the External Data window that corresponds to the data recordset.

The Name property value must be unique within a particular document—you cannot assign the same display name to more than one data recordset. If you attempt to assign the Name property value of an existing data recordset to the another data recordset in the same document, the assignment fails. If you add a new data recordset to a document by using the Add method, and if you pass the Add method the name of an existing data recordset as a display name, Visio appends a dash and a numeral (-1, for example) to the name to make it unique within the context of the document.

However, if you delete a data recordset, you can reuse the display name of the deleted data recordset for another data recordset in the same document. This is in contrast to the case with the DataRecordset.ID property value. A particular ID is unique for the life of the document and you cannot reuse it, even if you delete the data recordset to which it was assigned.


DataRecordset.ObjectType Property (Visio)

 Copy code hover
[image]

DataRecordset.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeDataRecordset, the type of a DataRecordset object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ObjectType

expression An expression that returns a DataRecordset object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


DataRecordset.RefreshInterval Property (Visio)

 Copy code hover
[image]

DataRecordset.RefreshInterval Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets how often Microsoft Visio automatically refreshes the data recordset. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .RefreshInterval

expression An expression that returns a DataRecordset object.

Return Value

Long

Remarks

When you create a DataRecordset object, its RefreshInterval property is set to the default, 0. This setting indicates that data is not refreshed automatically.

By setting RefreshInterval to a positive Long value, you can specify the time in minutes between automatic refreshes. The minimum interval you can specify is one minute.

This setting corresponds to the value a user can set in the Configure Refresh dialog box.


DataRecordset.RefreshSettings Property (Visio)

 Copy code hover
[image]

DataRecordset.RefreshSettings Property (Visio)
Send feedback

Published: July 16, 2012

Gets and sets options that determine how the data recordset is refreshed. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .RefreshSettings

expression An expression that returns a DataRecordset object.

Return Value

Long

Remarks

Constants for how a data recordset is refreshed are declared in the VisRefreshSettings enumeration in the Visio type library:

Constant | Value | Description
visRefreshNoReconciliationUI | 2 | Disables the Refresh Conflicts task pane in the Visio user interface (UI) after a refresh operation.
visRefreshOverwriteAll | 1 | When data is refreshed, overwrites all user changes made in the shape data of shapes linked to data in this recordset since the previous refresh operation. See note.

The default is for neither of the VisRefreshSettings flags to be turned on. (RefreshSettings = 0).

When visRefreshNoReconciliationUI is set, support for reconciling refresh conflicts in the Visio UI is disabled. As a developer, you should reconcile refresh conflicts programmatically by using the GetAllRefreshConflicts, GetMatchingRowsForRefreshConflict, and RemoveRefreshConflict methods.

Note Note

In some previous versions of Visio, shape data was called custom properties.


DataRecordset.Stat Property (Visio)

 Copy code hover
[image]

DataRecordset.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Stat

expression A variable that represents a DataRecordset object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


DataRecordset.TimeRefreshed Property (Visio)

 Copy code hover
[image]

DataRecordset.TimeRefreshed Property (Visio)
Send feedback

Published: July 16, 2012

Returns the date and time the data recordset was last refreshed. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .TimeRefreshed

expression An expression that returns a DataRecordset object.

Return Value

Date

Remarks

The TimeRefreshed property value is returned in Coordinated Universal Time (Greenwich Mean Time).

If you successfully create a data recordset but it fails to retrieve any data from the data source, TimeRefreshed returns zero.

The first time you execute a query against a data recordset, TimeRefreshed is set to the time the query is executed. If, subsequently, the Refresh method is called, TimeRefreshed is set to the time the data recordset is refreshed.


DataRecordset Methods (Visio)

 Copy code hover
[image]

DataRecordset Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the DataRecordset object from the DataRecordsets collection of the document. .
GetAllRefreshConflicts | Returns an array that contains shapes linked to data rows that have non-resolved conflicts after a data recordset is refreshed. .
GetDataRowIDs | Gets an array of the IDs of all the rows in the data recordset.
GetMatchingRowsForRefreshConflict | Returns an array of the row IDs of data-recordset rows linked to a shape that are in conflict after the data recordset is refreshed.
GetPrimaryKey | Gets the primary key setting and the name of the primary key column or columns for the data recordset.
GetRowData | Gets the data in all columns in the specified row.
Refresh | Executes the query string associated with the connected (non-XML-based) DataRecordset and updates linked shapes with new data from the data source returned by the query.
RefreshUsingXML | Updates linked shapes with data contained in the string that conforms to the ADO classic XML schema passed to the method as a parameter.
RemoveRefreshConflict | Clears information about a conflict for a data-linked shape from the current document.
SetPrimaryKey | Sets the primary key setting value and the name of the primary key column or columns for the data recordset.


DataRecordset.Delete Method (Visio)

 Copy code hover
[image]

DataRecordset.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes the DataRecordset object from the DataRecordsets collection of the document. .

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Delete

expression A variable that represents a DataRecordset object.

Return Value

Nothing

Remarks

If the DataRecordset object to be deleted is associated with a DataConnection object, and if that DataConnection object is not associated with any other DataRecordset objects, Microsoft Visio also deletes the DataConnection object.

Note that deleting a DataRecordset object does not delete the shapes that had been linked to data in that data recordset, nor does delete any existing shape data in those shapes that was created when the shapes were linked to data.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Delete method to delete a DataRecordset from the DataRecordsets collection of the current document. It gets the count of all data recordsets associated with the current document and deletes the one most recently added.

VBA Copy code Copy code
Public Sub Delete_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intCount As Integer

    intCount = ThisDocument.DataRecordsets.Count
    Set vsoDataRecordset = ThisDocument.DataRecordsets(intCount)
    vsoDataRecordset.Delete

End Sub


DataRecordset.GetAllRefreshConflicts Method (Visio)

 Copy code hover
[image]

DataRecordset.GetAllRefreshConflicts Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array that contains shapes linked to data rows that have non-resolved conflicts after a data recordset is refreshed. .

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetAllRefreshConflicts

expression An expression that returns a DataRecordset object.

Return Value

Shape()

Remarks

When you refresh data from a data source that has changed since the last time you refreshed data, conflicts can occur. Conflicts can result when a single shape is linked to more than one row in the same data source, or when a shape is linked to a row in the data source that has been deleted.

To determine which data-recordset rows produced the conflict, pass the shape(s) returned by GetAllRefreshConflicts to the GetMatchingRowsForRefreshConflict method, which returns an array of rows that are in conflict.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetAllRefreshConflicts method to determine which shapes, if any, have conflicts after a data recordset is refreshed. It refreshes the data recordset most recently added and if it finds no resulting conflicts, prints "No conflicts" in the Immediate window. If it does find conflicts, it iterates through the returned shape array and prints the names of the shapes that have conflicts in the same window.

Before running this macro, make sure that the most recently added data recordset is a connected (non-XML-based) data recordset and that the connection to the original data source is still available. Then delete a row from the data source or make another change that will cause a conflict.

VBA Copy code Copy code
Public Sub GetAllRefreshConflicts_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intRecordsetCount As Integer
    Dim intShapeCount As Integer
    Dim avsoShapes() As Visio.Shape

    intRecordsetCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intRecordsetCount)

    vsoDataRecordset.Refresh
    avsoShapes = vsoDataRecordset.GetAllRefreshConflicts

    If IsEmpty(avsoShapes) Then
        Debug.Print "No conflict"
    Else
        For intShapeCount = LBound(avsoShapes) To UBound(avsoShapes)
            Debug.Print avsoShapes(intShapeCount).Name
        Next intShapeCount
    End If

End Sub


DataRecordset.GetDataRowIDs Method (Visio)

 Copy code hover
[image]

DataRecordset.GetDataRowIDs Method (Visio)
Send feedback

Published: July 16, 2012

Gets an array of the IDs of all the rows in the data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetDataRowIDs(CriteriaString)

expression An expression that returns a DataRecordset object.

Parameters

Name | Required/Optional | Data Type | Description
CriteriaString | Required | String | A string that conforms to the guidelines specified in the Microsoft ActiveX Data Object (ADO) API for setting the ADO.Filter property

Return Value

Long()

Remarks

You can use the GetDataRowIDs method to get an array of the IDs of all the rows in a data recordset, where each row represents a single data record. The GetDataRowIDs method takes as its parameter a criteria string, which is a string that conforms to the guidelines specified in the ADO API for setting the ADO.Filter property. By specifying appropriate criteria and using AND and OR operators to separate clauses, you can filter the information in the data recordset to return only certain data recordset rows selectively. To apply no filter (that is, to get all the rows), pass an empty string ("").

For more information about criteria strings, see Filter Property in the ADO 2.8 API Reference.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how you can use the GetDataRowIDs and GetRowData methods to return the row ID of each row and then get the data stored in each column in every row of the specified data recordset. The macro gets the count of all data recordsets associated with the current document and gets row data for the one most recently added. It iterates through all the rows in the data recordset and then, for each row, iterates through all the columns in that row. The code displays the information returned in the Immediate window.

Before running this macro, create at least one data recordset in the current document.

Note that the macro passes an empty string to the GetDataRowIDs method to bypass filtering and get all the rows in the recordset. After you run the macro, note that the first set of data shown (corresponding to the first data row) contains the headings for all the data columns in the data recordset.

VBA Copy code Copy code
Public Sub GetDataRowIDs_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intCount As Integer
    Dim lngRowIDs() As Long
    Dim lngRow As Long
    Dim lngColumn As Long
    Dim varRowData As Variant

    'Get the count of all data recordsets in the current document.
    intCount = ThisDocument.DataRecordsets.Count

    Set vsoDataRecordset = ThisDocument.DataRecordsets(intCount)

    'Get the row IDs of all the rows in the data recordset
    lngRowIDs = vsoDataRecordset.GetDataRowIDs("")

    'Iterate through all the records in the data recordset.
    For lngRow = LBound(lngRowIDs) To UBound(lngRowIDs) + 1
        varRowData = vsoDataRecordset.GetRowData(lngRow)

        'Print a separator between rows
        Debug.Print "------------------------------"

       'Print the data stored in each column of a particular data row.
        For lngColumn = LBound(varRowData) To UBound(varRowData)
            Debug.Print varRowData(lngColumn)
        Next lngColumn
    Next lngRow

End Sub


DataRecordset.GetMatchingRowsForRefreshConflict Method (Visio)

 Copy code hover
[image]

DataRecordset.GetMatchingRowsForRefreshConflict Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of the row IDs of data-recordset rows linked to a shape that are in conflict after the data recordset is refreshed.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetMatchingRowsForRefreshConflict(ShapeInConflict)

expression An expression that returns a DataRecordset object.

Parameters

Name | Required/Optional | Data Type | Description
ShapeInConflict | Required | Shape | A shape linked to data that has a conflict after the data recordset is refreshed.

Return Value

Long()

Remarks

The GetAllRefreshConflicts method returns an array of shapes where a conflict exists between data in the shape and data in the data-recordset row to which the shape is linked. To determine which data-recordset rows produced a conflict, you can then pass each of these shapes in turn to the GetMatchingRowsForRefreshConflict method, which returns an array of rows that are in conflict for a given shape.

Rows in the data recordset can be in conflict when two or more of them have identical primary keys, and may link to the same shape. When this occurs, GetMatchingRowsForRefreshConflict returns an array containing at least two row IDs.

Conflicts can also occur when a previously data-linked row from the data recordset is removed. When this occurs, the method returns an empty array.

To remove a conflict, pass the shape that has the conflict to the RemoveRefreshConflict method, which removes the conflicting information from the current document. Information about conflicts is persisted in the current document until either you delete the shape in conflict or you call RemoveRefreshConflict on the shape.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetAllRefreshConflicts method to determine which shapes, if any, have conflicts after a data recordset is refreshed and then use the GetMatchingRowsForRefreshConflict method to determine which data recordset row or rows is causing the conflict. It refreshes the data recordset most recently added and if it finds no resulting conflicts, prints "No conflicts" in the Immediate window. If it does find conflicts, it passes each of the shapes that have conflicts to the GetMatchingRowsForRefreshConflict method and prints the resulting row IDs in the same window.

Before running this macro, make sure that the most recently added data recordset is a connected (non-XML-based) data recordset and that the connection to the original data source is still available. Then delete a row in the data source or make another change that will cause a conflict when you refresh the data recordset.

VBA Copy code Copy code
Public Sub GetMatchingRowsForRefreshConflict_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intRecordsetCount As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes() As Visio.Shape

    Dim intRowCount As Integer
    Dim vsoShapeInConflict As Visio.Shape

    Dim alngRowIDs() As Long
    Dim lngvsoRowID As Long

    intRecordsetCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intRecordsetCount)

    vsoDataRecordset.Refresh
    vsoShapes = vsoDataRecordset.GetAllRefreshConflicts

    If IsEmpty(vsoShapes) Then
        Debug.Print "No conflict"
    Else
        For intShapeCount = LBound(vsoShapes) To UBound(vsoShapes)
            Set vsoShapeInConflict = vsoShapes(intShapeCount)
            alngRowIDs = vsoDataRecordset.GetMatchingRowsForRefreshConflict(vsoShapeInConflict)

            If IsEmpty(alngRowIDs) Then
                Debug.Print "For shape:", vsoShapeInConflict.Name, "Row deleted."
            Else
                For intRowCount = LBound(alngRowIDs) To UBound(alngRowIDs)
                    lngvsoRowID = alngRowIDs(intRowCount)
                    Debug.Print "For shape:", vsoShapeInConflict.Name, "Row ID of row in conflict:", lngvsoRowID
                Next intRowCount
            End If

        Next intShapeCount

    End If

End Sub


DataRecordset.GetPrimaryKey Method (Visio)

 Copy code hover
[image]

DataRecordset.GetPrimaryKey Method (Visio)
Send feedback

Published: July 16, 2012

Gets the primary key setting and the name of the primary key column or columns for the data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetPrimaryKey(PrimaryKeySettings, PrimaryKey())

expression An expression that returns a DataRecordset object.

Parameters

Name | Required/Optional | Data Type | Description
PrimaryKeySettings | Required | VisPrimaryKeySettings | Out parameter. The primary key setting for the data recordset. See Remarks for possible values.
PrimaryKey() | Required | String | Out parameter. An array of String variables.

Return Value

Nothing

Remarks

You can use the GetPrimaryKey method to determine the existing primary key setting for a data recordset and the name of the primary key column or columns if a primary key has been specified. The method returns the primary key setting for the data recordset in the PrimaryKeySettings out parameter, as a value from the VisPrimaryKeySettings enumeration. The default (when no primary key has been specified) is visKeyRowOrder, which means that Microsoft Visio identifies data recordset rows by row order.

A data recordset for which a primary key has been specified can have single or composite primary key columns. A single-column primary key bases row identification on the values in a single column. A composite primary key uses two or more columns to identify a row uniquely. Possible values for PrimaryKeySettings are shown in this table.

Constant | Value | Description
visKeyRowOrder | 1 | Use row order as the primary key.
visKeySingle | 2 | Use a single column as the primary key column.
visKeyComposite | 3 | Use multiple columns as primary key columns.

For the PrimaryKey() out parameter, pass a dimensionless array of strings. If the primary key setting returned is visKeySingle or visKeyComposite, the method also returns an array of primary key column name strings in the PrimaryKey() out parameter. If the primary key setting is visKeyRowOrder, the default, the method returns an empty array.

You can use the DataRecordset.SetPrimaryKey method to specify the primary key setting for the data recordset as well as the name of the column or columns that you want to set as the primary key column or columns. When you set primary keys, make sure that the column or columns you pick to be primary key columns contain unique values (or value sets) for each row.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how you can use the GetPrimaryKey method to determine the primary key setting for a data recordset as well as the name of the first primary key column. The macro finds the most recently created data recordset associated with the document and, if a primary key has been specified, prints in the Immediate window the value of the primary key setting and the name of the first primary key column for the data recordset. If no primary key exists, it prints the primary key setting and the statement "No primary key."

Before running this macro, create at least one data recordset in the current document and, if you want, specify a primary key by using the SetPrimaryKey method.

VBA Copy code Copy code
Public Sub GetPrimaryKey_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intCount As Integer
    Dim astrPrimaryKeyColumns() As String
    Dim vsoKeySettings As VisPrimaryKeySettings

    intCount = ThisDocument.DataRecordsets.Count
    Set vsoDataRecordset = ThisDocument.DataRecordsets(intCount)
    vsoDataRecordset.GetPrimaryKey vsoKeySettings, astrPrimaryKeyColumns

    If vsoKeySettings = visKeyRowOrder Then
        Debug.Print vsoKeySettings, "No primary key"
    Else
        Debug.Print vsoKeySettings, astrPrimaryKeyColumns(0)
    End If

End Sub


DataRecordset.GetRowData Method (Visio)

 Copy code hover
[image]

DataRecordset.GetRowData Method (Visio)
Send feedback

Published: July 16, 2012

Gets the data in all columns in the specified row.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetRowData(DataRowID)

expression An expression that returns a DataRecordset object.

Parameters

Name | Required/Optional | Data Type | Description
DataRowID | Required | Long | The ID of the row in the data recordset from which you want to retrieve data.

Return Value

Variant()

Remarks

To get the row IDs of all the rows in the data recordset, use the GetDataRowIDs method. See the example in this topic.

If you pass a row ID of zero for the DataRowID parameter, the GetRowData method returns the names of the columns in the data recordset. If you pass any other valid row ID than zero, the GetRowData method returns values for all the columns in the specified row, in the same order as the column names that the method returns when you pass zero.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how you can use the GetDataRowIDs and GetRowData methods to return the row ID of each row and then get the data stored in each column in every row of the specified data recordset. The macro gets the count of all data recordsets associated with the current document and gets row data for the one most recently added. It iterates through all the rows in the data recordset and then, for each row, iterates through all the columns in that row. The code displays the information returned in the Immediate window.

Before running this macro, create at least one data recordset in the current document.

Note that the macro passes an empty string to the GetDataRowIDs method to bypass filtering and get all the rows in the recordset. After you run the macro, note that the first set of data shown (corresponding to the first data row) contains the headings for all the data columns in the data recordset.

VBA Copy code Copy code
Public Sub GetRowData_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intCount As Integer
    Dim lngRowIDs() As Long
    Dim lngRow As Long
    Dim lngColumn As Long
    Dim varRowData As Variant

    'Get the count of all data recordsets in the current document.
    intCount = ThisDocument.DataRecordsets.Count

    Set vsoDataRecordset = ThisDocument.DataRecordsets(intCount)

    'Get the row IDs of all the rows in the data recordset
    lngRowIDs = vsoDataRecordset.GetDataRowIDs("")

    'Iterate through all the records in the data recordset.
    For lngRow = LBound(lngRowIDs) To UBound(lngRowIDs) + 1
        varRowData = vsoDataRecordset.GetRowData(lngRow)

        'Print a separator between rows
        Debug.Print "------------------------------"

       'Print the data stored in each column of a particular data row.
        For lngColumn = LBound(varRowData) To UBound(varRowData)
            Debug.Print varRowData(lngColumn)
        Next lngColumn
    Next lngRow

End Sub


DataRecordset.Refresh Method (Visio)

 Copy code hover
[image]

DataRecordset.Refresh Method (Visio)
Send feedback

Published: July 16, 2012

Executes the query string associated with the connected (non-XML-based) DataRecordset and updates linked shapes with new data from the data source returned by the query.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Refresh

expression An expression that returns a DataRecordset object.

Return Value

Nothing

Remarks

Calling the Refresh method on a particular DataRecordset object results in refreshing all other DataRecordset objects associated with the same DataConnection object (that is, having the same value for their DataConnection property). DataRecordset objects sharing the same DataConnection property value are called transacted data recordsets. The Refresh method must be called on a data recordset that is associated with a DataConnection objecct.

If you call Refresh on a data recordset not associated with a DataConnection object (one that was created by using the DataRecordsets.AddFromXML method), the Refresh method will return an error.

If calling Refresh results in conflicts, Visio displays the Refresh Conflicts task pane in the user interface, unless you set the DataRecordset.RefreshSettings property to include the visRefreshNoReconciliationUI enumerated value.

Before refreshing linked data, if you want to change the query string Visio uses to retrieve the data to query a different table in the same database, set the DataRecordset.CommandString property to a new value. To connect to an entirely new data source, set both the DataRecordset.CommandString and DataConnection.ConnectionString property values.

When you refresh data and a conflict occurs, you can use the DataRecordset.GetAllRefreshConflicts and DataRecordset.GetMatchingRowsForRefreshConflict methods to determine why the conflict arose.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Refresh method to refresh the data in a DataRecordset object from the DataRecordsets collection of the current document. It gets the count of all data recordsets associated with the current document and refreshes the one most recently added. It also refreshes any other data recordsets associated with the current document that share a common data connection with the one being refreshed.

Before you run this macro, make sure that the current document contains at least one data recordset, and that the most recently added data recordset is connected (non-XML-based).

VBA Copy code Copy code
Public Sub Refresh_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intCount As Integer

    intCount = ThisDocument.DataRecordsets.Count
    Set vsoDataRecordset = ThisDocument.DataRecordsets(intCount)
    vsoDataRecordset.Refresh

End Sub


DataRecordset.RefreshUsingXML Method (Visio)

 Copy code hover
[image]

DataRecordset.RefreshUsingXML Method (Visio)
Send feedback

Published: July 16, 2012

Updates linked shapes with data contained in the string that conforms to the ADO classic XML schema passed to the method as a parameter.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .RefreshUsingXML(NewDataAsXML)

expression An expression that returns a DataRecordset object.

Parameters

Name | Required/Optional | Data Type | Description
NewDataAsXML | Required | String | An XML string that contains new data to refresh the data recordset and that conforms to the classic ADO schema.

Return Value

Nothing

Remarks

For the XMLString parameter, pass an XML string that conforms to the ADO classic XML schema and that describes the data you want to import. A sample XML string is shown in the example later in this topic.

The data in the XML string you pass to the RefreshUsingXML method should be structured in a manner similar to that of the data in the data recordset you want to update. At a minimum, the primary key columns should be the same in both sets of data. The primary key identifies the name of the data column or columns that contain unique identifiers for each row. The value in the primary key column for each row uniquely identifies that row in the data recordset.

When you create a data recordset, Microsoft Visio assigns row IDs to all the rows in the recordset based on the existing order of the rows in the data source.

If the XML string you pass to the RefreshUsingXML method contains a column consisting of Visio row IDs (as it would, for example, if you exported it from Visio by getting the DataAsXML property value of the data recordset), the RefreshUsingXML method attempts to validate the row IDs in the string. If the method finds the row IDs to be valid, it reuses them in the updated data recordset. If it finds them to be invalid, it returns an error.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how you can use the RefreshUsingXML method to update an existing data recordset with data contained in an ADO classic XML string.

A sample XML string is shown here. Before running this macro, open a new Visio drawing and run the macro in the DataRecordsets.AddFromXML method topic.

When you pass it to the RefreshUsingXML method, this string will update the data recordset that the AddFromXML method created, changing the city names.

VBA Copy code Copy code
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly' rs:updatable='true'>
<s:AttributeType name='c1' rs:name='Cities'
rs:number='2' rs:nullable='true' rs:maydefer='true' rs:write='true'>
<s:datatype dt:type='string' dt:maxLength='255' rs:precision='0'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
<rs:data>
<z:row c1='New York' />
<z:row c1='London' />
</rs:data>
</xml>

In the following sample code, we pass the RefreshUsingXML method the name of an XML string containing the updated data.

VBA Copy code Copy code
Public Sub RefreshUsingXML_Example()

    Dim strXML As String
    Dim intCount As Integer
    Dim vsoDataRecordset As Visio.DataRecordset

intCount = ThisDocument.DataRecordsets.Count

    strXML = "<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'" + Chr(10) _
    & "xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'" + Chr(10) _
    & "xmlns:rs='urn:schemas-microsoft-com:rowset'" + Chr(10) _
    & "xmlns:z='#RowsetSchema'>" + Chr(10) _
    & "<s:Schema id='RowsetSchema'>" + Chr(10) _
    & "<s:ElementType name='row' content='eltOnly' rs:updatable='true'>" + Chr(10) _
    & "<s:AttributeType name='c1' rs:name='Cities'" + Chr(10) _
    & "rs:number='2' rs:nullable='true' rs:maydefer='true' rs:write='true'>" + Chr(10) _
    & "<s:datatype dt:type='string' dt:maxLength='255' rs:precision='0'/>" + Chr(10) _
    & "</s:AttributeType>" + Chr(10) _
    & "<s:extends type='rs:rowbase'/>" + Chr(10) _
    & "</s:ElementType>" + Chr(10) _
    & "</s:Schema>" + Chr(10) _
    & "<rs:data>" + Chr(10) _
    & "<z:row c1='New York'/>" + Chr(10) _
    & "<z:row c1='London'/>" + Chr(10) _
    & "</rs:data>" + Chr(10) _
    & "</xml>"

    ThisDocument.DataRecordsets(intCount).RefreshUsingXML(strXML)

End Sub


DataRecordset.RemoveRefreshConflict Method (Visio)

 Copy code hover
[image]

DataRecordset.RemoveRefreshConflict Method (Visio)
Send feedback

Published: July 16, 2012

Clears information about a conflict for a data-linked shape from the current document.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .RemoveRefreshConflict(ShapeInConflict)

expression An expression that returns a DataRecordset object.

Parameters

Name | Required/Optional | Data Type | Description
ShapeInConflict | Required | [IVSHAPE] | A shape linked to data that has a conflict after the data recordset is refreshed.

Return Value

Nothing

Remarks

If ShapeInConflict actually has no conflicts, the method will have no effect.

If you choose not to remove information about a conflict, that information will be persisted in the current document indefinitely.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the RemoveRefreshConflict method to remove conflicts. It calls the GetAllRefreshConflicts method to determine which shapes, if any, have conflicts after a data recordset is refreshed. Then it calls the GetMatchingRowsForRefreshConflict method to determine which data recordset row or rows is causing the conflict.

It refreshes the data recordset most recently added and if it finds no resulting conflicts, prints "No conflicts" in the Immediate window. If it does find conflicts, it passes each of the shapes that have conflicts to the GetMatchingRowsForRefreshConflict method and prints the resulting row IDs in the same window. Then it passes the shapes that have conflicts to the RemoveRefreshConflict method to remove the conflicts.

Before running this macro, make sure that the most recently added data recordset is a connected (non-XML-based) data recordset and that the connection to the original data source is still available. Then delete a row in the data source or make another change that will cause a conflict when you refresh the data recordset.

VBA Copy code Copy code
Public Sub RemoveRefreshConflicts_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intRecordsetCount As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes() As Visio.Shape

    Dim intRowCount As Integer
    Dim vsoShapeInConflict As Visio.Shape

    Dim alngRowIDs() As Long
    Dim lngvsoRowID As Long

    intRecordsetCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intRecordsetCount)

    vsoDataRecordset.Refresh
    vsoShapes = vsoDataRecordset.GetAllRefreshConflicts

    If IsEmpty(vsoShapes) Then
        Debug.Print "No conflict"
    Else
        For intShapeCount = LBound(vsoShapes) To UBound(vsoShapes)
            Set vsoShapeInConflict = vsoShapes(intShapeCount)
            alngRowIDs = vsoDataRecordset.GetMatchingRowsForRefreshConflict(vsoShapeInConflict)

            If IsEmpty(alngRowIDs) Then
                Debug.Print "For shape:", vsoShapeInConflict.Name, "Row deleted."
            Else
                For intRowCount = LBound(alngRowIDs) To UBound(alngRowIDs)
                    lngvsoRowID = alngRowIDs(intRowCount)
                    Debug.Print "For shape:", vsoShapeInConflict.Name, "Row ID of row in conflict:", lngvsoRowID
                Next intRowCount
            End If

            Call vsoDataRecordset.RemoveRefreshConflict (vsoShapeInConflict)

        Next intShapeCount

    End If

End Sub


DataRecordset.SetPrimaryKey Method (Visio)

 Copy code hover
[image]

DataRecordset.SetPrimaryKey Method (Visio)
Send feedback

Published: July 16, 2012

Sets the primary key setting value and the name of the primary key column or columns for the data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .SetPrimaryKey(PrimaryKeySettings, PrimaryKey())

expression An expression that returns a DataRecordset object.

Parameters

Name | Required/Optional | Data Type | Description
PrimaryKeySettings | Required | VisPrimaryKeySettings | The primary key setting for the data recordset. See Remarks for possible values.
PrimaryKey() | Required | [SAFE-ARRAY] | An array of String variables.

Return Value

Nothing

Remarks

You can use the SetPrimaryKey method to specify the primary key setting and the name of the primary key column or columns for the data recordset. You specify the primary key setting for the data recordset by passing a value from the VisPrimaryKeySettings enumeration for the PrimaryKeySettings parameter. The default (when you don't specify a primary key) is visKeyRowOrder, which means that Visio identifies data recordset rows by row order.

You can specify that the data recordset have either a single-column or a composite primary key. A single-column primary key bases row identification on the values in a single column. A composite primary key uses two or more columns to identify a row uniquely. Possible values for PrimaryKeySettings are shown in this table.

Constant | Value | Description
visKeyRowOrder | 1 | Use row order as the primary key.
visKeySingle | 2 | Use a single column as the primary key column.
visKeyComposite | 3 | Use multiple columns as primary key columns.

For the PrimaryKey() parameter, pass an array of one or more strings that represent the name of the column or columns you want to set as the primary key column(s). The value you pass for the PrimaryKeySettings parameter must be consistent with the number of array items. When you set primary keys, make sure that the column or columns you pick to be primary key columns contain unique values (or value sets) for each row.

You can use the GetPrimaryKey method to determine the current primary key setting for the data recordset as well as the name of the column or columns, if any, that are currently set as the primary key column or columns.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how you can use the SetPrimaryKey method to specify the primary key setting for a data recordset as well as the name of the primary key column. The macro finds the most recently created data recordset associated with the document, specifies the primary key setting (visKeySingle, to indicate a single-column primary key), and sets the name of the primary key column.

Before running this macro, create at least one data recordset in the current document, and replace the variable columnName in the code with the name of the column in the data recordset that you want to specify as the primary key column.

VBA Copy code Copy code
Public Sub SetPrimaryKey_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intCount As Integer
    Dim aPrimaryKeyColumns() As String

    intCount = ThisDocument.DataRecordsets.Count
    aPrimaryKeyColumns(0) = "columnName"
    Set vsoDataRecordset = ThisDocument.DataRecordsets(intCount)
    vsoDataRecordset.SetPrimaryKey visKeySingle, aPrimaryKeyColumns

End Sub


DataRecordset Events (Visio)

 Copy code hover
[image]

DataRecordset Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
DataRecordsetChanged | Occurs when a data recordset changes as a result of being refreshed.


DataRecordset.BeforeDataRecordsetDelete Event (Visio)

 Copy code hover
[image]

DataRecordset.BeforeDataRecordsetDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a DataRecordset object is deleted from the DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _BeforeDataRecordsetDelete(ByVal DataRecordset As IVDATARECORDSET)

expression An expression that returns a DataRecordset object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DataRecordset.DataRecordsetChanged Event (Visio)

 Copy code hover
[image]

DataRecordset.DataRecordsetChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a data recordset changes as a result of being refreshed.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetChanged(ByVal DataRecordsetChanged As IVDATARECORDSETCHANGEDEVENT)

expression An expression that returns a DataRecordset object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetChanged | Required | [IVDATARECORDSETCHANGEDEVENT] | The data recordset that changed.

Remarks

When the DataRecordsetChanged event fires, the DataRecordsetChangedEvent object is passed to the IVisEventProc.VisEventProc method as the pSubjectObj parameter, which represents he subject of the event—the object to which the event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DataRecordsetChangedEvent Object (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent Object (Visio)
Send feedback

Published: July 16, 2012

Passed by Microsoft Visio as the pSubjectObj argument to the VisEventProc method of the IVisEventProc interface when events related to refreshing a data recordset fire.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Remarks

To handle event notifications in Visio, create a class module that implements the IVisEventProc interface in Microsoft Visual Basic for Applications (VBA) or Microsoft Visual Basic, and then create an instance of this class to pass as an argument to the AddAdvise method of the EventList collection.

When data recordset rows are added, changed, or deleted, and when data recordset columns are added or deleted, in each case as a result of a data recordset being refreshed, properties of the DataRecordsetChangedEvent object that is passed to the VisEventProc method return arrays of the affected rows or columns.

All properties of the DataRecordsetChangedEvent object are read-only.


DataRecordsetChangedEvent Members (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent Members (Visio)
Send feedback

Published: July 16, 2012

Passed by Microsoft Visio as the pSubjectObj argument to the VisEventProc method of the IVisEventProc interface when events related to refreshing a data recordset fire.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with a DataRecordsetChangedEvent object. Read-only.
DataColumnsAdded | After data in a data recordset are refreshed, returns an array of names of data columns newly added to the data recordset as a result of the refresh operation. Read-only.
DataColumnsChanged | Returns an array of names of data columns in a data recordset whose types have changed as a result of data in the data recordset being refreshed. Read-only.
DataColumnsDeleted | After data in a data recordset are refreshed, returns an array of names of data columns deleted from the data recordset as a result of the refresh operation. Read-only.
DataRecordset | Returns the DataRecordset object associated with the DataRecordsetChanged event that fires when data in the data recordset are refreshed. Read-only.
DataRowsAdded | Returns an array of IDs of data rows newly added to the data recordset as a result of a data-refresh operation. Read-only.
DataRowsDeleted | Returns an array of IDs of data rows deleted from the data recordset as a result of a data-refresh operation. Read-only.
ObjectType | Returns visObjTypeDataRecordsetChangedEvent, the type of a DataRecordsetChangedEvent object. Read-only.
Stat | Returns status information for an object. Read-only.


DataRecordsetChangedEvent Properties (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with a DataRecordsetChangedEvent object. Read-only.
DataColumnsAdded | After data in a data recordset are refreshed, returns an array of names of data columns newly added to the data recordset as a result of the refresh operation. Read-only.
DataColumnsChanged | Returns an array of names of data columns in a data recordset whose types have changed as a result of data in the data recordset being refreshed. Read-only.
DataColumnsDeleted | After data in a data recordset are refreshed, returns an array of names of data columns deleted from the data recordset as a result of the refresh operation. Read-only.
DataRecordset | Returns the DataRecordset object associated with the DataRecordsetChanged event that fires when data in the data recordset are refreshed. Read-only.
DataRowsAdded | Returns an array of IDs of data rows newly added to the data recordset as a result of a data-refresh operation. Read-only.
DataRowsDeleted | Returns an array of IDs of data rows deleted from the data recordset as a result of a data-refresh operation. Read-only.
ObjectType | Returns visObjTypeDataRecordsetChangedEvent, the type of a DataRecordsetChangedEvent object. Read-only.
Stat | Returns status information for an object. Read-only.


DataRecordsetChangedEvent.Application Property (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio associated with a DataRecordsetChangedEvent object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Application

expression An expression that returns a DataRecordsetChangedEvent object.

Return Value

Application


DataRecordsetChangedEvent.DataColumnsAdded Property (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent.DataColumnsAdded Property (Visio)
Send feedback

Published: July 16, 2012

After data in a data recordset are refreshed, returns an array of names of data columns newly added to the data recordset as a result of the refresh operation. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataColumnsAdded

expression An expression that returns a DataRecordsetChangedEvent object.

Return Value

String()


DataRecordsetChangedEvent.DataColumnsChanged Property (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent.DataColumnsChanged Property (Visio)
Send feedback

Published: July 16, 2012

Returns an array of names of data columns in a data recordset whose types have changed as a result of data in the data recordset being refreshed. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataColumnsChanged

expression An expression that returns a DataRecordsetChangedEvent object.

Return Value

String()


DataRecordsetChangedEvent.DataColumnsDeleted Property (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent.DataColumnsDeleted Property (Visio)
Send feedback

Published: July 16, 2012

After data in a data recordset are refreshed, returns an array of names of data columns deleted from the data recordset as a result of the refresh operation. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataColumnsDeleted

expression An expression that returns a DataRecordsetChangedEvent object.

Return Value

String()

Remarks

The columns returned by this property have already been deleted. As a result, you can no longer use Visio Automation properties or methods to retrieve the DataColumn objects that represented the columns, nor any information about data formerly in these columns.


DataRecordsetChangedEvent.DataRecordset Property (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent.DataRecordset Property (Visio)
Send feedback

Published: July 16, 2012

Returns the DataRecordset object associated with the DataRecordsetChanged event that fires when data in the data recordset are refreshed. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataRecordset

expression An expression that returns a DataRecordsetChangedEvent object.

Return Value

DataRecordset


DataRecordsetChangedEvent.DataRowsAdded Property (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent.DataRowsAdded Property (Visio)
Send feedback

Published: July 16, 2012

Returns an array of IDs of data rows newly added to the data recordset as a result of a data-refresh operation. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataRowsAdded

expression An expression that returns a DataRecordsetChangedEvent object.

Return Value

Long()


DataRecordsetChangedEvent.DataRowsDeleted Property (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent.DataRowsDeleted Property (Visio)
Send feedback

Published: July 16, 2012

Returns an array of IDs of data rows deleted from the data recordset as a result of a data-refresh operation. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataRowsDeleted

expression An expression that returns a DataRecordsetChangedEvent object.

Return Value

Long()

Remarks

The rows returned by this property have already been deleted. As a result, you can no longer retrieve information about data in these rows by calling Visio Automation properties or methods.


DataRecordsetChangedEvent.ObjectType Property (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeDataRecordsetChangedEvent, the type of a DataRecordsetChangedEvent object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ObjectType

expression An expression that returns a DataRecordsetChangedEvent object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


DataRecordsetChangedEvent.Stat Property (Visio)

 Copy code hover
[image]

DataRecordsetChangedEvent.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Stat

expression A variable that represents a DataRecordsetChangedEvent object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


DataRecordsets Object (Visio)

 Copy code hover
[image]

DataRecordsets Object (Visio)
Send feedback

Published: July 16, 2012

The collection of DataRecordset objects associated with a Document object.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Remarks

The default property of the DataRecordsets collection is Item.

Every Visio Document object has a DataRecordsets collection, which is empty until you import data into Visio. To connect a Visio document to a data source, you add a DataRecordset object to the DataRecordsets collection of the document.

To add a DataRecordset object to the DataRecordsets collection, you can use one of the following three methods, depending on the type of data source you want to connect to (OLEDB/ODBC or XML) and how you want to pass connection string and query command strings to Visio. By using the

  • DataRecordsets.Add method, you can connect to an OLEDB or ODBC data source and pass connection and query command string information to Visio directly as method parameters.

  • DataRecordsets.AddFromConnectionFile method, you can connect to an OLEBD or ODBC data source by passing the method an Office Data Connection (ODC) file that contains the connection and query command string information you want to supply to Visio.

  • DataRecordsets.AddFromXML method, you pass the method an ADO classic XML string that contains all the data that you want to include in the data recordset.

Once you have created a data recordset, the connection string and query command string associated with the data recordset are represented by the DataConnection.ConnectionString and DataRecordset.CommandString properties respectively.


DataRecordsets Members (Visio)

 Copy code hover
[image]

DataRecordsets Members (Visio)
Send feedback

Published: July 16, 2012

The collection of DataRecordset objects associated with a Document object.

Events

Name | Description
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
DataRecordsetAdded | Occurs when a DataRecordset object is added to a DataRecordsets collection.
DataRecordsetChanged | Occurs when a data recordset changes as a result of being refreshed.

Methods

Name | Description
Add | Adds a DataRecordset object to the DataRecordsets collection by connecting to and retrieving data from an OLEDB or ODBC data source.
AddFromConnectionFile | Adds a DataRecordset object to the DataRecordsets collection by using the connection and query information contained in an Office Data Connection (ODC) file to connect to and retrieve data from an OLEDB or ODBC data source.
AddFromXML | Adds a DataRecordset object to the DataRecordsets collection, and fills the resulting data recordset with data supplied in the form of an XML string.
GetLastDataError | Gets the Active X Data Objects (ADO) error code, ADO description, and data recordset ID associated with an error that results from adding a new data recordset or refreshing the data in an existing one.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with the DataRecordsets collection. Read-only.
Count | Returns the number of DataRecordset objects in the DataRecordsets collection. Read-only.
Document | Gets the Document object that contains the DataRecordsets collection. Read-only.
EventList | Returns the EventList collection of the DataRecordsets collection. Read-only.
Item | Returns the DataRecordset object at the specified index position in the DataRecordsets collection. Read-only.
ItemFromID | Returns a DataRecordset object from the DataRecordsets collection by using the unique ID of the object. Read-only.
ObjectType | Returns visObjTypeDataRecordsets, the type of a DataRecordsets object. Read-only.
Stat | Returns status information for an object. Read-only.


DataRecordsets Properties (Visio)

 Copy code hover
[image]

DataRecordsets Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with the DataRecordsets collection. Read-only.
Count | Returns the number of DataRecordset objects in the DataRecordsets collection. Read-only.
Document | Gets the Document object that contains the DataRecordsets collection. Read-only.
EventList | Returns the EventList collection of the DataRecordsets collection. Read-only.
Item | Returns the DataRecordset object at the specified index position in the DataRecordsets collection. Read-only.
ItemFromID | Returns a DataRecordset object from the DataRecordsets collection by using the unique ID of the object. Read-only.
ObjectType | Returns visObjTypeDataRecordsets, the type of a DataRecordsets object. Read-only.
Stat | Returns status information for an object. Read-only.


DataRecordsets.Application Property (Visio)

 Copy code hover
[image]

DataRecordsets.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio associated with the DataRecordsets collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Application

expression An expression that returns a DataRecordsets object.

Return Value

Application


DataRecordsets.Count Property (Visio)

 Copy code hover
[image]

DataRecordsets.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of DataRecordset objects in the DataRecordsets collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Count

expression An expression that returns a DataRecordsets object.

Return Value

Long


DataRecordsets.Document Property (Visio)

 Copy code hover
[image]

DataRecordsets.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that contains the DataRecordsets collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Document

expression An expression that returns a DataRecordsets object.

Return Value

Document


DataRecordsets.EventList Property (Visio)

 Copy code hover
[image]

DataRecordsets.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of the DataRecordsets collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .EventList

expression An expression that returns a DataRecordsets object.

Return Value

EventList

Remarks

Once you retrieve the EventList collection, to receive a notification when one of the events in that collection fires, you can pass the ID of the Event object that represents that event to the EventList.AddAdvise method as its EventCode parameter.


DataRecordsets.Item Property (Visio)

 Copy code hover
[image]

DataRecordsets.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns the DataRecordset object at the specified index position in the DataRecordsets collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Item(Index)

expression A variable that represents a DataRecordsets object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index of the object to retrieve.

Return Value

DataRecordset

Remarks

Item is the default property of the DataRecordsets collection.

When you retrieve objects from a collection, you can omit Item from the expression because it is the default property of all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objectReturned = expression(Index)

The DataRecordsets collection is indexed starting with 1.


DataRecordsets.ItemFromID Property (Visio)

 Copy code hover
[image]

DataRecordsets.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns a DataRecordset object from the DataRecordsets collection by using the unique ID of the object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ItemFromID(ID)

expression A variable that represents a DataRecordsets object.

Parameters

Name | Required/Optional | Data Type | Description
ID | Required | Long | The unique ID of the DataRecordset object to retrieve.

Return Value

DataRecordset

Remarks

The ID of a DataRecordset object is never recycled for a particular document. You can get the ID of a DataRecordset object by getting the value of the DataRecordset.ID property.


DataRecordsets.ObjectType Property (Visio)

 Copy code hover
[image]

DataRecordsets.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeDataRecordsets, the type of a DataRecordsets object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ObjectType

expression An expression that returns a DataRecordsets object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


DataRecordsets.Stat Property (Visio)

 Copy code hover
[image]

DataRecordsets.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Stat

expression A variable that represents a DataRecordsets object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


DataRecordsets Methods (Visio)

 Copy code hover
[image]

DataRecordsets Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a DataRecordset object to the DataRecordsets collection by connecting to and retrieving data from an OLEDB or ODBC data source.
AddFromConnectionFile | Adds a DataRecordset object to the DataRecordsets collection by using the connection and query information contained in an Office Data Connection (ODC) file to connect to and retrieve data from an OLEDB or ODBC data source.
AddFromXML | Adds a DataRecordset object to the DataRecordsets collection, and fills the resulting data recordset with data supplied in the form of an XML string.
GetLastDataError | Gets the Active X Data Objects (ADO) error code, ADO description, and data recordset ID associated with an error that results from adding a new data recordset or refreshing the data in an existing one.


DataRecordsets.Add Method (Visio)

 Copy code hover
[image]

DataRecordsets.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a DataRecordset object to the DataRecordsets collection by connecting to and retrieving data from an OLEDB or ODBC data source.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Add(ConnectionIDOrString, CommandString, AddOptions, Name)

expression A variable that represents a DataRecordsets object.

Parameters

Name | Required/Optional | Data Type | Description
ConnectionIDOrString | Required | Variant | The ID of an existing DataConnection object or the connection string to specify a new data-source connection.
CommandString | Required | String | Query string that specifies the database table or Excel worksheet and the fields (columns) within the table or worksheet that contain the data you want to query.
AddOptions | Required | Long | Options that determine properties of the data recordset to add. A combination of one or more enumerated value from VisDataRecordsetAddOptions. For more information, see Remarks.
Name | Optional | String | Assigns a display name to the DataRecordset object being added.

Return Value

DataRecordset

Remarks

You can determine an appropriate connection string to pass to the ConnectionIDOrString parameter by first using the Data Selector Wizard in the Visio user interface (UI) to make the same connection, recording a macro while running the wizard, and then copying the connection string from the macro code.

An easy way to reuse an existing data connection is to pass the DataConnection property value of an existing DataRecordset object for the ConnectionIDOrString parameter. Use the following syntax:

VBA Copy code Copy code
NewDataRecordset = DataRecordsets.Add(ExistingDataRecordset.DataConnection.ID, CommandString, AddOptions, Name)

For the ConnectionIDOrString parameter, if you pass the ID of an existing DataConnection object that is currently being used by one or more other data recordsets, all the data recordsets become a transacted group recordset. All data recordsets in the group are refreshed whenever a data-refresh operation occurs.

The AddOptions parameter can be a combination of one or more of the following values from the VisDataRecordsetAddOptions enumeration, which is declared in the Visio type library. The default is zero (0), which specifies that none of the options be set.

Constant | Value | Description
visDataRecordsetNoExternalDataUI | 1 | Prevents data in the new data recordset from being displayed in the External Data window.
visDataRecordsetNoRefreshUI | 2 | Prevents the data recordset from being displayed in the Refresh Data dialog box.
visDataRecordsetNoAdvConfig | 4 | Prevents the data recordset from being displayed in the Configure Refresh dialog box.
visDataRecordsetDelayQuery | 8 | Adds a data recordset but does not execute the CommandString query until the next time you call the Refresh method.
visDataRecordsetDontCopyLinks | 16 | Adds a data recordset, but shape-data links are not copied to the Clipboard when shapes are copied or cut.

Once you assign these values, you cannot change them for the life of the DataRecordset object.

The Name parameter is an optional string that lets you assign the data recordset a display name. If you specify that the External Data window be displayed in the Visio UI, the name you pass for this argument appears on the tab of the External Data window that corresponds to the data recordset added.

If the Add method succeeds, it performs the following actions:

  • Creates a DataRecordset object and assigns it the name specified in the Name parameter. If you do not specify a name, Visio assigns the data recordset the name of the database table that is the source of the data.

  • Associates a new or existing DataConnection object with the DataRecordsetobject.

  • Opens the External Data window in the Visio UI, unless visDataRecordsetNoExternalDataUI is set.

Unless you pass visDataRecordsetDelayQuery as part of the AddOptions parameter, the Add method also does the following:

  • Executes the query string specified in the CommandString parameter and retreive the resulting data.

  • Maps the data types of the columns of the data source to equivalent Visio data types, while filtering the results to remove data-source columns that cannot be linked to Visio shapes because they have no equivalent Visio data type. In particular, you cannot import binary data or esoteric data types such as UserDefined, Chapter, and IDispatch.

  • Assigns a row ID to each row in the data recordset. For more information about row IDs, see DataRecordset.GetDataRowIDs topic.

Note Note

The Add method fails and returns an exception if it encounters network connection errors, network time outs, or database permission errors. If the visDataRecordsetDelayQuery option is set, under the same circumstances Add may successfully add a new data recordset, but refresh may fail.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how you might use the Add method to connect a Visio drawing to data in ORGDATA.XLS, a Microsoft Office Excel workbook that is installed at C:\Program Files\Microsoft Office\OFFICE12\SAMPLES\1033\ when you install Visio at the default file path.

In this example, there is no existing data connection, so for the first parameter of the Add method, we pass strConnection, the connection string. For the second parameter, we pass strCommand, the command string, which directs Visio to select all columns from the worksheet we specify. For the third parameter of the Add method, we pass zero to specify default behavior of the data recordset, and for the last parameter, we pass "Org Data", the display name we want to assign to the data recordset.

VBA Copy code Copy code
Public Sub AddDataRecordset_Example()

    Dim strConnection As String
    Dim strCommand As String
    Dim strOfficePath As String
    Dim vsoDataRecordset As Visio.DataRecordset

    strOfficePath = Visio.Application.Path
    strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" _
                       & "User ID=Admin;" _
                       & "Data Source=" + strOfficePath + "SAMPLES\1033\ORGDATA.XLS;" _
                       & "Mode=Read;" _
                       & "Extended Properties=""HDR=YES;IMEX=1;MaxScanRows=0;Excel 12.0;"";" _
                       & "Jet OLEDB:Engine Type=34;"

    strCommand = "SELECT * FROM [Sheet1$]"

    Set vsoDataRecordset = ActiveDocument.DataRecordsets.Add(strConnection, strCommand, 0, "Org Data")

End Sub


DataRecordsets.AddFromConnectionFile Method (Visio)

 Copy code hover
[image]

DataRecordsets.AddFromConnectionFile Method (Visio)
Send feedback

Published: July 16, 2012

Adds a DataRecordset object to the DataRecordsets collection by using the connection and query information contained in an Office Data Connection (ODC) file to connect to and retrieve data from an OLEDB or ODBC data source.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .AddFromConnectionFile(FileName, AddOptions, Name)

expression An expression that returns a DataRecordsets object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the ODC connection file to use.
AddOptions | Required | Long | Options that determine properties of the data recordset to be added. A combination of one or more enumerated value from VisDataRecordsetAddOptions. For more information, see Remarks.
Name | Optional | String | Assigns a display name to the DataRecordset object being added.

Return Value

DataRecordset

Remarks

For the FileName parameter, pass the name and full path of an ODC file that contains a connection string that specifies how to connect to an OLEDB or ODBC data source and a query string that specifies how to extract the desired data from the data source.

An ODC file uses HTML and XML to store connection and query information. You can view or edit the contents of the file in any text editor. ODC files have the .odc file name extension. You can use the Data Connection Wizard in Microsoft Access or Microsoft Excel to create an ODC file that will connect to and retrieve the data you want.

The AddOptions parameter can be a combination of one or more of the following values from the VisDataRecordsetAddOptions enumeration, which is declared in the Visio type library. The default is zero (0), which specifies that none of the options be set.

Constant | Value | Description
visDataRecordsetNoExternalDataUI | 1 | Prevents data in the new data recordset from being displayed in the External Data window.
visDataRecordsetNoRefreshUI | 2 | Prevents the data recordset from being included in the refresh operation and displayed in the Refresh Data dialog box.
visDataRecordsetNoAdvConfig | 4 | Prevents the data recordset from being displayed in the Configure Refresh dialog box.
visDataRecordsetDelayQuery | 8 | Adds a data recordset but does not execute the CommandString query until the next time you call the Refresh method.
visDataRecordsetDontCopyLinks | 16 | Adds a data recordset, but shape-data links are not cut or copied.

Once you assign these values, you cannot change them for the life of the DataRecordset object.

The Name argument is an optional string that lets you assign the data recordset a display name. If you specify that the External Data window display in the Visio UI, the name you pass for this argument appears on the tab of the External Data window that corresponds to the data recordset added.

If the AddFromConnectionFile method succeeds, it performs the following actions:

  • Creates a DataRecordset object and assigns it the name specified in the Name parameter. If you do not specify a name, Visio assigns the data recordset the name of the database table that is the source of the data.

  • Associates a new or existing DataConnection object with the DataRecordset object.

  • Executes the query string specified in the command string within the ODC file and retreives the resulting data.

  • Maps the data types of the columns of the data source to equivalent Visio data types, while filtering the results to remove data-source columns that cannot be linked to Visio shapes because they have no equivalent Visio data type.

  • Assigns a row ID to each row in the data recordset. For more information about row IDs, see the DataRecordset.GetDataRowIDs property topic.

Note Note

The AddFromConnectionFile method fails and return an exception if it encounters network connection errors, network time outs, or database permission errors.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how you might use the AddFromConnectionString method to connect a Visio drawing to connect to data in the Products table of the Northwind database that is supplied with Microsoft Access. Before running this sample code, use the Data Connection Wizard to create an ODC file, and replace the value of the strFile variable with the full path to and file name of the ODC file you created. Optionally, supply a different value for the strName variable.

VBA Copy code Copy code
Public Sub AddFromConnectionFile_Example()

    Dim strFile As String
    Dim strName As String
    Dim vsoDataRecordset As Visio.DataRecordset

    strFile = "C:\Users\username\Documents\My Data Sources\Northwind.mdb Products.odc"

    strName = "Data from ODC"

    Set vsoDataRecordset = ThisDocument.DataRecordsets.AddFromConnectionFile(strFile, 0, strName)

End Sub


DataRecordsets.AddFromXML Method (Visio)

 Copy code hover
[image]

DataRecordsets.AddFromXML Method (Visio)
Send feedback

Published: July 16, 2012

Adds a DataRecordset object to the DataRecordsets collection, and fills the resulting data recordset with data supplied in the form of an XML string.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .AddFromXML(XMLString, AddOptions, Name)

expression An expression that returns a DataRecordsets object.

Parameters

Name | Required/Optional | Data Type | Description
XMLString | Required | String | An XML string that conforms to the Microsoft ActiveX® Data Objects (ADO) classic XML schema and that describes the data you want to import.
AddOptions | Required | Long | Options that determine properties of the data recordset to add. A combination of one or more enumerated value from VisDataRecordsetAddOptions. For more information, see Remarks.
Name | Optional | String | Assigns a display name to the DataRecordset object being added.

Return Value

DataRecordset

Remarks

For the XMLString parameter, pass an XML string that conforms to the ADO classic XML schema and that describes the data you want to import. A simple XML string is shown in the example later in this topic.

The AddOptions parameter can be a combination of one or more of the following values from the VisDataRecordsetAddOptions enumeration, which is declared in the Microsoft Visio type library. The default is zero (0), which specifies that none of the options be set.

Constant | Value | Description
visDataRecordsetNoExternalDataUI | 1 | Prevents data in the new data recordset from being displayed in the External Data window.
visDataRecordsetNoAdvConfig | 4 | Prevents the data recordset from being displayed in the Configure Refresh dialog box.
visDataRecordsetDontCopyLinks | 16 | Adds a data recordset, but shape-data links are not cut or copied.

Once you assign these values, you cannot change them for the life of the DataRecordset object.

The Name argument is an optional string that lets you assign the data recordset a display name. If you specify that the External Data window display in the Visio UI, the name you pass for this argument appears on the tab of the External Data window that corresponds to the data recordset added.

In contrast with data recordsets created by using the Add or AddFromConnectionFile methods, data recordsets created by using the AddFromXML method are not associated with a DataConnection object.

What's more, Visio never refreshes a data recordset you created by using the AddFromXML method automatically, regardless of the setting of the DataRecordset.RefreshInterval property. To refresh the data in such a data recordset, you must call the DataRecordset.RefreshUsingXML method.

If the AddFromXML method succeeds, it performs the following actions:

  • Creates an DataRecordset object and assigns it the name you specify in the Name parameter. If you do not specify a name, Visio assigns the data recordset the name of the database table that is the source of the data.

  • Maps the data types of the columns of the data source to equivalent Visio data types, while filtering the results to remove data-source columns that cannot be linked to Visio shapes because they have no equivalent Visio data type.

  • Assigns a Visio data-row ID to each row in the data recordset, unless the imported data already contains valid Visio data-row IDs. For more information about Visio data-row IDs, see the DataRecordset.GetDataRowIDs topic.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how you can use the AddFromXML method to connect a Visio drawing to data contained in an ADO XML string.

A sample XML string is shown here. When it is passed to the AddFromXML method, this string creates a data recordset that contains one column, named "Cities", and two data rows with entries in that column consisting of city names.

VBA Copy code Copy code
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly' rs:updatable='true'>
<s:AttributeType name='c1' rs:name='Cities'
rs:number='2' rs:nullable='true' rs:maydefer='true' rs:write='true'>
<s:datatype dt:type='string' dt:maxLength='255' rs:precision='0'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
<rs:data>
<z:row c1='Seattle' />
<z:row c1='Redmond' />
</rs:data>
</xml>

In the following sample code, we pass the AddFromXML method the name of an XML string containing data and the name of a string containing the display name we want to assign to the new data recordset being created.

VBA Copy code Copy code
Public Sub AddFromXML_Example()

    Dim strXML As String
    Dim strName As String
    Dim vsoDataRecordset As Visio.DataRecordset

    strXML = "<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'" + Chr(10) _
    & "xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'" + Chr(10) _
    & "xmlns:rs='urn:schemas-microsoft-com:rowset'" + Chr(10) _
    & "xmlns:z='#RowsetSchema'>" + Chr(10) _
    & "<s:Schema id='RowsetSchema'>" + Chr(10) _
    & "<s:ElementType name='row' content='eltOnly' rs:updatable='true'>" + Chr(10) _
    & "<s:AttributeType name='c1' rs:name='Cities'" + Chr(10) _
    & "rs:number='2' rs:nullable='true' rs:maydefer='true' rs:write='true'>" + Chr(10) _
    & "<s:datatype dt:type='string' dt:maxLength='255' rs:precision='0'/>" + Chr(10) _
    & "</s:AttributeType>" + Chr(10) _
    & "<s:extends type='rs:rowbase'/>" + Chr(10) _
    & "</s:ElementType>" + Chr(10) _
    & "</s:Schema>" + Chr(10) _
    & "<rs:data>" + Chr(10) _
    & "<z:row c1='Seattle'/>" + Chr(10) _
    & "<z:row c1='Redmond'/>" + Chr(10) _
    & "</rs:data>" + Chr(10) _
    & "</xml>"

    strName = "City Names"

    Set vsoDataRecordset = ThisDocument.DataRecordsets.AddFromXML(strXML, 0, strName)

End Sub


DataRecordsets.GetLastDataError Method (Visio)

 Copy code hover
[image]

DataRecordsets.GetLastDataError Method (Visio)
Send feedback

Published: July 16, 2012

Gets the Active X Data Objects (ADO) error code, ADO description, and data recordset ID associated with an error that results from adding a new data recordset or refreshing the data in an existing one.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetLastDataError(DataErrorCode, DataErrorDescription, RecordsetID)

expression An expression that returns a DataRecordsets object.

Parameters

Name | Required/Optional | Data Type | Description
DataErrorCode | Required | Long | Out parameter. The ADO error code of the last error.
DataErrorDescription | Required | String | Out parameter. The ADO description of the last error.
RecordsetID | Required | Long | Out parameter. The ID of the data recordset that generated or triggered the error.

Return Value

Nothing

Remarks

Data-related operations that can generate ADO errors in Microsoft Visio include adding a new DataRecordset object to the DataRecordsets collection of the active document and refreshing the data in an existing data recordset.

If a data-related operation is successful, the GetLastDataError method returns RecordsetID = 0, DataErrorCode = 0, and DataErrorDescription = "" (an empty string).

If attempting to add a data recordset generates an error, the method returns RecordsetID = 0, as well as the error code and description.

If attempting to refresh the data in an existing data recordset causes an error, and if Visio knows which data recordset caused the error, GetLastDataError returns the ID of the data recordset.

It is possible, however, that Visio may not know specifically which data recordset generated the error. This can only happen when you attempt to refresh a data recordset that is one of a group of data recordsets that share the same connection to a data source. This is because when data in one data recordset in such a group (called transacted datarecordsets) is refreshed, all the data recordsets in the group are refreshed. In this situation, if the refresh operation fails before all datarecordsets in the group are refreshed, Visio rolls back the refresh of any datarecordsets succesfulfully completed up to that point.

If you then call GetLastDataError, the method returns the following:

  • The ID of the data recordset on which you called the Refresh method to start the refresh operation that subsequently failed.

  • The error message generated by the failed refresh operation, although there is no way to know if the failure was specifically related to the data recordset whose ID you passed to the GetLastDataError method.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetLastDataError method to get the ADO error code and description and the data recordset ID associated with the last data error.

VBA Copy code Copy code
Public Sub GetLastDataError_Example()

    Dim vsoDataRecordsets As Visio.DataRecordsets
    Dim lngCode As Long
    Dim strDescription As String
    Dim lngID As Long

    Set vsoDataRecordsets = Visio.ActiveDocument.DataRecordsets

    vsoDataRecordsets.GetLastDataError lngCode, strDescription, lngID

    Debug.Print "Error code: ", lngCode
    Debug.Print "Error description: ", strDescription
    Debug.Print "Data recordset ID: ", lngID

End Sub


DataRecordsets Events (Visio)

 Copy code hover
[image]

DataRecordsets Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
DataRecordsetAdded | Occurs when a DataRecordset object is added to a DataRecordsets collection.
DataRecordsetChanged | Occurs when a data recordset changes as a result of being refreshed.


DataRecordsets.BeforeDataRecordsetDelete Event (Visio)

 Copy code hover
[image]

DataRecordsets.BeforeDataRecordsetDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a DataRecordset object is deleted from the DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _BeforeDataRecordsetDelete(ByVal DataRecordset As IVDATARECORDSET)

expression An expression that returns a DataRecordsets object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DataRecordsets.DataRecordsetAdded Event (Visio)

 Copy code hover
[image]

DataRecordsets.DataRecordsetAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a DataRecordset object is added to a DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetAdded(ByVal DataRecordset As [IVDATARECORDSET])

expression An expression that returns a DataRecordsets object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that was added.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DataRecordsets.DataRecordsetChanged Event (Visio)

 Copy code hover
[image]

DataRecordsets.DataRecordsetChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a data recordset changes as a result of being refreshed.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetChanged(ByVal DataRecordsetChanged As IVDATARECORDSETCHANGEDEVENT)

expression An expression that returns a DataRecordsets object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetChanged | Required | [IVDATARECORDSETCHANGEDEVENT] | The data recordset that changed.

Remarks

When the DataRecordsetChanged event fires, the DataRecordsetChangedEvent object is passed to the IVisEventProc.VisEventProc method as the pSubjectObj parameter, which represents he subject of the event—the object to which the event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document Object (Visio)

 Copy code hover
[image]

Document Object (Visio)
Send feedback

Published: July 16, 2012

Represents a drawing file (.vsd or .vdx), stencil file (.vss or .vsx), or template file (.vst or .vtx) that is open in an instance of Microsoft Visio. A Document object is a member of the Documents collection of an Application object.

Remarks

The default property of a Document object is Name.

Use the Open method of a Documents collection to open an existing document.

Use the Add method of a Documents collection to create a new document.

Use the ActiveDocument property of an Application object to retrieve the active document in an instance.

Use the Pages, Masters, and Styles properties of a Document object to retrieve Page, Master, and Style objects, respectively.

Note Note

Use the CustomMenus or CustomToolbars properties of a Document object to access the custom menus or toolbars.

Note Note

The Microsoft Visual Basic for Applications (VBA) project of every Visio document also has a class module called ThisDocument. When you reference the ThisDocument module from code in a VBA project, it returns a reference to the project's Document object. For example, the code in a document's project can display the name of the project's document in a message box with this statement:

VBA Copy code Copy code
    MsgBox ThisDocument.Name

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this object maps to the following types:

  • Microsoft.Office.Interop.Visio.IVDocument


Document Members (Visio)

 Copy code hover
[image]

Document Members (Visio)
Send feedback

Published: July 16, 2012

Represents a drawing file (.vsd or .vdx), stencil file (.vss or .vsx), or template file (.vst or .vtx) that is open in an instance of Microsoft Visio. A Document object is a member of the Documents collection of an Application object.

Events

Name | Description
AfterDocumentMerge | Occurs when Visio incorporates changes from other users' versions of a document into a merged, co-authored document.
AfterRemoveHiddenInformation | Occurs when hidden information is removed from the document.
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
BeforeDocumentClose | Occurs before a document is closed.
BeforeDocumentSave | Occurs before a document is saved.
BeforeDocumentSaveAs | Occurs just before a document is saved by using the Save As command.
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforePageDelete | Occurs before a page is deleted.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
BeforeStyleDelete | Occurs before a style is deleted.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
DataRecordsetAdded | Occurs when a DataRecordset object is added to a DataRecordsets collection.
DesignModeEntered | Occurs before a document enters design mode.
DocumentChanged | Occurs after certain properties of a document are changed.
DocumentCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.
DocumentCreated | Occurs after a document is created.
DocumentOpened | Occurs after a document is opened.
DocumentSaved | Occurs after a document is saved.
DocumentSavedAs | Occurs after a document is saved by using the Save As command.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
MasterAdded | Occurs after a new master is added to a document.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
PageAdded | Occurs after a new page is added to a document.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelDocumentClose | Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
RuleSetValidated | Occurs when a rule set is validated.
RunModeEntered | Occurs after a document enters run mode.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
StyleAdded | Occurs after a new style is added to a document.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Methods

Name | Description
AddUndoUnit | Adds an object that supports the IOleUndoUnit or IVBUndoUnit interface to the Microsoft Visio undo queue.
BeginUndoScope | Starts a transaction with a unique scope ID for an instance of Microsoft Visio.
CanCheckIn | Specifies whether a document can be checked into a Microsoft SharePoint Server computer.
CanUndoCheckOut | Determines whether a Microsoft Visio document is checked out from a Microsoft SharePoint Server site, so that if it is, the check-out can be subsequently undone.
CheckIn | Returns a document from a local computer to a Microsoft SharePoint Server computer.
Clean | Examines, reports, and repairs selected conditions in a document.
ClearCustomMenus | Restores the built-in Microsoft Visio user interface.
ClearCustomToolbars | Restores the built-in Microsoft Visio user interface.
ClearGestureFormatSheet | Clears local formatting in a document's Gesture Format sheet.
Close | Closes a document.
CopyPreviewPicture | Copies the preview picture from another document into the current document.
DeleteSolutionXMLElement | Deletes the named SolutionXML element.
Drop | Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.
EndUndoScope | Ends or cancels a transaction that has a unique scope.
ExecuteLine | Executes a line of Microsoft Visual Basic code.
ExportAsFixedFormat | Exports a Microsoft Visio document as a file in a fixed format, either PDF or XPS.
FollowHyperlink | Navigates to an arbitrary hyperlink.
GetThemeNames | Returns a locale-specific array of names of themes contained in the document.
GetThemeNamesU | Returns a locale-independent array of names of themes contained in the document.
OpenStencilWindow | Opens a stencil window that shows the masters in the document.
ParseLine | Parses a line of Microsoft Visual Basic code.
Print | Prints the contents of an object to the default printer.
PrintOut | Prints the contents of the active document and provides various printing options.
PurgeUndo | Empties the Microsoft Visio queue of undo actions.
RemoveHiddenInformation | Removes hidden information, such as personal information and external data, from a Microsoft Visio document.
RenameCurrentScope | Renames the top-level open undo scope.
Save | Saves a document.
SaveAs | Saves a document and gives it a file name.
SaveAsEx | Saves a document with a file name using extra information passed in an argument.
SetCustomMenus | Replaces the current built-in or custom menus of an application or document.
SetCustomToolbars | Replaces the current built-in or custom toolbars of an application or document.
UndoCheckOut | Closes a Microsoft Visio document checked out from a Microsoft SharePoint Server site, deletes the local copy of the document, discarding any changes, undoes the checkout, and then reopens the document.

Properties

Name | Description
AlternateNames | Gets or sets the alternate names for a document. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
AutoRecover | Determines whether an open document that has unsaved changes is copied when automatic recovery is enabled. Read/write.
BottomMargin | Specifies the bottom margin when printing the pages in a document. Read/write.
BuildNumberCreated | Returns the build number of the instance used to create the document. Read-only.
BuildNumberEdited | Returns the build number of the instance last used to edit the document. Read-only.
Category | Gets or sets the value of a document's category, one of the document properties. Read/write.
ClassID | Returns the class ID string of the container application in which the document is embedded. Read-only.
Colors | Returns the Colors collection of a Document object. Read-only.
Comments | Returns a Comments object that represents the collection of all the reviewer comments in the document. Read-only.
Company | Gets or sets the name of the company the document belongs to, one of the document's properties. Read/write.
CompatibilityMode | Returns a Boolean that indicates whether the specified document is in compatibility mode. Read-only.
Container | Returns an IDispatch interface on the ActiveX container in which the document is contained or Nothing if the document is not in a container. Read-only.
ContainsWorkspaceEx | Gets or sets whether workspace information is saved with the document. Read/write.
Creator | Gets or sets the value of a document's author—one of the document's properties. Read/write.
CustomMenus | Gets a UIObject object that represents the current custom menus and accelerators of a Document object. Read-only.
CustomMenusFile | Gets or sets the name of the file that defines custom menus and accelerators for a Document object. Read/write.
CustomToolbars | Gets a UIObject object that represents the current custom toolbars and status bars of a Document object. Read-only.
CustomToolbarsFile | Returns or sets the name of the file that defines custom toolbars and status bars for a Document object. Read/write.
CustomUI | Gets or sets the Ribbon XML string that is passed to the document to customize the Microsoft Office Fluent user interface. Read/write.
DataRecordsets | Returns the DataRecordsets collection contained in the document. Read-only.
DefaultFillStyle | Gets or sets the default fill style of a document. Read/write.
DefaultGuideStyle | Gets or sets the default guide style of a document. Read/write.
DefaultLineStyle | Gets or sets the default line style of a document. Read/write.
DefaultSavePath | Gets or sets the path to the location where Microsoft Visio saves the current document by default. Read/write.
DefaultStyle | Gets the default fill style of a document or sets the default fill, line, and text styles of a document. Read/write.
DefaultTextStyle | Gets or sets the default text style of a document. Read/write.
Description | Gets or sets the description of a document, one of a document's properties. Read/write.
DiagramServicesEnabled | Determines which, if any, diagram services are enabled for the document. Read/write.
DocumentSheet | Returns a Shape object whose cells represent properties of the document. Read-only.
DynamicGridEnabled | Determines whether the dynamic grid is enabled. Read/write.
EditorCount | Returns a Long that represents the number of editors of a co-authored document. Read-only.
EmailRoutingData | Returns e-mail routing data for a document. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Fonts | Returns the Fonts collection of a Document object. Read-only.
FooterCenter | Gets or sets the text string that appears in the center portion of a document's footer. Read/write.
FooterLeft | Gets or sets the text string that appears on the left side of a document's footer. Read/write.
FooterMargin | Gets or sets the margin of a document's footer. Read/write.
FooterRight | Gets or sets the text string that appears in the right portion of a document's footer. Read/write.
FullBuildNumberCreated | Returns the full build number of the instance used to create the document. Read-only.
FullBuildNumberEdited | Returns the full build number of the instance last used to edit the document. Read-only.
FullName | Returns the name of a document, including the drive and path. Read-only.
GestureFormatSheet | Returns a reference to a document's Gesture Format sheet, which contains the line, fill, and text formatting that is applied to shapes drawn on the page. Read-only.
GlueEnabled | Determines whether glue is enabled in the document. Read/write.
GlueSettings | Determines the objects that shapes glue to when glue is enabled in the document. Read/write.
HeaderCenter | Contains the text string that appears in the center portion of a document's header. Read/write.
HeaderFooterColor | Specifies the color of the header and footer text. Read/write.
HeaderFooterFont | Specifies the font used for the header and footer text. Read/write.
HeaderLeft | Gets or sets the text string that appears in the left portion of a document's header. Read/write.
HeaderMargin | Gets or sets the margin of a document's header. Read/write.
HeaderRight | Gets or sets the text string that appears in the right portion of a document's header. Read/write.
HyperlinkBase | Gets or sets the value of the Hyperlink base box in a document's Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties). Read/write.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a Document object in the Documents collection. Read-only.
InPlace | Specifies whether a document is open in place, or whether a document is being viewed through a window that is open in place. Read-only.
Keywords | Gets or sets the value of the Keywords box in a document's Properties dialog box. Read/write.
Language | Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.
LeftMargin | Specifies the left margin, which is used when printing. Read/write.
MacrosEnabled | Specifies whether you can execute macros and process events in a document's Microsoft Visual Basic for Applications (VBA) project. Read-only.
Manager | Gets or sets the value of the Manager box in a document's Properties dialog box. Read/write.
Masters | Returns the Masters collection for a document's stencil. Read-only.
MasterShortcuts | Returns the MasterShortcuts collection for a document stencil. Read-only.
Mode | Determines whether a document is in run mode or design mode. Read/write.
Name | Specifies the name of an object. Read-only.
ObjectType | Returns an object's type. Read-only.
OLEObjects | Returns the OLEObjects collection of a document. Read-only.
Pages | Returns the Pages collection for a document. Read-only.
PaperHeight | Returns the height of a document's printed page. Read-only.
PaperSize | Gets or sets the paper size of a document. Read/write.
PaperWidth | Returns the width of a document's printed page. Read-only.
Path | Returns the drive and folder path of the Microsoft Visio document. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
PreviewPicture | Gets or sets the preview picture shown in the Open dialog box and when you click the File tab, and then click New. Read/write.
PrintCenteredH | Indicates whether drawings are centered between the left and right edges of the paper when printed. Read/write.
PrintCenteredV | Indicates whether drawings are centered between the top and bottom edges of the paper when printed. Read/write.
Printer | Specifies the name of the printer to use when printing the document. Read/write.
PrintFitOnPages | Indicates whether drawings in a document are printed on a specified number of sheets across and down. Read/write.
PrintLandscape | Indicates whether a document's drawings are printed in landscape or portrait orientation. Read/write.
PrintPagesAcross | Indicates the number of sheets of paper on which a drawing is printed horizontally. Read/write.
PrintPagesDown | Gets or sets the number of sheets of paper on which a drawing is printed vertically. Read/write.
PrintScale | Gets or sets how much drawings are reduced or enlarged when printed. Read/write.
ProgID | Returns the programmatic identifier of a shape that represents an ActiveX control, an embedded object, or linked object. Read-only.
Protection | Determines how a document is protected from user customization. Read/write.
ReadOnly | Indicates whether a file is open as read-only. Read-only.
RemovePersonalInformation | Determines if personal information about a file is saved when the user saves the file in Microsoft Visio. Read/write.
RightMargin | Specifies the right margin, which is used when printing. Read/write.
Saved | Indicates whether a document has any unsaved changes. Read/write.
SavePreviewMode | Determines whether and how a preview picture is saved in a file. Read/write.
ServerPublishOptions | Returns a ServerPublishOptions object that you can use to specify the settings to apply when you save a document as a Web drawing (as a .vdw file), then publish and use it on a Microsoft SharePoint site in conjunction with Visio Services. Read-only.
SharedWorkspace | Returns a Microsoft Office SharedWorkspace object that provides access to the Office Document Workspace object model. Read-only.
SnapAngles | Determines the degree of the angle that is drawn when isometric angle lines is chosen as a shape extension option. Read/write.
SnapEnabled | Determines whether snap is active in the document. Read/write.
SnapExtensions | Determines the shape extensions that are active in a document. Read/write.
SnapSettings | Determines the objects that shapes snap to when snap is active in the document. Read/write.
SolutionXMLElement | Contains solution-specific, well-formed XML data stored with a document. Read/write.
SolutionXMLElementCount | Returns the number of SolutionXML elements in a document. Read-only.
SolutionXMLElementExists | Indicates whether a named SolutionXML element exists in the document. Read-only.
SolutionXMLElementName | Returns the name of the SolutionXML element. Read-only.
Stat | Returns status information for an object. Read-only.
Styles | Returns the Styles collection for a document. Read-only.
Subject | Gets or sets the value of the Subject field in a document's properties. Read/write.
Sync | Returns a Microsoft Office Sync object that provides information about the status of the active document in a shared workspace and the ability to perform a set of actions. Read-only.
Template | Returns the name of the template from which the document was created. Read-only.
Time | Returns the most recently recorded date and time. Read-only.
TimeCreated | Returns the date and time the document was created. Read-only.
TimeEdited | Returns the date and time the document was last edited. Read-only.
TimePrinted | Returns the date and time the document was last printed. Read-only.
TimeSaved | Returns the date and time the document was last saved. Read-only.
Title | Gets or sets the value of the Title field in a document's properties. Read/write.
TopMargin | Specifies the top margin when printing a document. Read/write.
Type | Returns the type of the Document object. Read-only.
UndoEnabled | Determines whether undo information is maintained in memory. Read/write.
UserCustomUI | Gets or sets the Ribbon XML string that is passed to the document to customize the Quick Access toolbar or the Ribbon. Read/write.
Validation | Returns the Validation object that is associated with the document. Read-only.
VBProject | Returns an automation object that you can use to control the Microsoft Visual Basic for Applications (VBA) project of the document. Read-only.
VBProjectData | Returns the Microsoft Visual Basic project data stored with a document. Read-only.
Version | Gets the version of a saved document or sets the version in which to save a document. Read/write.
ZoomBehavior | Determines the zoom behavior for a Microsoft Visio document or window. Read/write.


Document Properties (Visio)

 Copy code hover
[image]

Document Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlternateNames | Gets or sets the alternate names for a document. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
AutoRecover | Determines whether an open document that has unsaved changes is copied when automatic recovery is enabled. Read/write.
BottomMargin | Specifies the bottom margin when printing the pages in a document. Read/write.
BuildNumberCreated | Returns the build number of the instance used to create the document. Read-only.
BuildNumberEdited | Returns the build number of the instance last used to edit the document. Read-only.
Category | Gets or sets the value of a document's category, one of the document properties. Read/write.
ClassID | Returns the class ID string of the container application in which the document is embedded. Read-only.
Colors | Returns the Colors collection of a Document object. Read-only.
Comments | Returns a Comments object that represents the collection of all the reviewer comments in the document. Read-only.
Company | Gets or sets the name of the company the document belongs to, one of the document's properties. Read/write.
CompatibilityMode | Returns a Boolean that indicates whether the specified document is in compatibility mode. Read-only.
Container | Returns an IDispatch interface on the ActiveX container in which the document is contained or Nothing if the document is not in a container. Read-only.
ContainsWorkspaceEx | Gets or sets whether workspace information is saved with the document. Read/write.
Creator | Gets or sets the value of a document's author—one of the document's properties. Read/write.
CustomMenus | Gets a UIObject object that represents the current custom menus and accelerators of a Document object. Read-only.
CustomMenusFile | Gets or sets the name of the file that defines custom menus and accelerators for a Document object. Read/write.
CustomToolbars | Gets a UIObject object that represents the current custom toolbars and status bars of a Document object. Read-only.
CustomToolbarsFile | Returns or sets the name of the file that defines custom toolbars and status bars for a Document object. Read/write.
CustomUI | Gets or sets the Ribbon XML string that is passed to the document to customize the Microsoft Office Fluent user interface. Read/write.
DataRecordsets | Returns the DataRecordsets collection contained in the document. Read-only.
DefaultFillStyle | Gets or sets the default fill style of a document. Read/write.
DefaultGuideStyle | Gets or sets the default guide style of a document. Read/write.
DefaultLineStyle | Gets or sets the default line style of a document. Read/write.
DefaultSavePath | Gets or sets the path to the location where Microsoft Visio saves the current document by default. Read/write.
DefaultStyle | Gets the default fill style of a document or sets the default fill, line, and text styles of a document. Read/write.
DefaultTextStyle | Gets or sets the default text style of a document. Read/write.
Description | Gets or sets the description of a document, one of a document's properties. Read/write.
DiagramServicesEnabled | Determines which, if any, diagram services are enabled for the document. Read/write.
DocumentSheet | Returns a Shape object whose cells represent properties of the document. Read-only.
DynamicGridEnabled | Determines whether the dynamic grid is enabled. Read/write.
EditorCount | Returns a Long that represents the number of editors of a co-authored document. Read-only.
EmailRoutingData | Returns e-mail routing data for a document. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Fonts | Returns the Fonts collection of a Document object. Read-only.
FooterCenter | Gets or sets the text string that appears in the center portion of a document's footer. Read/write.
FooterLeft | Gets or sets the text string that appears on the left side of a document's footer. Read/write.
FooterMargin | Gets or sets the margin of a document's footer. Read/write.
FooterRight | Gets or sets the text string that appears in the right portion of a document's footer. Read/write.
FullBuildNumberCreated | Returns the full build number of the instance used to create the document. Read-only.
FullBuildNumberEdited | Returns the full build number of the instance last used to edit the document. Read-only.
FullName | Returns the name of a document, including the drive and path. Read-only.
GestureFormatSheet | Returns a reference to a document's Gesture Format sheet, which contains the line, fill, and text formatting that is applied to shapes drawn on the page. Read-only.
GlueEnabled | Determines whether glue is enabled in the document. Read/write.
GlueSettings | Determines the objects that shapes glue to when glue is enabled in the document. Read/write.
HeaderCenter | Contains the text string that appears in the center portion of a document's header. Read/write.
HeaderFooterColor | Specifies the color of the header and footer text. Read/write.
HeaderFooterFont | Specifies the font used for the header and footer text. Read/write.
HeaderLeft | Gets or sets the text string that appears in the left portion of a document's header. Read/write.
HeaderMargin | Gets or sets the margin of a document's header. Read/write.
HeaderRight | Gets or sets the text string that appears in the right portion of a document's header. Read/write.
HyperlinkBase | Gets or sets the value of the Hyperlink base box in a document's Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties). Read/write.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a Document object in the Documents collection. Read-only.
InPlace | Specifies whether a document is open in place, or whether a document is being viewed through a window that is open in place. Read-only.
Keywords | Gets or sets the value of the Keywords box in a document's Properties dialog box. Read/write.
Language | Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.
LeftMargin | Specifies the left margin, which is used when printing. Read/write.
MacrosEnabled | Specifies whether you can execute macros and process events in a document's Microsoft Visual Basic for Applications (VBA) project. Read-only.
Manager | Gets or sets the value of the Manager box in a document's Properties dialog box. Read/write.
Masters | Returns the Masters collection for a document's stencil. Read-only.
MasterShortcuts | Returns the MasterShortcuts collection for a document stencil. Read-only.
Mode | Determines whether a document is in run mode or design mode. Read/write.
Name | Specifies the name of an object. Read-only.
ObjectType | Returns an object's type. Read-only.
OLEObjects | Returns the OLEObjects collection of a document. Read-only.
Pages | Returns the Pages collection for a document. Read-only.
PaperHeight | Returns the height of a document's printed page. Read-only.
PaperSize | Gets or sets the paper size of a document. Read/write.
PaperWidth | Returns the width of a document's printed page. Read-only.
Path | Returns the drive and folder path of the Microsoft Visio document. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
PreviewPicture | Gets or sets the preview picture shown in the Open dialog box and when you click the File tab, and then click New. Read/write.
PrintCenteredH | Indicates whether drawings are centered between the left and right edges of the paper when printed. Read/write.
PrintCenteredV | Indicates whether drawings are centered between the top and bottom edges of the paper when printed. Read/write.
Printer | Specifies the name of the printer to use when printing the document. Read/write.
PrintFitOnPages | Indicates whether drawings in a document are printed on a specified number of sheets across and down. Read/write.
PrintLandscape | Indicates whether a document's drawings are printed in landscape or portrait orientation. Read/write.
PrintPagesAcross | Indicates the number of sheets of paper on which a drawing is printed horizontally. Read/write.
PrintPagesDown | Gets or sets the number of sheets of paper on which a drawing is printed vertically. Read/write.
PrintScale | Gets or sets how much drawings are reduced or enlarged when printed. Read/write.
ProgID | Returns the programmatic identifier of a shape that represents an ActiveX control, an embedded object, or linked object. Read-only.
Protection | Determines how a document is protected from user customization. Read/write.
ReadOnly | Indicates whether a file is open as read-only. Read-only.
RemovePersonalInformation | Determines if personal information about a file is saved when the user saves the file in Microsoft Visio. Read/write.
RightMargin | Specifies the right margin, which is used when printing. Read/write.
Saved | Indicates whether a document has any unsaved changes. Read/write.
SavePreviewMode | Determines whether and how a preview picture is saved in a file. Read/write.
ServerPublishOptions | Returns a ServerPublishOptions object that you can use to specify the settings to apply when you save a document as a Web drawing (as a .vdw file), then publish and use it on a Microsoft SharePoint site in conjunction with Visio Services. Read-only.
SharedWorkspace | Returns a Microsoft Office SharedWorkspace object that provides access to the Office Document Workspace object model. Read-only.
SnapAngles | Determines the degree of the angle that is drawn when isometric angle lines is chosen as a shape extension option. Read/write.
SnapEnabled | Determines whether snap is active in the document. Read/write.
SnapExtensions | Determines the shape extensions that are active in a document. Read/write.
SnapSettings | Determines the objects that shapes snap to when snap is active in the document. Read/write.
SolutionXMLElement | Contains solution-specific, well-formed XML data stored with a document. Read/write.
SolutionXMLElementCount | Returns the number of SolutionXML elements in a document. Read-only.
SolutionXMLElementExists | Indicates whether a named SolutionXML element exists in the document. Read-only.
SolutionXMLElementName | Returns the name of the SolutionXML element. Read-only.
Stat | Returns status information for an object. Read-only.
Styles | Returns the Styles collection for a document. Read-only.
Subject | Gets or sets the value of the Subject field in a document's properties. Read/write.
Sync | Returns a Microsoft Office Sync object that provides information about the status of the active document in a shared workspace and the ability to perform a set of actions. Read-only.
Template | Returns the name of the template from which the document was created. Read-only.
Time | Returns the most recently recorded date and time. Read-only.
TimeCreated | Returns the date and time the document was created. Read-only.
TimeEdited | Returns the date and time the document was last edited. Read-only.
TimePrinted | Returns the date and time the document was last printed. Read-only.
TimeSaved | Returns the date and time the document was last saved. Read-only.
Title | Gets or sets the value of the Title field in a document's properties. Read/write.
TopMargin | Specifies the top margin when printing a document. Read/write.
Type | Returns the type of the Document object. Read-only.
UndoEnabled | Determines whether undo information is maintained in memory. Read/write.
UserCustomUI | Gets or sets the Ribbon XML string that is passed to the document to customize the Quick Access toolbar or the Ribbon. Read/write.
Validation | Returns the Validation object that is associated with the document. Read-only.
VBProject | Returns an automation object that you can use to control the Microsoft Visual Basic for Applications (VBA) project of the document. Read-only.
VBProjectData | Returns the Microsoft Visual Basic project data stored with a document. Read-only.
Version | Gets the version of a saved document or sets the version in which to save a document. Read/write.
ZoomBehavior | Determines the zoom behavior for a Microsoft Visio document or window. Read/write.


Document.AlternateNames Property (Visio)

 Copy code hover
[image]

Document.AlternateNames Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the alternate names for a document. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .AlternateNames

expression A variable that represents a Document object.

Return Value

String

Remarks

The application stores document names in the following situations:

  • Templates store stencil names. For example, the Basic Flowchart template stores the names of the Basic Flowchart Shapes.vss and Backgrounds.vss stencils. These stencils are opened with the Basic Flowchart template.

  • Master shortcuts store stencil names. For example, a shortcut for the Data shape stores the name of the stencil on which the Data shape is stored—Basic Flowchart Shapes.vss.

When the application opens a document or accesses the Document object's collection, it uses the document name. If Microsoft Visio can't find the document name, it looks for alternate names for those stencils that are in the correct path. (To add a path, click the File tab, click Options, click Advanced, and then, under General, click File Locations.) For example, suppose you created the stencil named "New Shapes 2008.vss." The following year you revised the stencil and renamed it "New Shapes 2009.vss." Any templates that opened New Shapes 2008.vss should now open New Shapes 2009.vss. To do this, set the AlternateNames property of New Shapes 2009.vss to "New Shapes 2008.vss." The following Microsoft Visual Basic code shows one way to do this:

VBA Copy code Copy code
Visio.Documents("New Shapes 2009.vss").AlternateNames = "New Shapes 2008.vss"

The AlternateNames property is empty until you set it by using Automation. Each of the alternate names in the string should contain the file name, but no folder information. You can also include comments in angle brackets (<>), because the application ignores anything in angle brackets. For example, you could use the following code to set the AlternateNames property:

VBA Copy code Copy code
Visio.Documents("HRShapes.vss").AlternateNames = "Human Resources Shapes.vss; <old name> HRDept Shapes.vss"

Example

The following macro shows how to get and set the AlternateNames property of the current document. It demonstrates that the property is empty until you set it.

VBA Copy code Copy code

Public Sub AlternateNames_Example()

    'Get the AlternateNames property of the document.
    Debug.Print "Alternate name is: "; ThisDocument.AlternateNames

    'Set the AlternateNames property of the document.
    ThisDocument.AlternateNames = "Test Shapes.vss"
    Debug.Print "Alternate name is: "; ThisDocument.AlternateNames

End Sub


Document.Application Property (Visio)

 Copy code hover
[image]

Document.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Document object.

Return Value

Application

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVDocument.Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

    Dim vsoApplication As Visio.Application
    Dim vsoDocument As Visio.Document

    Set vsoDocument = ActiveDocument

    'Get the instance of Visio associated with the Document object.
    Set vsoApplication = vsoDocument.Application
    Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Document.AutoRecover Property (Visio)

 Copy code hover
[image]

Document.AutoRecover Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an open document that has unsaved changes is copied when automatic recovery is enabled. Read/write.

Version Information

Version Added: Visio 2000 SR-1

Syntax

expression .AutoRecover

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

If automatic recovery is enabled (if the Application.AutoRecoverInterval property is greater than 0), all documents that are open and have unsaved changes are copied into temporary files. If you do not want a document to be recovered, set its AutoRecover property to False. The AutoRecover property is not saved with a document and must be set each time the document opens.

When Microsoft Visio is launched after an abnormal termination and determines that automatic recovery was enabled, it attempts to open all files that were open at termination.

  • If there is a recovery file that is more recent than the last saved copy of the file, Visio opens the recovered file and displays the name "<file name> (Recovered)" in the document's title bar.

  • If there is no recovery file, Visio opens the last saved copy of the document.

You must still save changes to recovered documents before Visio closes. If you do not save recovered documents, changes are discarded, as in any unsaved document.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the AutoRecover property to disable automatic recovery for a particular document.

VBA Copy code Copy code

Private Sub Document_DocumentOpened(ByValdoc As IVDocument)

    'Do not recover this document
    ThisDocument.AutoRecover = False

End Sub


Document.BottomMargin Property (Visio)

 Copy code hover
[image]

Document.BottomMargin Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the bottom margin when printing the pages in a document. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .BottomMargin(UnitsNameOrCode)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Optional | Variant | he units to use when retrieving or setting the margin value. Defaults to internal drawing units.

Return Value

Double

Remarks

The value of this property corresponds to the value entered in the Bottom box in the Print Setup dialog box (on the Design tab, click the Page Setup arrow, and then click Setup on the Print Setup tab).

You can specify UnitsNameOrCode as an integer or a string value. If the string is invalid, an error is generated. For example, the following statements all set UnitsNameOrCode to inches.

ActiveDocument.BottomMargin(visInches) = newValue

ActiveDocument.BottomMargin (65) = newValue

ActiveDocument.BottomMargin ("in") = newValue where "in" can also be any of the alternate strings representing inches, such as "inch", "in.", or "i".

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Automation constants for representing units are declared by the Microsoft Visio type library in member VisUnitCodes.


Document.BuildNumberCreated Property (Visio)

 Copy code hover
[image]

Document.BuildNumberCreated Property (Visio)
Send feedback

Published: July 16, 2012

Returns the build number of the instance used to create the document. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .BuildNumberCreated

expression A variable that represents a Document object.

Return Value

Long

Remarks

The format of the build number is described in the following table.

Bits | Description
0 - 15 | Internal build number


Document.BuildNumberEdited Property (Visio)

 Copy code hover
[image]

Document.BuildNumberEdited Property (Visio)
Send feedback

Published: July 16, 2012

Returns the build number of the instance last used to edit the document. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .BuildNumberEdited

expression A variable that represents a Document object.

Return Value

Long

Remarks

The format of the build number is described in the following table.

Bits | Description
0 - 15 | Internal build number


Document.Category Property (Visio)

 Copy code hover
[image]

Document.Category Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the value of a document's category, one of the document properties. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .Category

expression A variable that represents a Document object.

Return Value

String

Remarks

Setting the Category property is equivalent to entering information in the Categories box in the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties).

Security note Security Note
Use this feature with caution. Sensitive or confidential information could be revealed to other users.

Example

This Microsoft Visual Basic macro shows how to use the Category property to categorize a drawing. It adds a Document object to the Documents collection and sets the Document object's Category property as well as other properties.

Before running this macro, substitute your own values for the items in italic in the following code. To verify that these properties have been set, open the Properties dialog box.

VBA Copy code Copy code

Public Sub Category_Example()

    Dim vsoDocument As Visio.Document

    Set vsoDocument = Documents.Add("")

    'Set the properties of the document.
    vsoDocument.Title = "document title"
    vsoDocument.Creator = "author name"
    vsoDocument.Description = "document description"
    vsoDocument.Keywords = "keyword1, keyword2, keyword3"
    vsoDocument.Subject = "document subject"
    vsoDocument.Manager = "manager name"
    vsoDocument.Category = "document category"

End Sub


Document.ClassID Property (Visio)

 Copy code hover
[image]

Document.ClassID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the class ID string of the container application in which the document is embedded. Read-only.

Version Information

Version Added: Visio 4.5

Syntax

expression .ClassID

expression A variable that represents a Document object.

Return Value

String

Remarks

If the class ID of the container application in which the document is embedded cannot be retrieved, the ClassID property raises an exception. If the document is not embedded in a container, the ClassID property returns an empty string.

ClassID returns a string of the form:

VBA Copy code Copy code
    {2287DC42-B167-11CE-88E9-002AFDDD917}

This string identifies the application that contains the document. It might, for example, identify the document's container as a Microsoft Excel object.


Document.Colors Property (Visio)

 Copy code hover
[image]

Document.Colors Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Colors collection of a Document object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Colors

expression A variable that represents a Document object.

Return Value

Colors


Document.Comments Property (Visio)

 Copy code hover
[image]

Document.Comments Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns a Comments object that represents the collection of all the reviewer comments in the document. Read-only.

Syntax

expression .Comments

expression A variable that represents a Document object.

Property value

IVCOMMENTS

See also

Concepts

Document Object

Other resources

Document Members


Document.Company Property (Visio)

 Copy code hover
[image]

Document.Company Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of the company the document belongs to, one of the document's properties. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .Company

expression A variable that represents a Document object.

Return Value

String

Remarks

Setting the Company property is equivalent to entering information in the Company box in the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties).

Security note Security Note
Use this feature with caution. Sensitive or confidential information could be revealed to other users.

Example

This Microsoft Visual Basic macro shows how to use the Company property to document the company for which the drawing is made. It adds a Document object to the Documents collection and sets the Document object's Company property as well as other properties.

Before running this macro, substitute your own values for the items in italic in the following code. To verify that these properties have been set, open the Properties dialog box.

VBA Copy code Copy code

Public Sub Company_Example()

    Dim vsoDocument As Visio.Document

    Set vsoDocument = Documents.Add("")

    'Set the properties of the document.
    vsoDocument.Title = "document title"
    vsoDocument.Creator = "author name"
    vsoDocument.Description = "document description"
    vsoDocument.Keywords = "keyword1, keyword2, keyword3"
    vsoDocument.Subject = "document subject"
    vsoDocument.Manager = "manager name"
    vsoDocument.Company = "company name"

End Sub


Document.CompatibilityMode Property (Visio)

 Copy code hover
[image]

Document.CompatibilityMode Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that indicates whether the specified document is in compatibility mode. Read-only.

Syntax

expression .CompatibilityMode

expression A variable that represents a Document object.

Property value

BOOL

See also

Concepts

Document Object

Other resources

Document Members


Document.Container Property (Visio)

 Copy code hover
[image]

Document.Container Property (Visio)
Send feedback

Published: July 16, 2012

Returns an IDispatch interface on the ActiveX container in which the document is contained or Nothing if the document is not in a container. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .Container

expression A variable that represents a Document object.

Return Value

Object

Remarks

The interface returned is the result of querying the IOleContainer interface provided by the containing object for IDispatch.


Document.ContainsWorkspaceEx Property (Visio)

 Copy code hover
[image]

Document.ContainsWorkspaceEx Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets whether workspace information is saved with the document. Read/write.

Version Information

Version Added: Visio 2007

Syntax

expression .ContainsWorkspaceEx

expression An expression that returns a Document object.

Return Value

Boolean

Remarks

The ContainsWorkspaceEx property setting corresponds to the setting of the Save workspace check box on the Summary tab of the Document Properties dialog box in the Microsoft Visio user interface.

The ContainsWorkspaceEx property replaces the read-only ContainsWorkspace property that existed in previous versions of Visio. Note that although the ContainsWorkspace property is now deprecated, it still returns a value.

Note also that in previous versions of Visio, to save a document along with workspace information, you used the Document.SaveAs method, passing it the visSaveAsWS constant.

Starting with Visio 2007, by default, workspace information is saved with all documents except stencils. To specify that workspace information not be saved with a document, set ContainsWorkspaceEx to False.


Document.Creator Property (Visio)

 Copy code hover
[image]

Document.Creator Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the value of a document's author—one of the document's properties. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Creator

expression A variable that represents a Document object.

Return Value

String

Remarks

Setting the Creator property is equivalent to entering information in the Author box in the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties).

Security note Security Note
Use this feature with caution. Sensitive or confidential information could be revealed to other users.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Creator property to document the author of a drawing. It adds a Document object to the Documents collection and sets the Document object's Creator property as well as other document properties.

Before running this macro, substitute your own values for the items in italic in the following code. To verify that these properties have been set, open the Properties dialog box.

VBA Copy code Copy code

Public Sub Creator_Example()

    Dim vsoDocument As Visio.Document

    Set vsoDocument = Documents.Add("")

    'Set the properties of the document.
    vsoDocument.Title = "document title"
    vsoDocument.Creator = "author name"
    vsoDocument.Description = "document description"
    vsoDocument.Keywords = "keyword1, keyword2, keyword3"
    vsoDocument.Subject = "document subject"
    vsoDocument.Manager = "manager name"
    vsoDocument.Category = "document category"

End Sub


Document.CustomMenus Property (Visio)

 Copy code hover
[image]

Document.CustomMenus Property (Visio)
Send feedback

Published: July 16, 2012

Gets a UIObject object that represents the current custom menus and accelerators of a Document object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomMenus

expression A variable that represents a Document object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If Microsoft Visio menus and accelerators have not been customized, either programmatically, by a Visio solution, or in the user interface, the CustomMenus property returns Nothing.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the currently active user interface (UI) for your document without replacing the application-level custom UI. You must write additional code to add your custom UI items.

VBA Copy code Copy code

Sub CustomMenus_Example()

 Dim vsoUIObject As Visio.UIObject

 'Check whether there are custom menus bound to the document.
 If ThisDocument.CustomMenus Is Nothing Then

 'If not, check whether there are custom menus bound to the application.
 If Visio.Application.CustomMenus Is Nothing Then

 'If not, use the Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus
 MsgBox "Using Built-In Menus", 0

 Else

 'If there are existing Visio application-level custom menus, use them.
 Set vsoUIObject = Visio.Application.CustomMenus
 MsgBox "Using Custom Menus", 0

 End If

 Else

 'Use the existing custom menus.
 Set vsoUIObject = ThisDocument.CustomMenus
 MsgBox "Using Custom Menus", 0

 End If

End Sub


Document.CustomMenusFile Property (Visio)

 Copy code hover
[image]

Document.CustomMenusFile Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of the file that defines custom menus and accelerators for a Document object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomMenusFile

expression A variable that represents a Document object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the object is not using custom menus, the CustomMenusFile property returns Nothing.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the currently active UI for your document without replacing the application-level custom UI. It also saves any existing custom menus to a file and specifies that the current document use those menus. You must write additional code to add your custom UI items.

Note Note

This macro uses the VBA keyword Kill to delete a file on disk. Use this keyword carefully, because you cannot undo a Kill command once it has been run, and you will not get a prior warning message.

VBA Copy code Copy code

Sub CustomMenusFile_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim strPath As String

 'Check whether there are custom menus bound to the document.
 If ThisDocument.CustomMenus Is Nothing Then

 'If not, check whether there are custom menus bound to the application.
 If Visio.Application.CustomMenus Is Nothing Then

 'If not, use the Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus
 MsgBox "Using Built-In Menus", 0

 Else

 'If there are existing Visio custom menus, use them.
 Set vsoUIObject = Visio.Application.CustomMenus

 'Save these custom menus to a file.
 strPath = Visio.Application.Path & "\CustomUI.vsu"
 vsoUIObject.SaveToFile (strPath)

 'Set the document to use the existing custom UI.
 ThisDocument.CustomMenusFile = strPath

 'Get this document's UIObject object.
 Set vsoUIObject = ThisDocument.CustomMenus

 'Delete the newly created temp file.
 Kill Visio.Application.Path & "\CustomUI.vsu"
 ThisDocument.ClearCustomMenus
 MsgBox "Using Custom Menus", 0

 End If

 Else

 'Use the existing custom menus.
 Set vsoUIObject = ThisDocument.CustomMenus

 End If

End Sub


Document.CustomToolbars Property (Visio)

 Copy code hover
[image]

Document.CustomToolbars Property (Visio)
Send feedback

Published: July 16, 2012

Gets a UIObject object that represents the current custom toolbars and status bars of a Document object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomToolbars

expression A variable that represents a Document object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If Microsoft Visio toolbars and status bars have not been customized, either programmatically, by a Visio solution, or in the user interface, the CustomToolbars property returns Nothing.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the currently active user interface (UI) for your document without replacing the application-level custom UI. You must write additional code to add your custom UI items.

VBA Copy code Copy code
Sub CustomToolbars_Example()

 Dim vsoUIObject As Visio.UIObject

 'Check whether there are custom toolbars bound to the document.
 If ThisDocument.CustomToolbars Is Nothing Then

 'If not, check whether there are custom toolbars bound to the application.
 If Visio.Application.CustomToolbars Is Nothing Then

 'If not, use the Visio built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)
 MsgBox "Using Built-In Toolbars", 0

 Else

 'If there are existing Visio application-level custom toolbars, use them.
 Set vsoUIObject = Visio.Application.CustomToolbars
 MsgBox "Using Custom Toolbars", 0

 End If

 Else

 'Use the existing custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars
 MsgBox "Using Custom Toolbars", 0

 End If

End Sub


Document.CustomToolbarsFile Property (Visio)

 Copy code hover
[image]

Document.CustomToolbarsFile Property (Visio)
Send feedback

Published: July 16, 2012

Returns or sets the name of the file that defines custom toolbars and status bars for a Document object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomToolbarsFile

expression A variable that represents a Document object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the object is not using custom toolbars, the CustomToolbarsFile property returns Nothing.


Document.CustomUI Property (Visio)

 Copy code hover
[image]

Document.CustomUI Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the Ribbon XML string that is passed to the document to customize the Microsoft Office Fluent user interface. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .CustomUI

expression A variable that represents a Document object.

Return Value

String

Remarks

When you set the CustomUI property value, Microsoft Visio does not perform validation on the Ribbon XML. Instead, the XML is persisted in the document file and validated the next time that the document loads.


Document.DataRecordsets Property (Visio)

 Copy code hover
[image]

Document.DataRecordsets Property (Visio)
Send feedback

Published: July 16, 2012

Returns the DataRecordsets collection contained in the document. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataRecordsets

expression An expression that returns a Document object.

Return Value

DataRecordsets


Document.DefaultFillStyle Property (Visio)

 Copy code hover
[image]

Document.DefaultFillStyle Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the default fill style of a document. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .DefaultFillStyle

expression A variable that represents a Document object.

Return Value

String

Remarks

The document's default fill style is applied to new shapes created with the Microsoft Visio drawing tools or with the Draw methods by Automation.


Document.DefaultGuideStyle Property (Visio)

 Copy code hover
[image]

Document.DefaultGuideStyle Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the default guide style of a document. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .DefaultGuideStyle

expression A variable that represents a Document object.

Return Value

String

Remarks

The DefaultGuideStyle property specifies what style is applied to new guides created in the document.


Document.DefaultLineStyle Property (Visio)

 Copy code hover
[image]

Document.DefaultLineStyle Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the default line style of a document. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .DefaultLineStyle

expression A variable that represents a Document object.

Return Value

String

Remarks

The document's default line style is applied to new shapes created with the Microsoft Visio drawing tools or with the Draw methods by Automation.


Document.DefaultSavePath Property (Visio)

 Copy code hover
[image]

Document.DefaultSavePath Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the path to the location where Microsoft Visio saves the current document by default. Read/write.

Version Information

Version Added: Visio 2007

Syntax

expression .DefaultSavePath

expression An expression that returns a Document object.

Return Value

String

Remarks

Note Note

The DefaultSavePath property is run-time only, and the property setting persists for the life of the current document, but not beyond.


Document.DefaultStyle Property (Visio)

 Copy code hover
[image]

Document.DefaultStyle Property (Visio)
Send feedback

Published: July 16, 2012

Gets the default fill style of a document or sets the default fill, line, and text styles of a document. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .DefaultStyle

expression A variable that represents a Document object.

Return Value

String

Remarks

A document's DefaultStyle property returns the same value as its DefaultFillStyle property. Setting the DefaultStyle property is equivalent to setting the DefaultFillStyle, DefaultLineStyle, and DefaultTextStyle properties individually to the same multiple-attribute style. The fill, line, and text attributes of the document's default style are applied to new shapes created with the Microsoft Visio drawing tools or with the Draw methods by Automation.


Document.DefaultTextStyle Property (Visio)

 Copy code hover
[image]

Document.DefaultTextStyle Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the default text style of a document. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .DefaultTextStyle

expression A variable that represents a Document object.

Return Value

String

Remarks

The DefaultTextStyle property corresponds to the value shown in the Style box on the Font tab of the Text dialog box (click the Font arrow on the Home tab) when nothing is selected on the drawing page. The document's default text style is applied to new shapes created with the Microsoft Visio drawing tools or with the Draw methods by Automation.


Document.Description Property (Visio)

 Copy code hover
[image]

Document.Description Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the description of a document, one of a document's properties. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Description

expression A variable that represents a Document object.

Return Value

String

Remarks

Setting a document's Description property is equivalent to entering information in the Description box in the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties).

Security note Security Note
Use this feature with caution. Sensitive or confidential information could be revealed to other users.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Description property to document the description of a drawing. It adds a Document object to the Documents collection and sets the Document object's Description property as well as other document properties.

Before running this macro, substitute your own values for the items in italic in the following code. To verify that these properties have been set, open the Properties dialog box.

VBA Copy code Copy code

Public Sub Description_Example()

    Dim vsoDocument As Visio.Document

    Set vsoDocument = Documents.Add("")

    'Set the properties of the document.
    vsoDocument.Title = "document title"
    vsoDocument.Creator = "author name"
    vsoDocument.Description = "document description"
    vsoDocument.Keywords = "keyword1, keyword2, keyword3"
    vsoDocument.Subject = "document subject"
    vsoDocument.Manager = "manager name"
    vsoDocument.Category = "document category"

End Sub


Document.DiagramServicesEnabled Property (Visio)

 Copy code hover
[image]

Document.DiagramServicesEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines which, if any, diagram services are enabled for the document. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .DiagramServicesEnabled

expression An expression that returns a Document object.

Return Value

Long

Remarks

Microsoft Visio has several diagram behaviors, including structured-diagram behaviors and AutoSize behaviors. Structured-diagram behaviors define when container-membership relationships and callout associations are created. AutoSize behaviors define when Visio automatically resizes the drawing page to adjust to changes in its contents.

In your solution, you can take advantage of these new diagram behaviors by using the DiagramServicesEnabled property to enable the services that aggregate these behaviors. When your solution modifies the diagram, Visio invokes the diagram behaviors associated with any of the services that are currently enabled.

The value of the DiagramServicesEnabled property setting must be one or a bitwise combination of the following constants from the VisDiagramServices enumeration.

Constant | Value | Description
visServiceNone | 0 | No diagram services.
visServiceAll | -1 | All diagram services.
visServiceAutoSizePage | 1 | AutoSize (automatic page-sizing) behaviors.
visServiceStructureBasic | 2 | Structured-diagram behaviors that maintain existing relationships but do not create new relationships.
visServiceStructureFull | 4 | Structured-diagram behaviors that match all those in the user interface (UI).
visServiceVersion140 | 7 | All diagram services that exist in Visio 2010.
visServiceVersion150 | 8 | All diagram services that exist in Visio 2013.

If you combine visServiceStructureBasic and visServiceStructureFull, the latter overrides the former. However, you can combine visServiceAutoSizePage with either visServiceStructureBasic (3) or visServiceStructureFull (5) and assign either of those values to the property.

Diagram services apply only to solutions that manipulate Visio programmatically (by Automation). They do not have any effect on the behaviors that are exposed in the UI. UI settings that disable these behaviors have no effect on behaviors that are triggered programmatically.

By default, diagram services are disabled for a document. You must enable any services you want to take advantage of before your solution modifies the diagram. Diagram service settings are not persisted from one session of Visio to the next.


Document.DocumentSheet Property (Visio)

 Copy code hover
[image]

Document.DocumentSheet Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Shape object whose cells represent properties of the document. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .DocumentSheet

expression A variable that represents a Document object.

Return Value

Shape


Document.DynamicGridEnabled Property (Visio)

 Copy code hover
[image]

Document.DynamicGridEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the dynamic grid is enabled. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .DynamicGridEnabled

expression A variable that represents a Document object.

Return Value

Boolean


Document.EditorCount Property (Visio)

 Copy code hover
[image]

Document.EditorCount Property (Visio)
See also Send feedback

Returns a Long that represents the number of editors of a co-authored document. Read-only.

Syntax

expression .EditorCount

expression A variable that represents a Document object.

See also

Concepts

Document Object

Other resources

Document Members


Document.EmailRoutingData Property (Visio)

 Copy code hover
[image]

Document.EmailRoutingData Property (Visio)
Send feedback

Published: July 16, 2012

Returns e-mail routing data for a document. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .EmailRoutingData

expression A variable that represents a Document object.

Return Value

Variant()

Remarks

This property is not used in Microsoft Visio 2013.


Document.EventList Property (Visio)

 Copy code hover
[image]

Document.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Document object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Document.Fonts Property (Visio)

 Copy code hover
[image]

Document.Fonts Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Fonts collection of a Document object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Fonts

expression A variable that represents a Document object.

Return Value

Fonts


Document.FooterCenter Property (Visio)

 Copy code hover
[image]

Document.FooterCenter Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the text string that appears in the center portion of a document's footer. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .FooterCenter

expression A variable that represents a Document object.

Return Value

String

Remarks

You can also set this value in the Center box under Footer in the Header and Footer dialog box (click the File tab, click Print, click Print Preview, and then in the Preview group, click Header & Footer).

Both the string returned by the property and the string you pass to the property can contain escape codes that represent data. These escape codes can be concatenated with other text. For a list of valid escape codes you can use with the FooterCenter property, see the FooterLeft property topic.

Example

The following macro shows how to place a string containing the current page number and total number of pages into the center portion of a document's footer. After you run this macro on a one-page document, the center portion of the footer contains "Page 1 of 1".

VBA Copy code Copy code

Sub FooterCenter_Example()

    Dim strFooter as String

    'Build the footer string.
    strFooter = "Page &p of &P"

    'Set the footer of the current document.
     ThisDocument.FooterCenter = strFooter

End Sub


Document.FooterLeft Property (Visio)

 Copy code hover
[image]

Document.FooterLeft Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the text string that appears on the left side of a document's footer. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .FooterLeft

expression A variable that represents a Document object.

Return Value

String

Remarks

You can also set this value in the Left box under Footer in the Header and Footer dialog box (click the File tab, click Print, click Print Preview, and then in the Preview group, click Header & Footer).

Both the string returned by FooterLeft and the string to which you set FooterLeft can contain escape codes that represent data. These escape codes can be concatenated with other text.

Following is a list of valid escape codes for document footers and headers.

Escape code | Description
&p | Page number
&t or &T | Current time
&d (short version) or &D (long version) | Current date
&& | Ampersand
&e | File name extension
&f | File name
&f&e | File name and extension
&n | Page name
&P | Total printed pages

Example

The following macro shows how to place a string containing the current date into the left portion of a document's footer. After you run this macro, if the date is May 4, 2007, the left portion of the footer contains "The date is Thursday, May 4, 2007".

VBA Copy code Copy code

Sub FooterLeft_Example()

    Dim strFooter as String

    'Build the footer string.
    strFooter = "The date is " & "&D"

    'Set the footer of the current document.
    ThisDocument.FooterLeft = strFooter

End Sub


Document.FooterMargin Property (Visio)

 Copy code hover
[image]

Document.FooterMargin Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the margin of a document's footer. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .FooterMargin(UnitsNameOrCode)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Optional | Variant | The units to use when retrieving or setting the cell's value. Defaults to internal drawing units (inches).

Return Value

Double

Remarks

If UnitsNameOrCode is not provided, the FooterMargin property will default to internal drawing units.

You can also set this value in the Margin box under Footer in the Header and Footer dialog box (click the File tab, click Print, click Print Preview, and then in the Preview group, click Header & Footer).

Automation constants for representing units are declared by the Microsoft Visio type library in member VisUnitCodes.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.


Document.FooterRight Property (Visio)

 Copy code hover
[image]

Document.FooterRight Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the text string that appears in the right portion of a document's footer. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .FooterRight

expression A variable that represents a Document object.

Return Value

String

Remarks

You can also set this value in the Right box under Footer in the Header and Footer dialog box (click the File tab, click Print, click Print Preview, and then in the Preview group, click Header & Footer).

Both the string returned by FooterRight and the string to which you set FooterRight can contain escape codes that represent data. These escape codes can be concatenated with other text. For a list of valid escape codes you can use with the FooterRight property, see the FooterLeft property topic.

Example

The following macro shows how to place a string containing the current date into the right portion of a document's footer. After you run this macro, if the date is May 4, 2007, the right portion of the footer contains "The date is Thursday, May 4, 2007".

VBA Copy code Copy code

Sub FooterRight_Example()

    Dim strFooter as String

    'Build the footer string.
    strFooter = "The date is " & "&D"

    'Set the footer of the current document.
    ThisDocument.FooterRight = strFooter

End Sub


Document.FullBuildNumberCreated Property (Visio)

 Copy code hover
[image]

Document.FullBuildNumberCreated Property (Visio)
Send feedback

Published: July 16, 2012

Returns the full build number of the instance used to create the document. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .FullBuildNumberCreated

expression A variable that represents a Document object.

Return Value

Long

Remarks

The format of the full build number is described in the following table.

Bits | Description
0 - 15 | Internal build number
16 - 20 | Internal revision number
21 - 25 | Minor version number
26 - 30 | Major version number (Microsoft Visio 2013 = 15)
31 | Reserved

In addition, for Visio 2013, to obtain the correct full build number, it is necessary to add 1000 to the internal revision number part of the full build number returned by the FullBuildNumberCreated property, as shown in the following macro.

Example

The following Microsoft Visual Basic for Applications (VBA) procedures show how to use the FullBuildNumberCreated property to get the full build number of the instance of Visio used to create the document. Once the full build number has been obtained, the ParseFullBuildNumberCreatedProperty procedure parses the number and prints the results in the Immediate window.

VBA Copy code Copy code
Public Sub FullBuildNumberCreated_Example()

 Dim lngFullBuild As Long
 lngFullBuild = ActiveDocument.FullBuildNumberCreated
 ParseFullBuildNumberCreatedProperty (lngFullBuild)

End Sub

Public Sub ParseFullBuildNumberCreatedProperty(ByRef lngFullBuild As Long)

 Dim lngMajor As Long
 Dim lngMinor As Long
 Dim lngRevision As Long
 Dim lngBuild As Long
 Dim lngNumber As Long

 lngNumber = lngFullBuild

 ' Low 16 bits:
 lngBuild = lngNumber Mod 65536
 lngNumber = lngNumber / 65536

 'Next 5 bits:
 lngRevision = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Next 5 bits:
 lngMinor = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Next 5 bits:
 lngMajor = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Remaining 1 bit unused and 0 as of Visio 2010
 Debug.Print "lngFullBuild (full version specification): " & lngMajor & "." _
 & lngMinor & "." & lngBuild & "." & lngRevision + 1000
 Debug.Assert(0 = lngNumber)

End Sub


Document.FullBuildNumberEdited Property (Visio)

 Copy code hover
[image]

Document.FullBuildNumberEdited Property (Visio)
Send feedback

Published: July 16, 2012

Returns the full build number of the instance last used to edit the document. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .FullBuildNumberEdited

expression A variable that represents a Document object.

Return Value

Long

Remarks

The format of the full build number is described in the following table.

Bits | Description
0 - 15 | Internal build number
16 - 20 | Internal revision number
21 - 25 | Minor version number.
26 - 30 | Major version number (Microsoft Visio 2013 = 15)
31 | Reserved

In addition, for Visio 2013, to obtain the correct full build number, it is necessary to add 1000 to the internal revision number part of the full build number returned by the FullBuildNumberEdited property, as shown in the following macro.

Example

The following Microsoft Visual Basic procedures show how to use the FullBuildNumberEdited property to get the full build number of the instance of Visio last used to edit the document. When the full build number has been obtained, the ParseFullBuildNumberEditedProperty procedure parses the number and prints the result in the Immediate window.

VBA Copy code Copy code
Public Sub FullBuildNumberEdited_Example()

 Dim lngFullBuild As Long
 lngFullBuild = ActiveDocument.FullBuildNumberEdited
 ParseFullBuildNumberEditedProperty (lngFullBuild)

End Sub

Public Sub ParseFullBuildNumberEditedProperty(ByRef lngFullBuild As Long)

 Dim lngMajor As Long
 Dim lngMinor As Long
 Dim lngRevision As Long
 Dim lngBuild As Long
 Dim lngNumber As Long

 lngNumber = lngFullBuild

 ' Low 16 bits:
 lngBuild = lngNumber Mod 65536
 lngNumber = lngNumber / 65536

 'Next 5 bits:
 lngRevision = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Next 5 bits:
 lngMinor = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Next 5 bits:
 lngMajor = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Remaining 1 bit unused and 0 as of Visio 2010
 Debug.Print "lngFullBuild (full version specification): " & lngMajor & "." _
 & lngMinor & "." & lngBuild & "." & lngRevision + 1000
 Debug.Assert(0 = lngNumber)

End Sub


Document.FullName Property (Visio)

 Copy code hover
[image]

Document.FullName Property (Visio)
Send feedback

Published: July 16, 2012

Returns the name of a document, including the drive and path. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .FullName

expression A variable that represents a Document object.

Return Value

String

Remarks

Use the FullName property to obtain a document's drive, folder path, and file name as one string. The returned value can include UNC drive names (for example, \\drive\folder).


Document.GestureFormatSheet Property (Visio)

 Copy code hover
[image]

Document.GestureFormatSheet Property (Visio)
Send feedback

Published: July 16, 2012

Returns a reference to a document's Gesture Format sheet, which contains the line, fill, and text formatting that is applied to shapes drawn on the page. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .GestureFormatSheet

expression A variable that represents a Document object.

Return Value

Shape

Remarks

By default, a new shape inherits all its formatting from the document's default styles. However, if the Gesture Format sheet contains local formatting, that formatting is applied to the new shape. Use the FillStyle, LineStyle, and TextStyle properties to apply local formatting to the Gesture Format Shape object.

Gesture Format sheet formatting does not apply to instances of masters, connectors, pasted objects, or embedded objects.

A document's Gesture Format sheet is cleared automatically when a document is opened.

If a user attempts to use formatting commands on the menus and toolbars to make changes to any shape, but no shapes are currently selected, this formatting is stored in the gesture format sheet and applied to new shapes the user draws.


Document.GlueEnabled Property (Visio)

 Copy code hover
[image]

Document.GlueEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether glue is enabled in the document. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .GlueEnabled

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

The value of the GlueEnabled property corresponds to the setting of the Glue check box on the General tab in the Snap & Glue dialog box (on the View tab, click the Visual Aids arrow).


Document.GlueSettings Property (Visio)

 Copy code hover
[image]

Document.GlueSettings Property (Visio)
Send feedback

Published: July 16, 2012

Determines the objects that shapes glue to when glue is enabled in the document. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .GlueSettings

expression A variable that represents a Document object.

Return Value

VisGlueSettings

Remarks

Setting the value of the GlueSettings property is equivalent to selecting options under Glue to on the General tab in the Snap & Glue dialog box (on the View tab, click the Visual Aids arrow).

The GlueSettings property can be any combination of the following VisGlueSettings constants, which are declared in the Microsoft Visio type library.

Constant | Value | Description
visGlueToNone | &H0 | Glue is enabled but no other glue settings are on.
visGlueToGuides | &H1 | Glue to guides.
visGlueToHandles | &H2 | Glue to shape handles.
visGlueToVertices | &H4 | Glue to shape vertices.
visGlueToConnectionPoints | &H8 | Glue to connection points.
visGlueToGeometry | &H20 | Glue to shape geometry.
visGlueToDisabled | &H8000 | Disable glue.


Document.HeaderCenter Property (Visio)

 Copy code hover
[image]

Document.HeaderCenter Property (Visio)
Send feedback

Published: July 16, 2012

Contains the text string that appears in the center portion of a document's header. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .HeaderCenter

expression A variable that represents a Document object.

Return Value

String

Remarks

You can also set this value in the Center box under Header in the Header and Footer dialog box (click the File tab, click Print, click Print Preview, and then in the Preview group, click Header & Footer).

Both the string that HeaderCenter returns and the string to which you set it can contain escape codes that represent data. These escape codes can be concatenated with other text. For a list of valid escape codes you can use with the HeaderCenter property, see the FooterLeft property.

Example

The following macro shows how to place the string containing "Document Title" into the center portion of the document's header.

VBA Copy code Copy code

Sub HeaderCenter_Example()

    'Set header of current document.
    ThisDocument.HeaderCenter = "Document Title"

End Sub


Document.HeaderFooterColor Property (Visio)

 Copy code hover
[image]

Document.HeaderFooterColor Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the color of the header and footer text. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .HeaderFooterColor

expression A variable that represents a Document object.

Return Value

OLE_COLOR

Remarks

Valid values for OLE_COLOR within Microsoft Visio can be one of the following:

  • &H00bbggrr, where bb is the blue value between 0 and 0xFF (255), gg the green value, and rr the red value.

  • &H800000xx, where xx is a valid GetSysColor index.

For details about the GetSysColor function, search for "GetSysColor" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.

The OLE_COLOR data type is used for properties that return colors. When a property is declared as OLE_COLOR, the Properties window will display a color-picker dialog box that allows the user to select the color for the property visually, rather than having to remember the numeric equivalent.

You can also set this value in the Color box in the Choose Font dialog box (click the File tab, click Print, click Print Preview, in the Preview group, click Header & Footer, and then click Choose Font).

Example

The following macro shows how to assign the color blue to text in the header and footer.

VBA Copy code Copy code

Sub HeaderFooterColor_Example()

    'Set color of the header of this document to blue.
    ThisDocument.HeaderFooterColor = &H00FF0000

End Sub


Document.HeaderFooterFont Property (Visio)

 Copy code hover
[image]

Document.HeaderFooterFont Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the font used for the header and footer text. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .HeaderFooterFont

expression A variable that represents a Document object.

Return Value

IFontDisp

Remarks

COM provides a standard implementation of a font object with the IFontDisp interface on top of the underlying system font support. The IFontDisp interface exposes a font object's properties and is implemented in the stdole type library as a StdFont object that can be created in Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic for Applications (VBA) projects in Microsoft Visio.

To get information about the StdFont object that supports the IFontDisp interface:

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click stdole.

  4. Under Classes, examine the class named StdFont.

For details about the IFontDisp interface, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.

Setting the HeaderFooterFont property is the equivalent of setting values in the Font box in the Choose Font dialog box (click the File tab, click Print, click Print Preview, in the Preview group, click Header & Footer, and then click Choose Font).

Example

The following sample code shows how to use the HeaderFooterFont property to get a reference to the current Font object and set the document's text font to non-bold Arial.

VBA Copy code Copy code

Public Sub HeaderFooterFont_Example()

    Dim objStdFont As StdFont

    Set objStdFont = ThisDocument.HeaderFooterFont
    objStdFont.Name = "Arial"
    objStdFont.Bold = False
    Set ThisDocument.HeaderFooterFont = objStdFont

End Sub


Document.HeaderLeft Property (Visio)

 Copy code hover
[image]

Document.HeaderLeft Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the text string that appears in the left portion of a document's header. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .HeaderLeft

expression A variable that represents a Document object.

Return Value

String

Remarks

You can also set this value in the Left box under Header in the Header and Footer dialog box (click the File tab, click Print, click Print Preview, and then in the Preview group, click Header & Footer).

Both the string that HeaderLeft returns and the string to which you set it can contain escape codes that represent data. These escape codes can be concatenated with other text. For a list of valid escape codes you can use with the HeaderLeft property, see the FooterLeft property

Example

The following macro shows how to place a string containing the current date into the left portion of a document's header. After you run this macro, if the date is October 1, 2009, the left portion of the header contains "The date is Thursday, October 1, 2009".

VBA Copy code Copy code

Sub HeaderLeft_Example()

    Dim strHeader as String

    'Build header string.
    strHeader = "The date is " & "&D"

    'Set header of the current document.
    ThisDocument.HeaderLeft = strHeader

End Sub


Document.HeaderMargin Property (Visio)

 Copy code hover
[image]

Document.HeaderMargin Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the margin of a document's header. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .HeaderMargin(UnitsNameOrCode)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Optional | Variant | The units to use when retrieving or setting the cell's value. Defaults to internal drawing units (inches).

Return Value

Double

Remarks

You can also set this value in the Margin box under Header in the Header and Footer dialog box (click the File tab, click Print, click Print Preview, and then in the Preview group, click Header & Footer).

Automation constants for representing units are declared by the Visio type library in member VisUnitCodes.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.


Document.HeaderRight Property (Visio)

 Copy code hover
[image]

Document.HeaderRight Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the text string that appears in the right portion of a document's header. Read/write.

Version Information

Version Added: Word 2002

Syntax

expression .HeaderRight

expression A variable that represents a Document object.

Return Value

String

Remarks

You can also set this value in the Right box under Header in the Header and Footer dialog box (click the File tab, click Print, click Print Preview, and then in the Preview group, click Header & Footer).

Both the string that HeaderRight returns and the string to which you set it can contain escape codes that represent data. These escape codes can be concatenated with other text. For a list of valid escape codes you can use with the HeaderRight property, see the FooterLeft property.

Example

The following macro shows how to place a string containing the current date into the right portion of a document's header. After you run this macro, if the date is October 1, 2009, the right portion of the header contains "The date is Thursday, October 1, 2009".

VBA Copy code Copy code

Sub HeaderRight_Example()

    Dim strHeader as String

    'Build header string.
    strHeader = "The date is " & "&D"

    'Set header of the current document.
    ThisDocument.HeaderRight = strHeader

End Sub


Document.HyperlinkBase Property (Visio)

 Copy code hover
[image]

Document.HyperlinkBase Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the value of the Hyperlink base box in a document's Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties). Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .HyperlinkBase

expression A variable that represents a Document object.

Return Value

String


Document.ID Property (Visio)

 Copy code hover
[image]

Document.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ID of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ID

expression A variable that represents a Document object.

Return Value

Long


Document.Index Property (Visio)

 Copy code hover
[image]

Document.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Document object in the Documents collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Document object.

Return Value

Integer

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Document.InPlace Property (Visio)

 Copy code hover
[image]

Document.InPlace Property (Visio)
Send feedback

Published: July 16, 2012

Specifies whether a document is open in place, or whether a document is being viewed through a window that is open in place. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .InPlace

expression A variable that represents a Document object.

Return Value

Integer

Remarks

When the value of the InPlace property is True for a Document object, it means that the document is open in an in-place editing window in an OLE container application.


Document.Keywords Property (Visio)

 Copy code hover
[image]

Document.Keywords Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the value of the Keywords box in a document's Properties dialog box. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Keywords

expression A variable that represents a Document object.

Return Value

String

Remarks

Setting the Keywords property is equivalent to entering information in the Keywords box in the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties).

Security note Security Note
Use this feature with caution. Sensitive or confidential information could be revealed to other users.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Keywords property to document the keywords that help locate a drawing. It adds a Document object to the Documents collection and sets the Document object's Keywords property as well as other document properties.

Before running this macro, substitute your own values for the items in italic in the following code. To verify that these properties have been set, open the Properties dialog box.

VBA Copy code Copy code
Public Sub Keywords_Example()

   Dim vsoDocument As Visio.Document

    Set vsoDocument = Documents.Add("")

    'Set the properties of the document.
    vsoDocument.Title = "document title"
    vsoDocument.Creator = "author name"
    vsoDocument.Description = "document description"
    vsoDocument.Keywords = "keyword1, keyword2, keyword3"
    vsoDocument.Subject = "document subject"
    vsoDocument.Manager = "manager name"
    vsoDocument.Category = "document category"

End Sub


Document.Language Property (Visio)

 Copy code hover
[image]

Document.Language Property (Visio)
Send feedback

Published: July 16, 2012

Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .Language

expression A variable that represents a Document object.

Return Value

Long

Remarks

The Language property returns the language ID recorded in the object's VERSIONINFO resource. The IDs returned are the standard IDs used by Microsoft Windows to encode different language versions. For example, the Language property returns &H0409 for the U.S. English version of Visio. For details, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Document.LeftMargin Property (Visio)

 Copy code hover
[image]

Document.LeftMargin Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the left margin, which is used when printing. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .LeftMargin(UnitsNameOrCode)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Optional | Variant | The units to use when retrieving or setting the margin value. Defaults to internal drawing units.

Return Value

Double

Remarks

The LeftMargin property corresponds to the Left setting in the Print Setup dialog box (on the Design tab, click the Page Setup arrow, and then, on the Print Setup tab, click Setup).

You can specify UnitsNameOrCode as an integer or a string value. If the string is invalid, an error is generated. For example, the following statements all set UnitsNameOrCode to inches.

Document.LeftMargin (visInches) = newValue

Document.LeftMargin (65) = newValue

Document.LeftMargin ("in") = newValue where "in" can also be any of the alternate strings representing inches, such as "inch", "in.", or "i".

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Automation constants for representing units are declared by the Microsoft Visio type library in member VisUnitCodes.


Document.MacrosEnabled Property (Visio)

 Copy code hover
[image]

Document.MacrosEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Specifies whether you can execute macros and process events in a document's Microsoft Visual Basic for Applications (VBA) project. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .MacrosEnabled

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

If your document contains macros that are necessary to your solution's execution, you can use the MacrosEnabled property to verify whether macros are enabled in the document. If they are disabled, you can display a message indicating that your solution may not work as expected because document settings prohibit macros from being executed.

The value of the MacrosEnabled property depends on a combination of the macro setting and the project's signature status (whether it is digitally signed by a trusted source or in a trusted location). The following table describes these combinations.

Macro setting | Digitally signed | In a trusted location | MacrosEnabled property
Disable all macros without notification | N/A | No | False
Disable all macros without notification | N/A | Yes | True
Disable all macros with user notification | N/A | No | False
Disable all macros with user notification | N/A | Yes | True
Disable all macros except digitally signed macros | No | No | False
Disable all macros except digitally signed macros | Yes | N/A | True
Disable all macros except digitally signed macros | N/A | Yes | True
Enable all macros | N/A | N/A | True

By default, macros are disabled in a Visio document not from a trusted publisher, or that is not digitally signed, or that is not in a trusted location.

However, you can change default settings in the Macro Settings category of the Visio Trust Center (click the File tab, click Options, click Trust Center, and then click Trust Center Settings). If Disable all macros except digitally signed macros is selected, macros in Visio documents not in a trusted location are enabled only if the documents are digitally signed. If you select Disable all macros without notification or Disable all macros with notification, macros in documents not in a trusted location are disabled. If you select Enable all macros, all macros are always enabled, but this option presents a security risk and is not recommended.

Trusted sources are listed in the Trusted Publishers category in the Trust Center, and trusted locations are listed in the Trusted Locations category.

To open a document in a disabled state (macros are not enabled), you can use the OpenEx method of the Document object. For example:

VBA Copy code Copy code
Documents.OpenEx(fileName, visOpenMacrosDisabled)

Example

The following example shows how use to open a document from an add-on and use the MacrosEnabled property to determine whether macros are enabled. If macros are disabled, a message box appears warning the user of limited functionality. Before running this example, supply a valid document file name for the variable filename.

VBA Copy code Copy code

Public Sub MacrosEnabled_Example()

    Dim vsoDocument As Visio.Document
    Dim blsStatus As Boolean

    Set vsoDocument = Documents.Open("filename")
    blsStatus = vsoDocument.MacrosEnabled

    If Not blsStatus Then

         MsgBox "Macro execution has been disabled for this document." & _
            "Functionality may be limited."

    End if

End Sub


Document.Manager Property (Visio)

 Copy code hover
[image]

Document.Manager Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the value of the Manager box in a document's Properties dialog box. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .Manager

expression A variable that represents a Document object.

Return Value

String

Remarks

Setting the Manager property is equivalent to entering information in the Manager box in the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties).

Security note Security Note
Use this feature with caution. Sensitive or confidential information could be revealed to other users.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Manager property to document the name of the manager of the author of a drawing. It adds a Document object to the Documents collection and sets the Document object's Manager property as well as other document properties.

Before running this macro, substitute your own values for the items in italic in the following code. To verify that these properties have been set, open the Properties dialog box.

VBA Copy code Copy code

Public Sub Manager_Example()

   Dim vsoDocument As Visio.Document

    Set vsoDocument = Documents.Add("")

    'Set the properties of the document.
    vsoDocument.Title = "document title"
    vsoDocument.Creator = "author name"
    vsoDocument.Description = "document description"
    vsoDocument.Keywords = "keyword1, keyword2, keyword3"
    vsoDocument.Subject = "document subject"
    vsoDocument.Manager = "manager name"
    vsoDocument.Category = "document category"

End Sub


Document.Masters Property (Visio)

 Copy code hover
[image]

Document.Masters Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Masters collection for a document's stencil. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Masters

expression A variable that represents a Document object.

Return Value

Masters

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVDocument.Masters

Example

This Microsoft Visual Basic for Applications (VBA) program shows how to use the Masters property to print all the master shape names in the current document to the Immediate window.

Before running this macro, open a Microsoft Visio drawing and drag at least one shape from a stencil onto to the drawing page.

VBA Copy code Copy code

Public Sub Masters_Example()

    Dim intCounter As Integer
    Dim intMasterCount As Integer
    Dim vsoApplication As Visio.Application
    Dim vsoCurrentDocument As Visio.Document
    Dim vsoMasters As Visio.Masters

    Set vsoApplication = GetObject(, "visio.application")

    If vsoApplication Is Nothing Then
        MsgBox "Microsoft Office Visio is not loaded"
        Exit Sub

    End If

    Set vsoCurrentDocument = vsoApplication.ActiveDocument

    If vsoCurrentDocument Is Nothing Then
        MsgBox "No stencil is loaded"
        Exit Sub

    End If

    Set vsoMasters = vsoCurrentDocument.Masters
    Debug.Print "Masters in document : "; vsoCurrentDocument.Name
    intMasterCount = vsoMasters.Count

    If intMasterCount > 0 Then
        For intCounter = 1 To intMasterCount
            Debug.Print " "; vsoMasters.Item(intCounter).Name
        Next intCounter
    Else
        Debug.Print " No masters in document"
    End If

End Sub


Document.MasterShortcuts Property (Visio)

 Copy code hover
[image]

Document.MasterShortcuts Property (Visio)
Send feedback

Published: July 16, 2012

Returns the MasterShortcuts collection for a document stencil. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .MasterShortcuts

expression A variable that represents a Document object.

Return Value

MasterShortcuts

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the MasterShortcuts property to get the collection of master shortcuts in a document stencil.

Before running this example, replace the reference to StencilWithShortucts.vss with a reference to a valid .vss file that contains master shortcuts.

To create a stencil that contains master shortcuts:

  1. Open an existing stencil. (In the Shapes window, click More Shapes, click Open Stencil, and then double-click a stencil.)

  2. Right-click a master in the stencil and click Copy.

  3. Create a new stencil. (In the Shapes window, click More Shapes, and then click New Stencil (US Units) or New Stencil (Metric).)

  4. Right-click the new stencil and click Paste Shortcut.

  5. Save the new stencil. (Right-click its title bar and click Save.)

In the following code, replace StencilWithShortcuts.vss with the name of your new stencil.

VBA Copy code Copy code

Public Sub MasterShortcuts_Example()

    Dim vsoMasterShortcuts As Visio.MasterShortcuts
    Dim vsoMasterShortcut As Visio.MasterShortcut
    Dim vsoStencil As Visio.Document

    'Get a stencil that contains some shortcuts.
    Set vsoStencil = Application.Documents ("StencilWithShortcuts.vss")
    Set vsoMasterShortcuts = vsoStencil.MasterShortcuts

    For Each vsoMasterShortcut In vsoMasterShortcuts

        'Print some of the more common properties of a
        'master shortcut to the Immediate window.
        With vsoMasterShortcut
            Debug.Print .AlignName
            Debug.Print .DropActions
            Debug.Print .IconSize
            Debug.Print .ID
            Debug.Print .Index
            Debug.Print .Name
            Debug.Print .NameU
            Debug.Print .ObjectType
            Debug.Print .Prompt
            Debug.Print .ShapeHelp
            Debug.Print .Stat
            Debug.Print .TargetDocumentName

            'Original master where shortcut points
            Debug.Print.TargetMasterName

        End With

    Next

End Sub


Document.Mode Property (Visio)

 Copy code hover
[image]

Document.Mode Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a document is in run mode or design mode. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .Mode

expression A variable that represents a Document object.

Return Value

VisDocModeArgs

Remarks

A Microsoft Visio document is either in run mode or in design mode, just as a Microsoft Visual Basic form is either running or being designed.

The following are the fundamental distinctions between run mode and design mode:

  • ActiveX controls hosted in a document are told not to fire events when the document is in design mode, and to fire events when in run mode.

  • Visio doesn't source events from any object whose document is in design mode.

The run/design mode of a Visio document is reported in the Visio user interface by the Design Mode control on the Developer tab. The appearance of this control is the same as that of the Design Mode button in the Visual Basic Editor window. If the control appears pressed, the document (project) is in design mode. If it does not appear pressed, the document (project) is in run mode.

The run/design mode of a Visio document is synchronized with the run/design state of the document's Visual Basic for Applications (VBA) project, provided the document has a project. If the document transitions to or from run mode, the project's mode switches, and vice versa. This means that if code in a document's project sets the document's mode to design mode (ThisDocument.Mode = visDocModeDesign), the project in which the code runs transitions to design mode and any statements following the mode-assignment statement are not executed. However, code in a document can put another document (project) into design mode and keep running.

A document's mode is not a persistent property. By default, a Visio document opens in design mode unless the document is from a trusted publisher, is digitally signed, or is in a trusted location. A document that meets one of these criteria opens in run mode.

However, you can change default settings in the Macro Settings category of the Visio Trust Center (Click the File tab, click Options, click Trust Center, and then click Trust Center Settings.) If Disable all macros except digitally signed macros is selected, Visio documents not in a trusted location open in run mode only if they are digitally signed. If Disable all macros without notification or Disable all macros with notification is selected, documents not in a trusted location open in design mode. If Enable all macros is selected, documents always open in run mode, but this option presents a security risk and is not recommended.


Document.Name Property (Visio)

 Copy code hover
[image]

Document.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a Document object.

Return Value

String

Remarks

You can get, but not set, the Name property of a Document object. If a document is not yet named, this property returns the document's temporary name, such as Drawing1 or Stencil1.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Document.ObjectType Property (Visio)

 Copy code hover
[image]

Document.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Document object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Document.OLEObjects Property (Visio)

 Copy code hover
[image]

Document.OLEObjects Property (Visio)
Send feedback

Published: July 16, 2012

Returns the OLEObjects collection of a document. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .OLEObjects

expression A variable that represents a Document object.

Return Value

OLEObjects

Remarks

The OLEObjects property returns an OLEObjects collection that includes any OLE 2.0 linked or embedded objects or ActiveX controls contained in a document, master, or page.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the OLEObjects collection of an active page and print the ClassID and ProgID for each OLEObject object in the Immediate window. This example assumes that the active page contains at least one OLE 2.0 embedded or linked object or an ActiveX control.

VBA Copy code Copy code

Public Sub OLEObjects_Example()

 Dim intCounter As Integer
 Dim vsoOLEObjects As Visio.OLEObjects

 'Get the OLEObjects collection of the active page.
 Set vsoOLEObjects = ActivePage.OLEObjects

 'Step through the collection of OLEObjects on the page.
 For intCounter = 1 To vsoOLEObjects.Count
 Debug.Print vsoOLEObjects(intCounter).ClassID
 Debug.Print vsoOLEObjects(intCounter).ProgID
 Next intCounter

End Sub


Document.Pages Property (Visio)

 Copy code hover
[image]

Document.Pages Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Pages collection for a document. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Pages

expression A variable that represents a Document object.

Return Value

Pages

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVDocument.Pages

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Pages property to print the names of a document's pages.

VBA Copy code Copy code

Public Sub Pages_Example()

    Dim intCounter As Integer
    Dim vsoDocument As Visio.Document
    Dim vsoPages As Visio.Pages

    'Get the Pages collection for the active document.
    Set vsoPages = ActiveDocument.Pages

    Debug.Print "Page names for document: "; ActiveDocument.Name

    'Iterate through the pages and print the page name
    'in the Immediate window.
    For intCounter = 1 To vsoPages.Count
        Debug.Print " "; vsoPages.Item(intCounter).Name
    Next intCounter

End Sub


Document.PaperHeight Property (Visio)

 Copy code hover
[image]

Document.PaperHeight Property (Visio)
Send feedback

Published: July 16, 2012

Returns the height of a document's printed page. Read-only.

Version Information

Version Added: Visio 4.5

Syntax

expression .PaperHeight(UnitsNameOrCode)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Required | Variant | The units to use when retrieving the paper height.

Return Value

Double

Remarks

The PaperHeight property value can be a string such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Visio units such as centimeters, meters, miles, and so on. You can also use any of the unit constants declared by the Visio type library in VisUnitCodes.


Document.PaperSize Property (Visio)

 Copy code hover
[image]

Document.PaperSize Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paper size of a document. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .PaperSize

expression A variable that represents a Document object.

Return Value

VisPaperSizes

Remarks

Setting the PaperSize property is the equivalent of choosing a printer paper size on the Print Setup tab of the Page Setup dialog box (on the Design tab, click the Page Setup arrow). The value of PaperSize can be one of the following VisPaperSizes constants.

Constant | Value | Description
visPaperSizeUnknown | 0 | Not known
visPaperSizeLetter | 1 | Letter 8 1/2 x 11 in
visPaperSizeLegal | 5 | Legal 8 1/2 x 14 in
visPaperSizeA3 | 8 | A3 297 x 420 mm
visPaperSizeA4 | 9 | A4 210 x 297 mm
visPaperSizeA5 | 11 | A5 148 x 210 mm
visPaperSizeB4 | 12 | B4 (JIS) 250 x 354 mm
visPaperSizeB5 | 13 | B5 (JIS) 182 x 257 mm
visPaperSizeFolio | 14 | Folio 8 1/2 x 13 in
visPaperSizeNote | 18 | Note 8 1/2 x 11 in
visPaperSizeSizeC | 24 | C size sheet 17 x 22 in.
visPaperSizeSizeD | 25 | D size sheet 22 x 34 in.
visPaperSizeSizeE | 26 | E size sheet 34 x 44 in.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVDocument.PaperSize


Document.PaperWidth Property (Visio)

 Copy code hover
[image]

Document.PaperWidth Property (Visio)
Send feedback

Published: July 16, 2012

Returns the width of a document's printed page. Read-only.

Version Information

Version Added: Visio 4.5

Syntax

expression .PaperWidth(UnitsNameOrCode)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Required | Variant | The units to use when setting or retrieving the paper width.

Return Value

Double

Remarks

The PaperWidth property value can be a string such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Visio units such as centimeters, meters, miles, and so on. You can also use any of the units constants declared by the Visio type library in member VisUnitCodes.


Document.Path Property (Visio)

 Copy code hover
[image]

Document.Path Property (Visio)
Send feedback

Published: July 16, 2012

Returns the drive and folder path of the Microsoft Visio document. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Path

expression A variable that represents a Document object.

Return Value

String

Remarks

If the document has not been saved, the Path property of the Document object returns a zero-length string ("").


Document.PersistsEvents Property (Visio)

 Copy code hover
[image]

Document.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Document object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Document.PreviewPicture Property (Visio)

 Copy code hover
[image]

Document.PreviewPicture Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the preview picture shown in the Open dialog box and when you click the File tab, and then click New. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .PreviewPicture

expression A variable that represents a Document object.

Return Value

IPictureDisp

Remarks

The PreviewPicture property returns and accepts only EMF files (enhanced metafiles). Microsoft Visio will raise an exception if the file you pass to PreviewPicture is a non-EMF file.

To delete an existing preview, set the PreviewPicture property to Nothing.

You can use the PreviewPicture property to include a preview picture in a template that does not have any diagrams stored in it.

COM provides a standard implementation of a picture object that has the IPictureDisp interface on top of the underlying system picture support. The IPictureDisp interface exposes a picture object's properties and is implemented in the stdole type library as a StdPicture object creatable within Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic for Applications (VBA) projects in Visio.

To get information about the StdPicture object that supports the IPictureDisp interface:

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click stdole.

  4. Under Classes, examine the class named StdPicture.

For details about the IPictureDisp interface, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.

Currently, only in-process solutions can use the PreviewPicture property because the IPictureDisp interface cannot be marshaled.


Document.PrintCenteredH Property (Visio)

 Copy code hover
[image]

Document.PrintCenteredH Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether drawings are centered between the left and right edges of the paper when printed. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .PrintCenteredH

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

The PrintCenteredH property corresponds to the Center horizontally check box in the Print Setup dialog box (on the Design tab, click the arrow in the Page Setup group, and then click Setup on the Print Setup tab).


Document.PrintCenteredV Property (Visio)

 Copy code hover
[image]

Document.PrintCenteredV Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether drawings are centered between the top and bottom edges of the paper when printed. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .PrintCenteredV

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

The PrintCenteredV property corresponds to the Center vertically check box in the Print Setup dialog box (on the Design tab, click the arrow in the Page Setup group, and then click Setup on the Print Setup tab).


Document.Printer Property (Visio)

 Copy code hover
[image]

Document.Printer Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of the printer to use when printing the document. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Printer

expression A variable that represents a Document object.

Return Value

String

Remarks

The Printer property corresponds to the Name box in the Print dialog box (click the File tab, click Print, and then click Print again).


Document.PrintFitOnPages Property (Visio)

 Copy code hover
[image]

Document.PrintFitOnPages Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether drawings in a document are printed on a specified number of sheets across and down. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .PrintFitOnPages

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

The PrintFitOnPages property corresponds to the Fit to settings in the Page Setup dialog box (on the Design tab, click the arrow in the Page Setup group). If this property is True, Microsoft Visio prints the document's drawings on the number of sheets specified by the PrintPagesAcross and PrintPagesDown properties.


Document.PrintLandscape Property (Visio)

 Copy code hover
[image]

Document.PrintLandscape Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether a document's drawings are printed in landscape or portrait orientation. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .PrintLandscape

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

The PrintLandscape property corresponds to the Portrait and Landscape settings in the Print Setup dialog box (on the Design tab, click the arrow in the Page Setup group).


Document.PrintPagesAcross Property (Visio)

 Copy code hover
[image]

Document.PrintPagesAcross Property (Visio)
Send feedback

Published: July 16, 2012

Indicates the number of sheets of paper on which a drawing is printed horizontally. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .PrintPagesAcross

expression A variable that represents a Document object.

Return Value

Integer

Remarks

You must set the value of the PrintFitOnPages property to True in order to use the PrintPagesAcross property. If the value of the PrintFitOnPages property is False, Microsoft Visio ignores the PrintPagesAcross property.

The PrintPagesAcross property corresponds to the Fit to sheet(s) across setting in the Page Setup dialog box (on the Design tab, click the arrow in the Page Setup group).


Document.PrintPagesDown Property (Visio)

 Copy code hover
[image]

Document.PrintPagesDown Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the number of sheets of paper on which a drawing is printed vertically. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .PrintPagesDown

expression A variable that represents a Document object.

Return Value

Integer

Remarks

You must set the value of the PrintFitOnPages property to True to use the PrintPagesDown property. If the value of the PrintFitOnPages property is False, Microsoft Visio ignores the PrintPagesDown property.

The PrintPagesDown property corresponds to the Fit by sheet(s) down setting in the Page Setup dialog box (on the Design tab, click the arrow in the Page Setup group).


Document.PrintScale Property (Visio)

 Copy code hover
[image]

Document.PrintScale Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets how much drawings are reduced or enlarged when printed. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .PrintScale

expression A variable that represents a Document object.

Return Value

Double

Remarks

The PrintScale property corresponds to the Adjust to setting on the Print Setup tab in the Page Setup dialog box (on the Design tab, click the arrow in the Page Setup group). To print a drawing at half its size, specify 0.5. To print a drawing at twice its size, specify 2.0.


Document.ProgID Property (Visio)

 Copy code hover
[image]

Document.ProgID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the programmatic identifier of a shape that represents an ActiveX control, an embedded object, or linked object. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .ProgID

expression A variable that represents a Document object.

Return Value

String

Remarks

The ProgID property raises an exception if the shape doesn't represent an ActiveX control or OLE 2.0 embedded or linked object. A shape represents an ActiveX control, embedded object, or linked object if the ForeignType property returns visTypeIsOLE2 in the value.

Use the ProgID property of a Shape object or OLEObject to obtain the programmatic identifier of the object. Every OLE object class stores a programmatic identifier for itself in the registry. Typically this occurs when the program that services the object installs itself. Client programs use this identifier to identify the object. You are using the Microsoft Visio identifier when you execute a statement such as GetObject(,"Visio.Application") from a Microsoft Visual Basic program.

These are strings that the ProgID property might return:

Copy code Copy code

Visio.Drawing.5
MSGraph.Chart.5
Forms.CommandButton.1

After using a shape's Object property to obtain an IDispatch interface on the object the shape represents, you can obtain the shape's ClassID or ProgID property to determine the methods and properties provided by that interface.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the OLEObjects collection of an active page and print the ProgID for each OLEObject object in the Immediate window. This example assumes that the active page has at least one OLE 2.0 embedded or linked object or an ActiveX control.

VBA Copy code Copy code

Public Sub ProgID_Example()

 Dim intCounter As Integer
 Dim vsoOLEObjects As Visio.OLEObjects

 'Get the OLEObjects collection of the active page.
 Set vsoOLEObjects = ActivePage.OLEObjects

 'Step through the OLEObjects collection.
 For intCounter = 1 To vsoOLEObjects.Count
 Debug.Print vsoOLEObjects(intCounter).ProgID
 Next intCounter

End Sub


Document.Protection Property (Visio)

 Copy code hover
[image]

Document.Protection Property (Visio)
Send feedback

Published: July 16, 2012

Determines how a document is protected from user customization. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .Protection(bstrPassword)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
bstrPassword | Optional | Variant | Not used.

Return Value

VisProtection

Remarks

Beginning with Microsoft Office Visio 2003, the Protection property ignores the bstrPassword argument both when you get and when you set the value of the property.

This property is the equivalent of checking the Styles, Shapes, Preview, Backgrounds, and Master shapes boxes in the Protect Document dialog box (in the Drawing Explorer, right-click the drawing name, and then click Protect Document).

The value of the Protection property can be a combination of the following VisProtection constants.

Constant | Value
visProtectNone | &H0
visProtectStyles | &H1
visProtectShapes | &H2
visProtectMasters | &H4
visProtectBackgrounds | &H8
visProtectPreviews | &H10


Document.ReadOnly Property (Visio)

 Copy code hover
[image]

Document.ReadOnly Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether a file is open as read-only. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ReadOnly

expression A variable that represents a Document object.

Return Value

Integer


Document.RemovePersonalInformation Property (Visio)

 Copy code hover
[image]

Document.RemovePersonalInformation Property (Visio)
Send feedback

Published: July 16, 2012

Determines if personal information about a file is saved when the user saves the file in Microsoft Visio. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .RemovePersonalInformation

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

The personal information that can be saved with a file appears on the Summary tab of the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties). Alternatively, you can use various Automation properties, for example the Document.Creator property, to set this information.

Setting the RemovePersonalInformation property is equivalent to setting the Remove personal information from file properties on save option under Document-specific settings on the Privacy Options page of the Trust Center dialog box (click the File tab, click Options, click Trust Center, and then click Trust Center Settings).


Document.RightMargin Property (Visio)

 Copy code hover
[image]

Document.RightMargin Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the right margin, which is used when printing. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .RightMargin(UnitsNameOrCode)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Optional | Variant | The units to use when retrieving or setting the margin value.

Return Value

Double

Remarks

If UnitsNameOrCode is not provided, the RightMargin property will default to internal drawing units (inches).

The RightMargin property corresponds to the Right setting in the Print Setup dialog box (on the Design tab, click the Page Setup arrow, and then, on the Print Setup tab, click Setup).

You can specify UnitsNameOrCode as an integer or a string value. If the string is invalid, an error is generated. For example, the following statements all set UnitsNameOrCode to inches.

Document.RightMargin(visInches) = newValue

Document.RightMargin (65) = newValue

Document.RightMargin ("in") = newValue, where "in" can also be any of the alternate strings representing inches, such as "inch", "in.", or "intCounter".

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Automation constants for representing units are declared by the Visio type library in member VisUnitCodes.


Document.Saved Property (Visio)

 Copy code hover
[image]

Document.Saved Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether a document has any unsaved changes. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Saved

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

Use caution when setting the Saved property for a document to True. If you set the Saved property to True and a user, or another program, makes changes to the document before it is closed, those changes will be lost—Microsoft Visio does not provide a prompt to save the document.

A document that contains embedded or linked OLE objects may report itself as unsaved even if the document's Saved property is set to True.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Saved property to determine whether a document has any unsaved changes. It also shows how to set the Saved property. Before running this macro, change path to the location where you want to save the drawing, and change filename to the name you'd like to assign the file.

VBA Copy code Copy code

Public Sub Saved_Example()

 Dim vsoDocument1 As Visio.Document
 Dim vsoDocument2 As Visio.Document
 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape

 Set vsoPage = ThisDocument.Pages(1)
 Set vsoShape = vsoPage.DrawOval(2.5, 7, 3.5, 9)

 'Use the SaveAs method to save the document for the first time.
 ThisDocument.SaveAs "path\filename.vsd"

 'Use the Saved property to verify that the document was saved.
 'Saved returns True (-1).
 Debug.Print ThisDocument.Saved

 'Force a change to the document by adding a shape.
 Set vsoShape = vsoPage.DrawOval(4, 7, 5, 9)

 'Use the Saved property to verify that the document changed
 'since the last time is was saved.
 'Saved returns False (0)
 Debug.Print ThisDocument.Saved

 'Use the Save method to save any new changes.
 ThisDocument.Save

 'Use the Saved property again to verify that
 'the document was saved. Saved returns True (-1).
 Debug.Print ThisDocument.Saved

 'The Saved property can also be set. For example, change
 'the document again so that the Saved property becomes False.
 Set vsoShape = vsoPage.DrawRectangle(1, 1, 7, 7)

 'Set the Saved property to True.
 'Setting the Saved property to True does not save the document.
 ThisDocument.Saved = True

 'Close the document and then reopen it. Note that
 'the rectangle was not saved.
 Set vsoDocument1 = ThisDocument
 vsoDocument1.Close
 Set vsoDocument1 = Documents.Open("path\filename.vsd")

End Sub


Document.SavePreviewMode Property (Visio)

 Copy code hover
[image]

Document.SavePreviewMode Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether and how a preview picture is saved in a file. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .SavePreviewMode

expression A variable that represents a Document object.

Return Value

VisSavePreviewMode

Remarks

The value of the SavePreviewMode property corresponds to the Save preview picture setting on the Summary tab of the Properties dialog box. (Click the File tab, click Info, click Properties, and then click Advanced Properties.) A preview of the first page appears in the Open dialog box. The value of SavePreviewMode can be one of the following VisSavePreviewMode constants. Selecting the Save preview mode checkbox is equivalent to setting the SavePreviewMode property to visSavePreviewDraft1st, which is the default.

Constant | Value | Description
visSavePreviewNone | 0 | No preview picture.
visSavePreviewDraft1st | 1 | The first page; includes only Visio shapes. Does not include embedded objects, text, or gradient fills.
visSavePreviewDetailed1st | 2 | The first page; includes all objects.


Document.ServerPublishOptions Property (Visio)

 Copy code hover
[image]

Document.ServerPublishOptions Property (Visio)
Send feedback

Published: July 16, 2012

Returns a ServerPublishOptions object that you can use to specify the settings to apply when you save a document as a Web drawing (as a .vdw file), then publish and use it on a Microsoft SharePoint site in conjunction with Visio Services. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ServerPublishOptions

expression A variable that represents a Document object.

Return Value

ServerPublishOptions


Document.SharedWorkspace Property (Visio)

 Copy code hover
[image]

Document.SharedWorkspace Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Microsoft Office SharedWorkspace object that provides access to the Office Document Workspace object model. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .SharedWorkspace

expression A variable that represents a Document object.

Return Value

Object

Remarks

The Office Document Workspace object model provides a way to put documents into a shared workspace and manipulate Microsoft SharePoint data such as people, tasks, links, and related files.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SharedWorkspace property to get a SharedWorkspace object and create a new shared document workspace that has the same name as the default document, at the default location.

VBA Copy code Copy code
Public Sub SharedWorkspace_Example

 Dim vsoSharedWorkspace As SharedWorkspace
 Set vsoSharedWorkspace = ActiveDocument.SharedWorkspace
 vsoSharedWorkspace.CreateNew ("")

End Sub


Document.SnapAngles Property (Visio)

 Copy code hover
[image]

Document.SnapAngles Property (Visio)
Send feedback

Published: July 16, 2012

Determines the degree of the angle that is drawn when isometric angle lines is chosen as a shape extension option. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .SnapAngles

expression A variable that represents a Document object.

Return Value

Double()

Remarks

The value of the SnapAngles property is equivalent to the value in the Isometric angles (degs) box on the Advanced tab of the Snap & Glue dialog box (click the Visual Aids arrow on the View tab).


Document.SnapEnabled Property (Visio)

 Copy code hover
[image]

Document.SnapEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether snap is active in the document. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .SnapEnabled

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

Setting the value of the SnapEnabled property to True is equivalent to selecting the Snap check box on the General tab in the Snap & Glue dialog box (click the Visual Aids arrow on the View tab).


Document.SnapExtensions Property (Visio)

 Copy code hover
[image]

Document.SnapExtensions Property (Visio)
Send feedback

Published: July 16, 2012

Determines the shape extensions that are active in a document. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .SnapExtensions

expression A variable that represents a Document object.

Return Value

VisSnapExtensions

Remarks

You can also set this value by checking options in the Shape extension options box on the Advanced tab of the Snap & Glue dialog box (click the Visual Aids arrow on the View tab).

The SnapExtensions property can be any combination of the following VisSnapExtensions constants, which are declared in the Visio type library. The default is to show center axes and linear extensions, &H22 (34).

Constant | Value
visSnapExtNone | &H0
visSnapExtAlignmentBoxExtension | &H1
visSnapExtCenterAxes | &H2
visSnapExtCurveTangent | &H4
visSnapExtEndpoint | &H8
visSnapExtMidpoint | &H10
visSnapExtLinearExtension | &H20
visSnapExtCurveExtension | &H40
visSnapExtEndpointPerpendicular | &H80
visSnapExtMidpointPerpendicular | &H100
visSnapExtEndpointHorizontal | &H200
visSnapExtEndpointVertical | &H400
visSnapExtEllipseCenter | &H800
visSnapExtIsometricAngles | &H1000


Document.SnapSettings Property (Visio)

 Copy code hover
[image]

Document.SnapSettings Property (Visio)
Send feedback

Published: July 16, 2012

Determines the objects that shapes snap to when snap is active in the document. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .SnapSettings

expression A variable that represents a Document object.

Return Value

VisSnapSettings

Remarks

The value of the SnapSettings property is equivalent to selecting check boxes under Snap to on the General tab of the Snap & Glue dialog box (click the Visual Aids arrow on the View tab).

The SnapSettings property can be any combination of the following VisSnapSettings constants, which are declared in the Visio type library.

Constant | Value | Description
visSnapToNone | &H0 | Snap to nothing.
visSnapToRulerSubdivisions | &H1 | Snap to tick marks on the ruler.
visSnapToGrid | &H2 | Snap to the grid.
visSnapToGuides | &H4 | Snap to guides.
visSnapToHandles | &H8 | Snap to selection handles.
visSnapToVertices | &H10 | Snap to vertices.
visSnapToConnectionPoints | &H20 | Snap to connection points.
visSnapToGeometry | &H100 | Snap to the visible edges of shapes.
visSnapToAlignmentBox | &H200 | Snap to the alignment box.
visSnapToExtensions | &H400 | Snap to shape extensions options.
visSnapToDisabled | &H8000 | Disable snap.
visSnapToIntersections | &H10000 | Snap to intersections.


Document.SolutionXMLElement Property (Visio)

 Copy code hover
[image]

Document.SolutionXMLElement Property (Visio)
Send feedback

Published: July 16, 2012

Contains solution-specific, well-formed XML data stored with a document. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .SolutionXMLElement(ElementName)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ElementName | Required | String | The case-sensitive name of the SolutionXML data element.

Return Value

String

Remarks

The value of ElementName must match the value of the SolutionXML element's Name attribute. For example, if a solution's XML data began with the statement <SolutionXML Name='somename'>, use the ElementName "somename" to retrieve that data.

  • If ElementName already exists, the SolutionXMLElement property overwrites existing XML data. Use the SolutionXMLElementExists property before writing XML data to avoid losing data unintentionally.

  • If ElementName does not exist, the SolutionXMLElement property creates an element by that name.

Because your XML data is validated when you write it, you will typically perform this operation during a DocumentSaved event for performance reasons.

At the document level, if the XML data you pass to the SolutionXMLElement property is well formed and contains a valid schema and namespace declaration, it is saved as nested XML within the Microsoft Visio VDX file format. If you pass invalid XML data, Visio converts this data to an XML comment so that the data is not lost. However, if you subsequently load the saved VDX file containing the comment into Visio, the XML comment will be ignored, and consequently the data will be lost.

If you put invalid or non-well-formed XML data into a cell, Visio saves it as a string in the cell so that it is not lost and can perhaps later be fixed.


Document.SolutionXMLElementCount Property (Visio)

 Copy code hover
[image]

Document.SolutionXMLElementCount Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of SolutionXML elements in a document. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .SolutionXMLElementCount

expression A variable that represents a Document object.

Return Value

Long

Remarks

The first element in the document has an index of 1.

The number of SolutionXML elements you can add to a document is limited only by the amount of available computer memory.


Document.SolutionXMLElementExists Property (Visio)

 Copy code hover
[image]

Document.SolutionXMLElementExists Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether a named SolutionXML element exists in the document. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .SolutionXMLElementExists(ElementName)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ElementName | Required | String | The case-sensitive name of the SolutionXML element.

Return Value

Boolean

Remarks

Because the SolutionXMLElement property can overwrite existing XML data, always use the SolutionXMLElementExists property to verify whether ElementName already exists in the document.


Document.SolutionXMLElementName Property (Visio)

 Copy code hover
[image]

Document.SolutionXMLElementName Property (Visio)
Send feedback

Published: July 16, 2012

Returns the name of the SolutionXML element. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .SolutionXMLElementName(Index)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index of the SolutionXML element in the document.

Return Value

String

Remarks

The only way to retrieve SolutionXML data is by name. You can use the SolutionXMLElementName property to get the element name to pass to the SolutionXMLElement property.


Document.Stat Property (Visio)

 Copy code hover
[image]

Document.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Document object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Document.Styles Property (Visio)

 Copy code hover
[image]

Document.Styles Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Styles collection for a document. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Styles

expression A variable that represents a Document object.

Return Value

Styles

Example

The following macro shows how to use the Styles property to add Style objects to the Styles collection. It shows how to add a new style based on an existing style as well as how to add a new style created from scratch.

VBA Copy code Copy code

Public Sub Styles_Example()

 Dim vsoDocument As Visio.Document
 Dim vsoStyles As Visio.Styles
 Dim vsoStyle As Visio.Style

 'Add a document based on the Basic Diagram template.
 Set vsoDocument = Documents.Add("Basic Diagram.vst")

 'Add a style named "My FillStyle" to the Styles collection.
 'This style is based on the style Basic Shadow and includes
 'only a Fill style.
 Set vsoStyles = vsoDocument.Styles
 Set vsoStyle = vsoStyles.Add("My FillStyle", "Basic Shadow", 0, 0, 1)

 'Add a style named "My NoStyle" to the Styles collection.
 'This style is not based on an existing style and includes
 'Text, Line, and Fill styles.
 Set vsoStyle = vsoStyles.Add("My NoStyle", "", 1, 1, 1)

End Sub


Document.Subject Property (Visio)

 Copy code hover
[image]

Document.Subject Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the value of the Subject field in a document's properties. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Subject

expression A variable that represents a Document object.

Return Value

String

Remarks

Setting the Subject property is equivalent to entering information in the Subject box in the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties).

Security note Security Note
Use this feature with caution. Sensitive or confidential information could be revealed to other users.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Subject property to document the subject of a drawing. It adds a Document object to the Documents collection and sets the Document object's Subject property as well as other document properties.

Before running this macro, substitute your own values for the items in italic in the following code. To verify that these properties have been set, open the Properties dialog box.

VBA Copy code Copy code

Public Sub Subject_Example()

    Dim vsoDocument As Visio.Document

    Set vsoDocument = Documents.Add("")

    'Set the properties of the document.
    vsoDocument.Title = "document title"
    vsoDocument.Creator = "author name"
    vsoDocument.Description = "document description"
    vsoDocument.Keywords = "keyword1, keyword2, keyword3"
    vsoDocument.Subject = "document subject"
    vsoDocument.Manager = "manager name"
    vsoDocument.Category = "document category"

End Sub


Document.Sync Property (Visio)

 Copy code hover
[image]

Document.Sync Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Microsoft Office Sync object that provides information about the status of the active document in a shared workspace and the ability to perform a set of actions. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Sync

expression A variable that represents a Document object.

Return Value

Object

Remarks

If the Sync object is unavailable because the synchronization engine fails to respond, the following error message is displayed: "The synchronization engine is not available."

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Sync property to get a Sync object and get the status of the active document in a shared workspace.

VBA Copy code Copy code
Public Sub Sync_Example

 Dim vsoSync As Sync
 Dim currentStatus As Integer

 Set vsoSync = ActiveDocument.Sync
 currentStatus = vsoSync.Status

 If currentStatus = msoSyncStatusLatest

 Msgbox "You have the most up-to-date copy."

 Else

 Msgbox "You need to update."

 End if

End Sub


Document.Template Property (Visio)

 Copy code hover
[image]

Document.Template Property (Visio)
Send feedback

Published: July 16, 2012

Returns the name of the template from which the document was created. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Template

expression A variable that represents a Document object.

Return Value

String

Remarks

If the document is based on no template, the Template property returns an empty string (''").

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Template property to get the name of the template from which the document was created.

VBA Copy code Copy code

Public Sub Template_Example()

 Dim strTemplateName As String

 strTemplateName = ThisDocument.Template

 'Verify that the proper string was returned.
 Debug.Print strTemplateName

End Sub


Document.Time Property (Visio)

 Copy code hover
[image]

Document.Time Property (Visio)
Send feedback

Published: July 16, 2012

Returns the most recently recorded date and time. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .Time

expression A variable that represents a Document object.

Return Value

Date

Remarks

The Time property is updated whenever any values are updated in the following: the TimeEdited property, the TimePrinted property, the TimeCreated property, the TimeSaved property, or the NOW function.

In the Date type, the value to the left of the decimal point represents the date, and the value to the right of the decimal point represents the time. For example, the Date value 38000.75 represents 6:00 P.M. on January 14, 2004.

If you convert a Date value to the String type, the date is rendered according to the short date format recognized by your computer. Times are displayed according to the time format (either 12-hour or 24-hour) recognized by your computer.


Document.TimeCreated Property (Visio)

 Copy code hover
[image]

Document.TimeCreated Property (Visio)
Send feedback

Published: July 16, 2012

Returns the date and time the document was created. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .TimeCreated

expression A variable that represents a Document object.

Return Value

Date

Remarks

In the Date type, the value to the left of the decimal point represents the date, and the value to the right of the decimal point represents the time. For example, the Date value 38000.75 represents 6:00 P.M. on January 14, 2004.

If you convert a Date value to the String type, the date is rendered according to the short date format recognized by your computer. Times are displayed according to the time format (either 12-hour or 24-hour) recognized by your computer.


Document.TimeEdited Property (Visio)

 Copy code hover
[image]

Document.TimeEdited Property (Visio)
Send feedback

Published: July 16, 2012

Returns the date and time the document was last edited. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .TimeEdited

expression A variable that represents a Document object.

Return Value

Date

Remarks

In the Date type, the value to the left of the decimal point represents the date, and the value to the right of the decimal point represents the time. For example, the Date value 38000.75 represents 6:00 P.M. on January 14, 2004.

If you convert a Date value to the String type, the date is rendered according to the short date format recognized by your computer. Times are displayed according to the time format (either 12-hour or 24-hour) recognized by your computer.


Document.TimePrinted Property (Visio)

 Copy code hover
[image]

Document.TimePrinted Property (Visio)
Send feedback

Published: July 16, 2012

Returns the date and time the document was last printed. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .TimePrinted

expression A variable that represents a Document object.

Return Value

Date

Remarks

In the Date type, the value to the left of the decimal point represents the date, and the value to the right of the decimal point represents the time. For example, the Date value 38000.75 represents 6:00 P.M. on January 14, 2004.

If you convert a Date value to the String type, the date is rendered according to the short date format recognized by your computer. Times are displayed according to the time format (either 12-hour or 24-hour) recognized by your computer.


Document.TimeSaved Property (Visio)

 Copy code hover
[image]

Document.TimeSaved Property (Visio)
Send feedback

Published: July 16, 2012

Returns the date and time the document was last saved. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .TimeSaved

expression A variable that represents a Document object.

Return Value

Date

Remarks

In the Date type, the value to the left of the decimal point represents the date, and the value to the right of the decimal point represents the time. For example, the Date value 38000.75 represents 6:00 P.M. on January 14, 2004.

If you convert a Date value to the String type, the date is rendered according to the short date format recognized by your computer. Times are displayed according to the time format (either 12-hour or 24-hour) recognized by your computer.


Document.Title Property (Visio)

 Copy code hover
[image]

Document.Title Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the value of the Title field in a document's properties. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Title

expression A variable that represents a Document object.

Return Value

String

Remarks

Setting the Title property is equivalent to entering information in the Title box in the Properties dialog box (click the File tab, click Info, click Document Properties, and then click Advanced Properties).

Security note Security Note
Use this feature with caution. Sensitive or confidential information could be revealed to other users.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Title property to set the title of a drawing. It adds a Document object to the Documents collection and sets the Document object's Title property as well as other document properties.

Before running this macro, substitute your own values for the items in italic in the following code. To verify that these properties have been set, open the Properties dialog box.

VBA Copy code Copy code

Public Sub Title_Example()

    Dim vsoDocument As Visio.Document

    Set vsoDocument = Documents.Add("")

    'Set the properties of the document.
    vsoDocument.Title = "document title"
    vsoDocument.Creator = "author name"
    vsoDocument.Description = "document description"
    vsoDocument.Keywords = "keyword1, keyword2, keyword3"
    vsoDocument.Subject = "document subject"
    vsoDocument.Manager = "manager name"
    vsoDocument.Category = "document category"

End Sub


Document.TopMargin Property (Visio)

 Copy code hover
[image]

Document.TopMargin Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the top margin when printing a document. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TopMargin(UnitsNameOrCode)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
UnitsNameOrCode | Optional | Variant | The units to use when retrieving or setting the margin value.

Return Value

Double

Remarks

If UnitsNameOrCode is not provided, the TopMargin property will default to internal drawing units (inches).

The TopMargin property corresponds to the Top setting in the Print Setup dialog box (on the Design tab, click the Page Setup arrow, and then click Setup on the Print Setup tab).

Units can be an integer or string value such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Visio units such as centimeters, meters, miles, and so on. You can also use any of the units constants declared by the Visio type library in VisUnitCodes.

For a list of valid integer and string values, see About Units of Measure.


Document.Type Property (Visio)

 Copy code hover
[image]

Document.Type Property (Visio)
Send feedback

Published: July 16, 2012

Returns the type of the Document object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Type

expression A variable that represents a Document object.

Return Value

VisDocumentTypes

Remarks

Type value constants for Document objects (the possible values that the Type property of a Document object returns) are declared by the Visio type library in VisDocumentTypes.


Document.UndoEnabled Property (Visio)

 Copy code hover
[image]

Document.UndoEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether undo information is maintained in memory. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .UndoEnabled

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

When Microsoft Visio starts, the value of the UndoEnabled property is True. Setting the value of the UndoEnabled property to False discontinues the collection of undo information in memory and clears the existing undo information.

You should attempt to maintain the property at its current value across the complete operation that you perform. In other words, use code structured like this:

VBA Copy code Copy code
blsPrevious = Application.UndoEnabled
Application.UndoEnabled = False

'Large operation here
Application.UndoEnabled = blsPrevious

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the UndoEnabled method to disable and then re-enable undo behavior in Visio.

VBA Copy code Copy code
Public Sub UndoEnabled_Example()

 'Disable undo
 Application.UndoEnabled = False

 'Draw three shapes.
 ActivePage.DrawRectangle 1, 2, 2, 1
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Enable undo.
 Application.UndoEnabled = True

End Sub


Document.UserCustomUI Property (Visio)

 Copy code hover
[image]

Document.UserCustomUI Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the Ribbon XML string that is passed to the document to customize the Quick Access toolbar or the Ribbon. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .UserCustomUI

expression A variable that represents a Document object.

Remarks

When you set the UserCustomUI property value, Microsoft Visio does not validate the Ribbon XML. Instead, the XML is persisted in the document file and validated the next time that the document is loaded.


Document.Validation Property (Visio)

 Copy code hover
[image]

Document.Validation Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Validation object that is associated with the document. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Validation

expression A variable that represents a Document object.

Return Value

Validation


Document.VBProject Property (Visio)

 Copy code hover
[image]

Document.VBProject Property (Visio)
Send feedback

Published: July 16, 2012

Returns an automation object that you can use to control the Microsoft Visual Basic for Applications (VBA) project of the document. Read-only.

Version Information

Version Added: Visio 4.5

Syntax

expression .VBProject

expression A variable that represents a Document object.

Return Value

Object

Remarks

To get information about the object returned by the VBProject property, follow these steps:

To get information about the object returned by the VBProject property

  1. In the Code group on the Developer tab, click Visual Basic.

  2. In the Visual Basic Editor, on the Tools menu, click References.

  3. In the References dialog box, click Microsoft Visual Basic for Applications Extensibility 5.3, and then click OK.

  4. On the View menu, click Object Browser.

  5. In the Project/Library list, select the VBIDE type library.

  6. In the Classes list, examine the class named VBProject.

If no VBA project already exists in the document, the VBProject property creates one.

Beginning with Visio 2002, the VBProject property raises an exception if you are running in a security-enhanced environment and your system administrator has blocked access to the Visual Basic object model. There is no user interface or programmatic way to turn this on—the system administrator must turn on (or off) access by setting a Group Policy. This helps protect against viruses that spread by accessing the Visual Basic projects in commonly used templates and injecting the virus code into them.

Example

This VBA macro shows how to print the names of libraries referenced by a VBA project in the Immediate window.

Before running this code, make sure the Trust access to the VBA project object model check box is selected under Developer Macro Settings on the Macro Settings page of the Trust Center dialog box (click the File tab, click Options, click Trust Center, and then click Trust Center Settings).

VBA Copy code Copy code
Public Sub VBProject_Example()

    Dim varThisProject As Variant
    Dim intReferences As Integer

    Set varThisProject = ThisDocument.VBProject

    intReferences = varThisProject.References.Count
    While intReferences > 0
        Debug.Print varThisProject.References(intReferences).Name
        intReferences = intReferences - 1
    Wend

End Sub


Document.VBProjectData Property (Visio)

 Copy code hover
[image]

Document.VBProjectData Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Microsoft Visual Basic project data stored with a document. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .VBProjectData

expression A variable that represents a Document object.

Return Value

Byte()

Example

You can use the VBProjectData property to determine whether a document has a project. The following macro shows how to get a reference to a document in Microsoft Visio to determine whether the document has a project. The code runs from a program outside the Visio document.

VBA Copy code Copy code
Private Sub Form_Load()

 'Declare document variable
 'and Array variable to hold project data.
 Dim vsoDocument As Visio.Document
 Dim btProjectData() As Byte

 'Get the first object in the Documents collection
 'of this instance of Visio.
 Set vsoDocument = GetObject(, "Visio.Application").Documents(1)

 'Populate the array with project data.
 btProjectData = vsoDocument.VBProjectData
 Debug.Print LBound(btProjectData); UBound(btProjectData)

End Sub

If the document had no project associated with it, "0 -1" would be reported in the Immediate window. If the document had a project, the upper bound would be some number greater than zero (0). For example, "0 1535" would indicate that a project had 1,536 bytes of data.


Document.Version Property (Visio)

 Copy code hover
[image]

Document.Version Property (Visio)
Send feedback

Published: July 16, 2012

Gets the version of a saved document or sets the version in which to save a document. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Version

expression A variable that represents a Document object.

Return Value

VisDocVersions

Remarks

Setting the Version property of a document tells Microsoft Visio which file format version to save the document in the next time the document is saved. The Visio type library declares constants for file format versions in VisDocVersions.

Microsoft Visio can save a document in the following file format versions. Note that there are two constants, visVersion120 and visVersion110, that have identical values.

Constant | Value | Description
visVersion60 | &H60000 | Visio 2000 or Visio 2002 document
visVersion110 | &HB0000 | Visio 2003 or Visio 2007 document
visVersion120 | &HB0000 | Visio 2003 or Visio 2007 document

When Visio opens a document that was saved in an earlier version format, it converts the document's in-memory representation to the current version. However, when closing the document, Visio recognizes that the document was saved in an earlier version format and allows the user to choose the version in which to save the document.


Document.ZoomBehavior Property (Visio)

 Copy code hover
[image]

Document.ZoomBehavior Property (Visio)
Send feedback

Published: July 16, 2012

Determines the zoom behavior for a Microsoft Visio document or window. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .ZoomBehavior

expression A variable that represents a Document object.

Return Value

VisZoomBehavior

Remarks

To set the zoom behavior for all new documents and windows, use the DefaultZoomBehavior property.

The following constants declared by the Visio type library in VisZoomBehavior are valid values forZoomBehavior.

Constant | Value | Description
visZoomNone | 0 | Undefined zoom behavior; use the zoom behavior of the document or application. This is the default.
visZoomInPlaceContainer | 1 | The container performs the zoom.
visZoomVisio | 2 | Visio performs the zoom.
visZoomVisioExact | 4 | Visio zooms when open in place; Visio does not adjust the zoom level

If ZoomBehavior is set to visZoomVisio, Visio adjusts the zoom level to certain discrete values, for example 50% or 100%, to optimize the appearance of the page rulers and grid, and of snap behavior.

If ZoomBehavior is set to visZoomInPlaceContainer, Visio uses the container's IOleCommandTarget interface to perform the zoom and forces a fit-to-window zoom within the in-place window. If the container does not support IOleCommandTarget, no zooming occurs.

If ZoomBehavior is set to visZoomVisioExact, you can set the zoom to any value, either by using the Window.Zoom property or by using the Zoom slider in the Visio user interface.

Note Note

The default behavior (visZoomNone) is different from the behavior used in versions earlier than Visio 2002. (In Visio 2002, the default was visZoomVisio.) To replicate the behavior seen in earlier versions, set this value to visZoomInPlaceContainer.

Example

The following procedure shows how to set the Document.ZoomBehavior property to the value that replicates Visio 2000 behavior.

VBA Copy code Copy code
Sub ZoomBehavior_Example()

 ActiveDocument.ZoomBehavior = visZoomInPlaceContainer

End Sub


Document Methods (Visio)

 Copy code hover
[image]

Document Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddUndoUnit | Adds an object that supports the IOleUndoUnit or IVBUndoUnit interface to the Microsoft Visio undo queue.
BeginUndoScope | Starts a transaction with a unique scope ID for an instance of Microsoft Visio.
CanCheckIn | Specifies whether a document can be checked into a Microsoft SharePoint Server computer.
CanUndoCheckOut | Determines whether a Microsoft Visio document is checked out from a Microsoft SharePoint Server site, so that if it is, the check-out can be subsequently undone.
CheckIn | Returns a document from a local computer to a Microsoft SharePoint Server computer.
Clean | Examines, reports, and repairs selected conditions in a document.
ClearCustomMenus | Restores the built-in Microsoft Visio user interface.
ClearCustomToolbars | Restores the built-in Microsoft Visio user interface.
ClearGestureFormatSheet | Clears local formatting in a document's Gesture Format sheet.
Close | Closes a document.
CopyPreviewPicture | Copies the preview picture from another document into the current document.
DeleteSolutionXMLElement | Deletes the named SolutionXML element.
Drop | Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.
EndUndoScope | Ends or cancels a transaction that has a unique scope.
ExecuteLine | Executes a line of Microsoft Visual Basic code.
ExportAsFixedFormat | Exports a Microsoft Visio document as a file in a fixed format, either PDF or XPS.
FollowHyperlink | Navigates to an arbitrary hyperlink.
GetThemeNames | Returns a locale-specific array of names of themes contained in the document.
GetThemeNamesU | Returns a locale-independent array of names of themes contained in the document.
OpenStencilWindow | Opens a stencil window that shows the masters in the document.
ParseLine | Parses a line of Microsoft Visual Basic code.
Print | Prints the contents of an object to the default printer.
PrintOut | Prints the contents of the active document and provides various printing options.
PurgeUndo | Empties the Microsoft Visio queue of undo actions.
RemoveHiddenInformation | Removes hidden information, such as personal information and external data, from a Microsoft Visio document.
RenameCurrentScope | Renames the top-level open undo scope.
Save | Saves a document.
SaveAs | Saves a document and gives it a file name.
SaveAsEx | Saves a document with a file name using extra information passed in an argument.
SetCustomMenus | Replaces the current built-in or custom menus of an application or document.
SetCustomToolbars | Replaces the current built-in or custom toolbars of an application or document.
UndoCheckOut | Closes a Microsoft Visio document checked out from a Microsoft SharePoint Server site, deletes the local copy of the document, discarding any changes, undoes the checkout, and then reopens the document.


Document.AddUndoUnit Method (Visio)

 Copy code hover
[image]

Document.AddUndoUnit Method (Visio)
Send feedback

Published: July 16, 2012

Adds an object that supports the IOleUndoUnit or IVBUndoUnit interface to the Microsoft Visio undo queue.

Version Information

Version Added: Visio 2000

Syntax

expression .AddUndoUnit(pUndoUnit)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
pUndoUnit | Required | [UNKNOWN] | A reference to an object that supports the IOleUndoUnit or IVBUndoUnit interface.

Return Value

Nothing

Remarks

For information about implementing the IOleUndoUnit interface on your object, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network. For information about implementing the IVBUndoUnit interface, see Developing Microsoft Visio Solutions on MSDN.

Example

The following procedure shows how to use the AddUndoUnit method to add an object to the Visio undo queue. When a shape is added to the active document, the procedure checks to see if it was added as a result of an undo or redo action, and if not, it adds an Undo unit.

This procedure is a member of class clsParticipateInUndo, which is defined in one of two related class modules in the Code Samples Library in the Visio SDK, and is not intended to be run independently. (The other class module defines class clsVBUndoUnits.) For more information on these class modules, see the Visio SDK on MSDN.

VBA Copy code Copy code

Private Sub mvsoDocument_ShapeAdded(ByVal vsoShape As IVShape)

 Dim VBUndoUnit As clsVBUndoUnits

 On Error GoTo mvsoDocument_ShapeAdded_Err

 If Not (mvsoApplication Is Nothing) Then

 If Not msvoApplication.IsUndoingOrRedoing Then

 'Increment the count of undoable actions.
 IncrementModuleVar
 Debug.Print "Original Do: GetModuleVar = " & GetModuleVar

 'Instantiate clsVBUndoUnit, a
 'class that implements Visio.IVBUndoUnit.
 Set VBUndoUnit = New clsVBUndoUnits

 'Pass the current instance of the class
 'of which this procedure is a member,
 'clsParticipateInUndo, to the Undo unit.
 VBUndoUnit.SetModelObject Me

 'Add an Undo unit.
 mvsoApplication.AddUndoUnit VBUndoUnit

 End If

 End If

Exit Sub

mvsoDocument_ShapeAdded_Err:

 MsgBox Err.Description

End Sub


Document.BeginUndoScope Method (Visio)

 Copy code hover
[image]

Document.BeginUndoScope Method (Visio)
Send feedback

Published: July 16, 2012

Starts a transaction with a unique scope ID for an instance of Microsoft Visio.

Version Information

Version Added: Visio 2000

Syntax

expression .BeginUndoScope(bstrUndoScopeName)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
bstrUndoScopeName | Required | String | The name of the scope; could appear in the Visio user interface.

Return Value

Long

Remarks

If you need to know whether events you receive are the result of a particular operation that you initiated, use the BeginUndoScope and EndUndoScope methods to wrap your operation. In your event handlers, use the IsInScope property to test whether the scope ID returned by the BeginUndoScope method is part of the current context. Make sure you clear the scope ID you stored from the BeginUndoScope property when you receive the ExitScope event with that ID.

You must balance calls to the BeginUndoScope method with calls to the EndUndoScope method. If you call the BeginUndoScope method, you should call the EndUndoScope method as soon as you are finished with the actions that constitute your scope. Also, while actions to multiple documents should be robust within a single scope, closing a document may have the side effect of clearing the undo information for the currently open scope as well as clearing the undo and redo stacks. If that happens, passing bCommit = False to EndUndoScope does not restore the undo information.

You can also use the BeginUndoScope and EndUndoScope methods to add an action defined by an add-on to the Visio undo stream. This is useful when you are operating from modeless scenarios where the initiating agent is part of an add-on's user interface or a modeless programmatic action.

Note Note

Most Visio actions are already wrapped in internal undo scopes, so add-ons running within the application do not need to call this method.

Example

This example shows how to use the BeginUndoScope method to start a transaction that has a unique scope ID for an instance of Visio.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application
Private lngScopeID As Long

Public Sub BeginUndoScope_Example()

 Dim vsoShape As Visio.Shape

 'Set the module-level application variable to
 'trap application-level events.
 Set vsoApplication = Application

 'Begin a scope and set the module-level scope ID variable.
 lngScopeID = Application.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell to trigger the CellChanged event.
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 Application.EndUndoScope lngScopeID, True

 End Sub

 Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering my scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting my scope " & nScopeID
 Else
 Debug.Print "Exit Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


Document.CanCheckIn Method (Visio)

 Copy code hover
[image]

Document.CanCheckIn Method (Visio)
Send feedback

Published: July 16, 2012

Specifies whether a document can be checked into a Microsoft SharePoint Server computer.

Version Information

Version Added: Visio 2002 SR-1

Syntax

expression .CanCheckIn

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

You cannot check in a file that is not in a checked-out state or stored in a document library on a computer running Microsoft SharePoint Server or Microsoft SharePoint Foundation.

Example

This example checks the server to see if the specified document can be checked in, and if it can, checks it back into the server.

VBA Copy code Copy code

Sub CheckDocIn (varDocCheckIn As Variant)

 If Documents.Item(varDocCheckIn).CanCheckIn = True Then
 Documents.Item(varDocCheckIn).CheckIn
 MsgBox varDocCheckIn & " has been checked in."
 Else
 MsgBox "This file cannot be checked in " & _
 "at this time. Please try again later."
 End If
End Sub

To call the preceding CheckDocIn subroutine, use the following subroutine and replace servername/workspace/drawing.vdx with the path to and name of an actual file located on a Microsoft SharePoint Server computer.

VBA Copy code Copy code

Sub DocIn()
 Call CheckDocIn _
 (varDocCheckIn:="http://servername/workspace/drawing.vdx")
End Sub


Document.CanUndoCheckOut Method (Visio)

 Copy code hover
[image]

Document.CanUndoCheckOut Method (Visio)
Send feedback

Published: July 16, 2012

Determines whether a Microsoft Visio document is checked out from a Microsoft SharePoint Server site, so that if it is, the check-out can be subsequently undone.

Version Information

Version Added: Visio 2007

Syntax

expression .CanUndoCheckOut

expression An expression that returns a Document object.

Return Value

Boolean

Remarks

The CanUndoCheckOut method is similar to the Document.CanCheckIn method.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the CanUndoCheckOut method to determine if the checkout of the active document from a SharePoint server site can be undone. Before running this macro, check out a Visio document from a SharePoint Server site.

VBA Copy code Copy code
Public Sub CanUndoCheckOut_Example

    Dim boolCanUndo As Boolean
    boolCanUndo = Visio.ActiveDocument.CanUndoCheckOut

    Debug.Print boolCanUndo

End Sub


Document.CheckIn Method (Visio)

 Copy code hover
[image]

Document.CheckIn Method (Visio)
Send feedback

Published: July 16, 2012

Returns a document from a local computer to a Microsoft SharePoint Server computer.

Version Information

Version Added: Visio 2002 SR-1

Syntax

expression .CheckIn(SaveChanges, Comments, MakePublic)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Boolean | True (non-zero) to save document changes before check-in; False (0) to check the document in without saving changes. The default is True.
Comments | Optional | Variant | Any comments to be stored with this revision of the document (applies only if SaveChanges equals True).
MakePublic | Optional | Boolean | True to publish the document after check-in. This submits the document for the approval process or, if there is no approval routing for the document, a public version is created that is available to readers of the folder (applies only if SaveChanges equals True); False leaves the document available only for private viewing. The default is False.

Return Value

Nothing

Remarks

To check in a file, it must be stored in a document library on a computer running Microsoft SharePoint Server or Microsoft SharePoint Foundation.

After the document has been checked in using the CheckIn method, the document is closed. This behavior is different from the user interface; when you check in a document in the user interface, the document is closed and re-opened as read-only.

Example

This example checks the server to see if the specified document can be checked in. If it can, this example saves and closes the document, and then checks it back into the server.

VBA Copy code Copy code
Sub CheckDocIn(varDocCheckIn As Variant)

    If Documents.Item(varDocCheckIn).CanCheckin = True Then
        Documents.Item(varDocCheckIn).CheckIn
        MsgBox varDocCheckIn & " has been checked in."
    Else
        MsgBox "This file cannot be checked in " _
            & "at this time. Please try again later."
    End If

End Sub

To call the preceding CheckDocIn subroutine, use the following subroutine and replace servername/workspace/drawing.vdx with the path to and name of an actual file located on a Microsoft SharePoint Server computer.

VBA Copy code Copy code
Sub DocIn()

    Call CheckDocIn _
        (varDocCheckIn:="http://servername/workspace/drawing.vdx")

End Sub


Document.Clean Method (Visio)

 Copy code hover
[image]

Document.Clean Method (Visio)
Send feedback

Published: July 16, 2012

Examines, reports, and repairs selected conditions in a document.

Version Information

Version Added: Visio 2002

Syntax

expression .Clean(nTargets, nActions, nAlerts, nFixes, bStopOnError, bLogFileName, nReserved)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
nTargets | Optional | Variant | Indicates which parts of the document to examine. See Remarks for possible values.
nActions | Optional | Variant | Indicates which conditions to detect. See Remarks for possible values.
nAlerts | Optional | Variant | Indicates which detected conditions to report. See Remarks for possible values.
nFixes | Optional | Variant | Indicates which detected conditions to fix. See Remarks for possible values.
bStopOnError | Optional | Variant | Non-zero (True) to cause processing to stop if an error is encountered while attempting to fix a detected condition; zero (False) to allow processing to continue.
bLogFileName | Optional | Variant | Reserved for future use.
nReserved | Optional | Variant | Reserved for future use.

Return Value

Nothing

Remarks

Internal Microsoft Visio developers use the Clean method to validate and optimize the documents provided with Visio; third-party developers can use this method on their own documents.

It is suggested that developers use default values for nTargets, nActions, nAlerts, and nFixes, and make a backup copy of a document before it is cleaned.

You can identify document changes made by the Clean method by comparing saved VDX (XML) versions of the document, one version saved before the Clean method executes, and the other after.

The nTargets argument can be any combination of the values of the constants defined in VisDocCleanTargets in the Visio type library, and described in the following table.

Constant | Value | Description
visDocCleanTargAll | &HFF | Examine all objects (default for nTargets).
visDocCleanTargFPages | &H1 | Examine foreground pages.
visDocCleanTargBPages | &H2 | Examine background pages.
visDocCleanTargMasters | &H4 | Examine masters.
visDocCleanTargStyles | &H8 | Examine styles.
visDocCleanTargDoc | &H10 | Examine document sheet.
visDocCleanTargPageSheet | &H100 | Examine page sheet(s).

The nActions, nAlerts, and nFixes arguments can be any combination of the values of the constants defined in VisDocCleanActions in the Visio type library, and described in the following table.

Constant | Value | Description
visDocCleanActLocalFormulas | &H1 | Detect unnecessary local overrides.
visDocCleanActEmptyRowsAndSects | &H2 | Detect empty local rows and sections.
visDocCleanActNonDefaultFonts | &H4 | Detect non-default font settings.
visDocCleanActStaleResults | &H8 | Detect results that don't match formulas.
visDocCleanActMissingSubs | &H10 | Detect missing subscriptions (cell dependencies).
visDocCleanActConstantFormulas | &H20 | Detect formulas that can be generated from the result.
visDocCleanActNearZero | &H40 | Detect results that are almost zero and change them to zero.
visDocCleanActDuplicateSubs | &H80 | Detect duplicate subscriptions (cell dependencies).
visDocCleanActBadDisplayLists | &H100 | Detect invalid display list linkages.
visDocCleanActDeletedFields | &H400 | Detect deleted fields.
visDocCleanActBadFieldFormulas | &H800 | Detect fields with missing or nonstandard formulas.
visDocCleanActBadFieldMarks | &H1000 | Detect fields with out-of-sync count and marker values. Change the position of escape characters to match character counts.
visDocCleanActBadReferences | &H2000 | Detect formulas with #Ref() errors.
visDocCleanActAll | &H3FFF | Perform all actions.
visDocCleanActDefault | &H1FD8 | Default conditions to detect (default value of nActions).
visDocCleanAlertDefault | &H0 | Default conditions to report (default value of nAlerts).
visDocCleanFixDefault | &H3D8 | Default conditions to fix (default value for nFixes).

Example

The following procedure demonstrates one use of the Clean method. In this case, the line pattern of a rectangle is overridden with the same value as it originally inherited, which creates an unnecessary local override. The Clean method is then executed, which detects the condition and posts an alert allowing the user to choose whether to fix the condition or not.

  1. Create a new blank drawing.

  2. Use the Rectangle tool to draw a rectangle on the drawing page. If you view the shape in the ShapeSheet window, you can see that the color of the value ("1") in the LinePattern cell is black, indicating that the value is inherited.

  3. Right-click the shape, point to Format, click Line, and in the Line dialog box, reapply the same line pattern. This action creates a local value in the shape, or a local override. Now if you view the shape in the ShapeSheet window, you can see that the color of the value in the LinePattern cell is blue, indicating that the value is local.

  4. Insert the Clean_Example procedure shown below into your document's Microsoft Visual Basic for Applications project:

  5. Run the Clean_Example procedure (on the View tab, click Macros; then, in the Macros dialog box, in the list of macros, select ThisDocument.Clean_Example, and then click Run).

VBA Copy code Copy code

    Public Sub Clean_Example()

        ActiveDocument.Clean, visDocCleanActLocalFormulas, _
           visDocCleanActLocalFormulas, visDocCleanActLocalFormulas

    End Sub

Alerts appear on the drawing page asking whether you want to remove the unneeded local override. If you click Yes and then reopen the ShapeSheet window, you can see that the color of the value in the LinePattern cell is once again black, indicating that the inherited value has been restored.


Document.ClearCustomMenus Method (Visio)

 Copy code hover
[image]

Document.ClearCustomMenus Method (Visio)
Send feedback

Published: July 16, 2012

Restores the built-in Microsoft Visio user interface.

Version Information

Version Added: Visio 4.0

Syntax

expression .ClearCustomMenus

expression A variable that represents a Document object.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Calling the ClearCustomMenus method on an object without custom menus has no effect.

Example

This example shows how to clear custom menus for the ThisDocument and Application objects and restore the built-in Visio menus.

VBA Copy code Copy code

Public Sub ClearCustomMenus_Example()

 'Tell Visio to use the built-in menus.
 ThisDocument.ClearCustomMenus
 Visio.Application.ClearCustomMenus

End Sub


Document.ClearCustomToolbars Method (Visio)

 Copy code hover
[image]

Document.ClearCustomToolbars Method (Visio)
Send feedback

Published: July 16, 2012

Restores the built-in Microsoft Visio user interface.

Version Information

Version Added: Visio 4.0

Syntax

expression .ClearCustomToolbars

expression A variable that represents a Document object.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Calling the ClearCustomToolbars method on an object without custom toolbars has no effect.

Example

This example shows how to clear custom toolbars for the ThisDocument and Application objects and restore the built-in Microsoft Visio toolbars.

VBA Copy code Copy code

Public Sub ClearCustomToolbars_Example()

 'Tell Visio to use the built-in toolbars.
 ThisDocument.ClearCustomToolbars
 Visio.Application.ClearCustomToolbars

End Sub


Document.ClearGestureFormatSheet Method (Visio)

 Copy code hover
[image]

Document.ClearGestureFormatSheet Method (Visio)
Send feedback

Published: July 16, 2012

Clears local formatting in a document's Gesture Format sheet.

Version Information

Version Added: Visio 2000

Syntax

expression .ClearGestureFormatSheet

expression A variable that represents a Document object.

Return Value

Nothing

Remarks

Any shapes drawn after the Gesture Format sheet is cleared inherit their line, fill, and text formatting from the document's default styles.

A document's Gesture Format sheet also gets cleared automatically when the document is opened.

For details about the Gesture Format sheet, see the GestureFormatSheet property.


Document.Close Method (Visio)

 Copy code hover
[image]

Document.Close Method (Visio)
Send feedback

Published: July 16, 2012

Closes a document.

Version Information

Version Added: Visio 2.0

Syntax

expression .Close

expression A variable that represents a Document object.

Return Value

Nothing

Remarks

If the indicated window is the only window open for a document and the document contains unsaved changes, an alert appears asking if you want to save the document. You can use the AlertResponse property to prevent the alert from appearing.

If you close a docked stencil window, only that window is closed. However, if you close a drawing window that contains docked stencils, the docked stencil window is also closed.


Document.CopyPreviewPicture Method (Visio)

 Copy code hover
[image]

Document.CopyPreviewPicture Method (Visio)
Send feedback

Published: July 16, 2012

Copies the preview picture from another document into the current document.

Version Information

Version Added: Visio 2002

Syntax

expression .CopyPreviewPicture(pSourceDoc)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
pSourceDoc | Required | [IVDOCUMENT] | The Document object whose preview picture you want to copy into this document.

Return Value

Nothing


Document.DeleteSolutionXMLElement Method (Visio)

 Copy code hover
[image]

Document.DeleteSolutionXMLElement Method (Visio)
Send feedback

Published: July 16, 2012

Deletes the named SolutionXML element.

Version Information

Version Added: Visio 2002

Syntax

expression .DeleteSolutionXMLElement(ElementName)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ElementName | Required | String | The case-sensitive name of the SolutionXML data element.

Return Value

Nothing

Remarks

The ElementName parameter is case-sensitive and should match the name passed as a parameter to the SolutionXMLElement property.


Document.Drop Method (Visio)

 Copy code hover
[image]

Document.Drop Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Drop(ObjectToDrop, xPos, yPos)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | [UNKNOWN] | The object to drop. While this is typically a Visio object such as a Master, Shape, or Selection object, it can be any OLE object that provides an IDataObject interface.
xPos | Required | Integer | The x-coordinate at which to place the center of the shape's width or PinX.
yPos | Required | Integer | The y-coordinate at which to place the center of the shape's height or PinY.

Return Value

Master

Remarks

Using the Drop method is similar to moving a shape with the mouse. The object dropped (ObjectToDrop) can be a master or a shape on the drawing page.

If ObjectToDrop is a Master, the pin of the master is dropped at the specified coordinates. A master's pin is often, but not necessarily, at its center of rotation.

To create a new master in a stencil, apply the Drop method to a Document object that represents a stencil (the stencil must be opened as an original or a copy rather than read-only). In this case, the xPos and yPos arguments are ignored, and the new master that is created is returned.

Example

The following example shows how to use the Drop method to create a master by dropping a shape onto a Document object.

VBA Copy code Copy code

Public Sub Drop_Example()

    Dim vsoShape As Visio.Shape
    Dim vsoMaster As Visio.Master

    Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

    'Create a master in the document.
    'The master appears on the document stencil.
    Set vsoMaster = ActiveDocument.Drop(vsoShape,  0, 0)

End Sub


Document.EndUndoScope Method (Visio)

 Copy code hover
[image]

Document.EndUndoScope Method (Visio)
Send feedback

Published: July 16, 2012

Ends or cancels a transaction that has a unique scope.

Version Information

Version Added: Visio 2000

Syntax

expression .EndUndoScope(nScopeID, bCommit)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
nScopeID | Required | Long | The ID of the scope to close.
bCommit | Required | Boolean | flag indicating that the changes made during the scope should be accepted (True) or canceled (False).

Return Value

Nothing

Remarks

If you need to know whether events you receive are the result of a particular operation that you initiated, use the BeginUndoScope and EndUndoScope methods to wrap your operation. In your event handlers, use the IsInScope property to test whether the scope ID returned by the BeginUndoScope method is part of the current context. Make sure you clear the scope ID you stored from the BeginUndoScope property when you receive the ExitScope event with that ID.

You must balance calls to the BeginUndoScope method with calls to the EndUndoScope method. If you call the BeginUndoScope method, you should call the EndUndoScope method as soon as you are done with the actions that constitute your scope. Also, while actions to multiple documents should be robust within a single scope, closing a document may have the side effect of clearing the undo information for the currently open scope as well as clearing the undo and redo stacks. If that happens, passing bCommit = False to EndUndoScope does not restore the undo information.

You can also use the BeginUndoScope and EndUndoScope methods to add an action defined by an add-on to the Microsoft Visio undo stream. This is useful when you are operating from modeless scenarios where the initiating agent is part of an add-on's user interface or a modeless programmatic action.

Note Note

Most Visio actions are already wrapped in internal undo scopes, so add-ons running within the application do not need to call this method.

Example

This example shows how to use the EndUndoScope method to end a transaction that has a unique scope ID for an instance of Visio.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application
Private lngScopeID As Long

Public Sub EndUndoScope_Example()

 Dim vsoShape As Visio.Shape

 'Set the module-level application variable to
 'trap Application-level events.
 Set vsoApplication = Visio.Application

 'Begin a scope and set the module-level variable.
 lngScopeID = vsoApplication.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell to trigger a CellChanged event.
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 vsoApplication.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As
 String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering my scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting my scope " & nScopeID
 Else
 Debug.Print "Exit Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


Document.ExecuteLine Method (Visio)

 Copy code hover
[image]

Document.ExecuteLine Method (Visio)
Send feedback

Published: July 16, 2012

Executes a line of Microsoft Visual Basic code.

Version Information

Version Added: Visio 4.5

Syntax

expression .ExecuteLine(Line)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Line | Required | String | A string that will be interpreted as Microsoft Visual Basic for Applications (VBA) code.

Return Value

Nothing

Remarks

The VBA project of the Document object is told to execute the supplied string. VBA treats the string as it would treat the same string typed into its Immediate window.

Example

The following are some possible uses of the ExecuteLine method:

VBA Copy code Copy code

 'Executes the macro (procedure without an argument) named "SomeMacro"
 'that is in some module of the Visual Basic project of ThisDocument.
 ThisDocument.ExecuteLine("SomeMacro")

 'Executes the procedure named SomeProcedure and passes it 3 arguments.
 ThisDocument.ExecuteLine("SomeProcedure 1, 2, 3")

 'Same as previous example, but procedure name qualified
 'with module name.
 ThisDocument.ExecuteLine("Module1.SomeProcedure 1, 2, 3")

 'Shows the form UserForm1.
 ThisDocument.ExecuteLine("UserForm1.Show")

 'Prints "some string" to the Immediate window.
 ThisDocument.ExecuteLine("Debug.Print ""some string""")

 'Prints number of open documents to the Immediate window.
 ThisDocument.ExecuteLine("Debug.Print Documents.Count")

 'Tells ThisDocument to save itself.
 ThisDocument.ExecuteLine("ThisDocument.Save")


Document.ExportAsFixedFormat Method (Visio)

 Copy code hover
[image]

Document.ExportAsFixedFormat Method (Visio)
Send feedback

Published: July 16, 2012

Exports a Microsoft Visio document as a file in a fixed format, either PDF or XPS.

Version Information

Version Added: Visio 2007

Syntax

expression .ExportAsFixedFormat(FixedFormat, OutputFileName, Intent, PrintRange, FromPage, ToPage, ColorAsBlack, IncludeBackground, IncludeDocumentProperties, IncludeStructureTags, UseISO19005_1, FixedFormatExtClass)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
FixedFormat | Required | VisFixedFormatTypes | The format type in which to export the document. See Remarks for possible values.
OutputFileName | Optional | String | The name and path of the file to which to output, enclosed in quotation marks.
Intent | Required | VisDocExIntent | The output quality. See Remarks for possible values.
PrintRange | Required | VisPrintOutRange | The range of document pages to be exported. See Remarks for possible values.
FromPage | Optional | Long | If PrintRange is visPrintFromTo , the first page in the range to be exported. The default is 1, which indicates the first page of the drawing.
ToPage | Optional | Long | If PrintRange is visPrintFromTo , the last page in the range to be exported. The default is -1, which indicates the last page of the drawing.
ColorAsBlack | Optional | Boolean | True to render all colors as black to ensure that all shapes are visible in the exported drawing. False to render colors normally. The default is False.
IncludeBackground | Optional | Boolean | Whether to include background pages in the exported file. The default is True.
IncludeDocumentProperties | Optional | Boolean | Whether to include document properties in the exported file. The default is True.
IncludeStructureTags | Optional | Boolean | Whether to include document structure tags to improve document accessibility. The default is True.
UseISO19005_1 | Optional | Boolean | Whether the resulting document is compliant with ISO 19005-1 (PDF/A). The default is False.
FixedFormatExtClass | Optional | [UNKNOWN] | A pointer to a class that implements the IMsoDocExporter interface for purposes of creating custom fixed output. The default is a null pointer.

Return Value

Nothing

Remarks

The ExportAsFixedFormat method creates a file that contains a static view of the Visio document.

Possible values for the FixedFormat parameter are shown in the following table and declared in VisFixedFormatTypes in the Visio type library.

Constant | Value | Description
visFixedFormatPDF | 1 | PDF fixed format
visFixedFormatXPS | 2 | XPS fixed format

Possible values for the Intent parameter are shown in the following table and declared in VisDocExIntent in the Visio type library.

Constant | Value | Description
visDocExIntentPrint | 1 | Intended to be published online and printed
visDocExIntentScreen | 0 | Intended to be published only online

Possible values for the PrintRange parameter are shown in the following table and declared in VisPrintOutRange in the Visio type library.

Constant | Value | Description
visPrintAll | 0 | Prints all foreground pages.
visPrintCurrentPage | 2 | Prints the active page.
visPrintCurrentView | 4 | Prints the current view area.
visPrintFromTo | 1 | Prints pages between the FromPage value and the ToPage value.
visPrintSelection | 3 | Prints a selection.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ExportAsFixedFormat method to export the active Visio document to the root of the C drive in PDF format.

VBA Copy code Copy code
Public Sub ExportAsFixedFormat_Example()

    ActiveDocument.ExportAsFixedFormat visFixedFormatPDF, "C:\ExportedVisioDocument.pdf", visDocExIntentPrint, visPrintAll

End Sub


Document.FollowHyperlink Method (Visio)

 Copy code hover
[image]

Document.FollowHyperlink Method (Visio)
Send feedback

Published: July 16, 2012

Navigates to an arbitrary hyperlink.

Version Information

Version Added: Visio 5.0

Syntax

expression .FollowHyperlink(Address, SubAddress, ExtraInfo, Frame, NewWindow, res1, res2, res3)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Address | Required | String | The address to which you want to navigate. If you pass an incorrect or non-existent path or filename for Address, Visio displays an error message.
SubAddress | Required | String | The secondary address to which you want to navigate; if you don't need this information, pass an empty string. If Address is the full path of a Visio document that contains multiple pages, for example, you can use SubAddress to specify the page.
ExtraInfo | Optional | Variant | Extra URL request information to use in resolving the URL.
Frame | Optional | Variant | The HTML frame to which to navigate.
NewWindow | Optional | Variant | Specifies if a new window is to be opened. Passing any non-zero number or True opens the linked page in a new window.
res1 | Optional | Variant | Unused.
res2 | Optional | Variant | Unused.
res3 | Optional | Variant | Unused.

Return Value

Nothing

Remarks

If you don't need to pass any information for one or more optional arguments, from Microsoft Visual Basic or Visual Basic for Applications, do not pass a value. From C or C++, pass an empty variant.

Visio 4.5 provided an undocumented Hyperlink method for a Document object that had the following signature:

VBA Copy code Copy code
HRESULT FollowHyperlink[in] (BSTR Target, [in] BSTR Location);

Visio 5.0 and later still support this method but it has been renamed FollowHyperlink45:

VBA Copy code Copy code
HRESULT FollowHyperlink45[in] (BSTR Target, [in] BSTR Location);

Use of FollowHyperlink45 is discouraged, however—unless you are using version 4.5, use FollowHyperlink instead.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the FollowHyperlink method to navigate to a site on the Internet and view the resulting Web page in a new browser window. It also shows how to navigate to the second page of the current document and to the first page of another document on your computer. Before running the macro, substitute the path and file name of a valid Visio document on your computer for <path\filename>.

VBA Copy code Copy code
Public Sub FollowHyperlink_Example()

 'Navigate to the Microsoft Web site and view the page in a new browser window.
 ThisDocument.FollowHyperlink "http://www.microsoft.com", "", , , 1

 'Navigate to the second page of the current document.
 ThisDocument.FollowHyperlink "", "Page-2"

 'Navigate to the first page of another document
 ThisDocument.FollowHyperlink "<path\filename>", "Page-1"

End Sub


Document.GetThemeNames Method (Visio)

 Copy code hover
[image]

Document.GetThemeNames Method (Visio)
Send feedback

Published: July 16, 2012

Returns a locale-specific array of names of themes contained in the document.

Version Information

Version Added: Visio 2007

Syntax

expression .GetThemeNames(eType, NameArray())

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
eType | Required | VisThemeTypes | The type of the theme, an enumerated value from the VisThemeTypes enumeration. See Remarks for possible values.
NameArray() | Required | String | Out parameter. An array of locale-specific theme names returned by the method.

Return Value

Nothing

Remarks

For the eType parameter, pass a value from the VisThemeTypes enumeration, which is declared in the Visio type library.

Constant | Value | Description
visThemeTypeColor | 1 | Color themes.
visThemeTypeEffect | 2 | Effect themes.

For the NameArray() out parameter, pass an empty, dimensionless array of type String. Visio returns the array filled with locale-specific names of themes contained in the document.

To get locale-independent themes in the document, use the Document.GetThemeNamesU method.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, themes, and layers. When a user names a shape, for example, the user is specifying a local name.

Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions of Visio, universal names were not visible in the user interface.) As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetThemeNames method to get the list of locale-specific theme color and theme effect names in the active document. It prints the list in the Immediate window.

VBA Copy code Copy code
Public Sub GetThemeNames_Example()

    Dim astrNames() As String
    Dim strThemeName As String
    Dim intArrayCounter As Integer

    ActiveDocument.GetThemeNames visThemeTypeColor, astrNames

    For intArrayCounter = LBound(astrNames) To UBound(astrNames)
        strThemeName = astrNames(intArrayCounter)
        Debug.Print strThemeName
    Next

    Debug.Print "-------------------------------------------"

    ActiveDocument.GetThemeNames visThemeTypeEffect, astrNames

    For intArrayCounter = LBound(astrNames) To UBound(astrNames)
        strThemeName = astrNames(intArrayCounter)
        Debug.Print strThemeName
    Next

End Sub


Document.GetThemeNamesU Method (Visio)

 Copy code hover
[image]

Document.GetThemeNamesU Method (Visio)
Send feedback

Published: July 16, 2012

Returns a locale-independent array of names of themes contained in the document.

Version Information

Version Added: Visio 2007

Syntax

expression .GetThemeNamesU(eType, NameArray())

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
eType | Required | VisThemeTypes | The type of the theme, an enumerated value from the VisThemeTypes enumeration. See Remarks for possible values.
NameArray() | Required | String | Out parameter. An array of locale-independent theme names returned by the method.

Return Value

Nothing

Remarks

For the eType parameter, pass a value from the VisThemeTypes enumeration, which is declared in the Visio type library.

Constant | Value | Description
visThemeTypeColor | 1 | Color themes.
visThemeTypeEffect | 2 | Effect themes.

For the NameArray() out parameter, pass an empty, dimensionless array of type String. Visio returns the array filled with locale-independent names of themes contained in the document.

To get the names of locale-specific themes in the document, use the Document.GetThemeNames method.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, themes, and layers. When a user names a shape, for example, the user is specifying a local name.

Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions of Visio, universal names were not visible in the user interface.) As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetThemeNamesU method to get the list of locale-independent theme color and theme effect names in the active document. It prints the list in the Immediate window.

VBA Copy code Copy code
Public Sub GetThemeNamesU_Example()

    Dim astrNames() As String
    Dim strThemeName As String
    Dim intArrayCounter As Integer

    ActiveDocument.GetThemeNamesU visThemeTypeColor, astrNames

    For intArrayCounter = LBound(astrNames) To UBound(astrNames)
        strThemeName = astrNames(intArrayCounter)
        Debug.Print strThemeName
    Next

    Debug.Print "-------------------------------------------"

    ActiveDocument.GetThemeNamesU visThemeTypeEffect, astrNames

    For intArrayCounter = LBound(astrNames) To UBound(astrNames)
        strThemeName = astrNames(intArrayCounter)
        Debug.Print strThemeName
    Next

End Sub


Document.OpenStencilWindow Method (Visio)

 Copy code hover
[image]

Document.OpenStencilWindow Method (Visio)
Send feedback

Published: July 16, 2012

Opens a stencil window that shows the masters in the document.

Version Information

Version Added: Visio 4.1

Syntax

expression .OpenStencilWindow

expression A variable that represents a Document object.

Return Value

Window

Remarks

If the document's stencil is already displayed in a stencil window, the OpenStencilWindow method activates that window rather than opening another window.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the OpenStencilWindow method to open the Document Stencil window.

VBA Copy code Copy code

Public Sub OpenStencilWindow_Example()

 Dim vsoStencilWindow as Visio.Window

 'Open the Document Stencil window.
 Set vsoStencilWindow = ThisDocument.OpenStencilWindow

End Sub


Document.ParseLine Method (Visio)

 Copy code hover
[image]

Document.ParseLine Method (Visio)
Send feedback

Published: July 16, 2012

Parses a line of Microsoft Visual Basic code.

Version Information

Version Added: Visio 4.5

Syntax

expression .ParseLine(Line)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Line | Required | String | A string interpreted as Visual Basic code.

Return Value

Nothing

Remarks

The ParseLine method tells the Microsoft Visual Basic for Applications (VBA) project of the Document object to parse the string passed to it as an argument.

The ParseLine method raises an exception if the string fails to parse.

Example

You can use the following procedure to determine whether a string has been successfully parsed. If the parse succeeds, the procedure displays a message box that announces the success; if the parse fails, it displays a message box that announces the failure.

VBA Copy code Copy code

Public Sub ParseLine_Example()

 Call LineParser("String to parse.")

End Sub

Public Sub LineParser(strString As String)

 On Error Resume Next
 ThisDocument.ParseLine strString
 If Err = 0 Then
 MsgBox "String parsed successfully"
 Else
 MsgBox "Parse not successful"
 End If

End Sub


Document.Print Method (Visio)

 Copy code hover
[image]

Document.Print Method (Visio)
Send feedback

Published: July 16, 2012

Prints the contents of an object to the default printer.

Version Information

Version Added: Visio 2.0

Syntax

expression .Print

expression A variable that represents a Document object.

Return Value

Nothing

Remarks

For a Document object, this method prints all of the document's pages. Background pages are printed on the same sheet of paper as the foreground pages to which they are assigned.

For a Page object, this method prints the page and its background page (if any) on the same sheet of paper.

If you're using Microsoft Visual Basic for Applications (VBA) or Visual Basic, you must assign the method result to a dummy variable and you must apply the method to a variable of type Object, not type Visio.Document or Visio.Page. For example, to print a document, use the following code.

VBA Copy code Copy code

 Dim vsoDocument As Visio.Document
 Dim vsoDocumentTemp as Object
 Dim strDummy As String

 Set vsoDocument = ThisDocument
 Set vsoDocumentTemp = vsoDocument
 strDummy = vsoDocumentTemp.Print


Document.PrintOut Method (Visio)

 Copy code hover
[image]

Document.PrintOut Method (Visio)
Send feedback

Published: July 16, 2012

Prints the contents of the active document and provides various printing options.

Version Information

Version Added: Visio 2003

Syntax

expression .PrintOut(PrintRange, FromPage, ToPage, ScaleCurrentViewToPaper, PrinterName, PrintToFile, OutputFileName, Copies, Collate, ColorAsBlack)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
PrintRange | Required | VisPrintOutRange | The range of document pages to be printed. See Remarks for possible values.
FromPage | Optional | Long | If PrintRange is visPrintFromTo, the first page in the range to be printed. The default is 1, which indicates the first page of the drawing.
ToPage | Optional | Long | If PrintRange is visPrintFromTo, the last page in the range to be printed. The default is -1, which indicates the last page of the drawing.
ScaleCurrentViewToPaper | Optional | Boolean | If PrintRange is visPrintCurrentView, True to scale the part of the drawing that fits in the program window to fit on the current default paper size; False to print on as many printer pages as necessary. The default is False.
PrinterName | Optional | String | The name of the printer to use. The default is the printer currently selected in Visio.
PrintToFile | Optional | Boolean | True to send the information for printing to a file on a disk, rather than to the printer; False to print to the printer. The default is False. If you specify True for PrintToFile but do not pass a valid value for OutputFileName, the drawing is sent to the active printer.
OutputFileName | Optional | String | If PrintToFile is True, the name and path of the .prn file to which to print, enclosed in quotation marks.
Copies | Optional | Long | The number of copies to be printed. The default is one copy.
Collate | Optional | Boolean | True to collate copies. False to not collate. The default is False.
ColorAsBlack | Optional | Boolean | True to print all colors as black to ensure that all shapes are visible in the printed drawing. This is useful if a monochrome printer translates very light colors in a drawing to white rather than a shade of gray. False to print colors normally. The default is False.

Return Value

Nothing

Remarks

Calling the PrintOut method is the equivalent of selecting print options in the Print dialog box (click the File tab, click Print, and then click Print again), and then clicking OK.

Possible values for PrintRange are shown in the following table and declared in VisPrintOutRange in the Visio type library.

Constant | Value | Description
visPrintAll | 0 | Prints all foreground pages.
visPrintCurrentPage | 2 | Prints the active page.
visPrintCurrentView | 4 | Prints the current view area.
visPrintFromTo | 1 | Prints pages between the FromPage value and the ToPage value.
visPrintSelection | 3 | Prints a selection.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PrintOut method to print two copies of the current page to the active printer.

VBA Copy code Copy code
Public Sub PrintOut_Example()

    'Print two copies of the current page to the default printer
    ThisDocument.PrintOut visPrintCurrentPage, , , , , , , 2

End Sub


Document.PurgeUndo Method (Visio)

 Copy code hover
[image]

Document.PurgeUndo Method (Visio)
Send feedback

Published: July 16, 2012

Empties the Microsoft Visio queue of undo actions.

Version Information

Version Added: Visio 5.0

Syntax

expression .PurgeUndo

expression A variable that represents a Document object.

Return Value

Nothing

Remarks

After calling the PurgeUndo method, no operation performed before the call can be reversed.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PurgeUndo method to purge the undo list.

VBA Copy code Copy code

Public Sub PurgeUndo_Example()

 Application.PurgeUndo

End Sub


Document.RemoveHiddenInformation Method (Visio)

 Copy code hover
[image]

Document.RemoveHiddenInformation Method (Visio)
Send feedback

Published: July 16, 2012

Removes hidden information, such as personal information and external data, from a Microsoft Visio document.

Version Information

Version Added: Visio 2007

Syntax

expression .RemoveHiddenInformation(VisRemoveHiddenInfoItems)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
VisRemoveHiddenInfoItems | Required | Long | The items to be removed. A combination of one or more enumerated values from the VisRemoveHiddenInfoItems enumeration. See Remarks for possible values.

Return Value

Nothing

Remarks

For the VisRemoveHiddenInfoItems parameter, pass a combination of one or more of the following values from the VisRemoveHiddenInfoItems enumeration, which is declared in the Visio type library.

Constant | Value | Description
visRHIPersonalInfo | 1 | Removes personal information.
visRHIDataRecordsets | 16 | Removes data recordsets.
visRHIPreview | 2 | Removes document preview thumbnail images.
visRHIMasters | 4 | Removes unused masters.
visRHIStyles | 8 | Removes unused styles, themes, and other display formats.
visRHIValidationRules | 32 | Removes data rows not linked to shapes in the drawing.

Calling the RemoveHiddenInformation method is the equivalent of the selecting the options available in the Remove Hidden Information dialog box (click the File tab, click Info, and then click Remove Personal Information).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the RemoveHiddenInformation method to remove personal information and the preview thumbnail from the active document.

VBA Copy code Copy code
Public Sub RemoveHiddenInformation_Example()

    ActiveDocument.RemoveHiddenInformation visRHIPersonalInfo + visRHIPreview

End Sub


Document.RenameCurrentScope Method (Visio)

 Copy code hover
[image]

Document.RenameCurrentScope Method (Visio)
Send feedback

Published: July 16, 2012

Renames the top-level open undo scope.

Version Information

Version Added: Visio 2002

Syntax

expression .RenameCurrentScope(bstrScopeName)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
bstrScopeName | Required | String | The new name of the undo scope.

Return Value

Nothing

Remarks

The new name assigned to the undo scope appears on the Undo menu as the item name. If there is no open undo scope, the RenameCurrentScope method raises an exception.


Document.Save Method (Visio)

 Copy code hover
[image]

Document.Save Method (Visio)
Send feedback

Published: July 16, 2012

Saves a document.

Version Information

Version Added: Visio 2.0

Syntax

expression .Save

expression A variable that represents a Document object.

Return Value

Integer

Remarks

To save and name a new document, use the SaveAs method. Until a document has been saved, the Save method generates an error.

Example

The following macro shows how to save a Microsoft Visio document.

VBA Copy code Copy code
Public Sub Save_Example()

 ThisDocument.Save
 Debug.Print "Document saved."

End Sub


Document.SaveAs Method (Visio)

 Copy code hover
[image]

Document.SaveAs Method (Visio)
Send feedback

Published: July 16, 2012

Saves a document and gives it a file name.

Version Information

Version Added: Visio 2.0

Syntax

expression .SaveAs(FileName)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The file name for the document.

Return Value

Integer

Remarks

The SaveAs method can accept drive names that use the universal naming convention (UNC), for example, \\corporation\marketing.

Beginning with Visio 2002, you can save your drawing as an XML drawing (.vdx), an XML stencil (.vsx), or an XML template (.vtx).

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVDocument.SaveAs(string)

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SaveAs method. Before running this macro, change path to the location where you want to save the drawing, and change filename to the name you'd like to assign the file.

VBA Copy code Copy code

Public Sub SaveAs_Example()

    'Use the SaveAs method to save a document for the first time.
    ThisDocument.SaveAs "path\filename.vsd"

End Sub


Document.SaveAsEx Method (Visio)

 Copy code hover
[image]

Document.SaveAsEx Method (Visio)
Send feedback

Published: July 16, 2012

Saves a document with a file name using extra information passed in an argument.

Version Information

Version Added: Visio 4.0

Syntax

expression .SaveAsEx(FileName, SaveFlags)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The file name for the document.
SaveFlags | Required | Integer | How to save the file.

Return Value

Nothing

Remarks

The SaveAsEx method is identical to the SaveAs method, except that it provides an extra argument in which the caller can specify how the document is to be saved.

The SaveFlags argument should be a combination of the following values.

Constant | Value | Description
visSaveAsRO | &H1 | The document is saved as read-only.
visSaveAsWS | &H2 | The current workspace is saved with the file.
visSaveAsListInMRU | &H4 | The document is included in the Most Recently Used (MRU) list. By default, Save and SaveAs do not place the document into the MRU list.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SaveAsEx method. Before running this macro, change path to the location where you want to save the drawing, and change filename to the name you'd like to assign the file.

VBA Copy code Copy code

Public Sub SaveAsEx_Example()

 'Use the SaveAsEx method to save the drawing as a
 'new read-only drawing.
 ThisDocument.SaveAsEx "path\filename.vsd", visSaveAsRO

End Sub


Document.SetCustomMenus Method (Visio)

 Copy code hover
[image]

Document.SetCustomMenus Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the current built-in or custom menus of an application or document.

Version Information

Version Added: Visio 4.0

Syntax

expression .SetCustomMenus(MenusObject)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
MenusObject | Required | [IVUIOBJECT] | An expression that returns a UIObject object that represents the new custom menus.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the UIObject object was created in a separate process by using the CreateObject procedure instead of getting the appropriate property of an Application or Document object, the SetCustomMenus method returns an error.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to add a menu and menu item to the user interface, and then replace the built-in menu set with the custom set.

To restore the Microsoft Visio built-in user interface after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub SetCustomMenus_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UI object that represents the Microsoft Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a Demo menu.
 Set vsoMenu = vsoMenus.AddAt(1)
 vsoMenu.Caption = "Demo"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new Demo menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the properties for the new menu item.
 vsoMenuItem.Caption = "&Hello"
 vsoMenuItem.AddOnName = "MsgBox ""Hello"""

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


Document.SetCustomToolbars Method (Visio)

 Copy code hover
[image]

Document.SetCustomToolbars Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the current built-in or custom toolbars of an application or document.

Version Information

Version Added: Visio 4.0

Syntax

expression .SetCustomToolbars(ToolbarsObject)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ToolbarsObject | Required | [IVUIOBJECT] | An expression that returns a UIObject object that represents the new custom toolbars.

Return Value

Nothing

Remarks

If the ToolbarsObject object was created in a separate process by using the VBA CreateObject method instead of getting the appropriate property of an Application or Document object, the SetCustomToolbars method returns an error.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SetCustomToolbars method to replace the built-in toolbar set with the custom set. It retrieves a copy of the built-in Visio toolbars, adds a toolbar and a toolbar button, sets the button icon, and then replaces the toolbar set.

Before running this macro, replace path\filename in the code with the full path to and filename of an icon file (.ico) on your computer.

VBA Copy code Copy code
Public Sub SetCustomToolbarItems_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbar As Visio.Toolbar
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Create a new toolbar
 Set vsoToolbar = vsoToolbarSet.Toolbars.Add

 With vsoToolbar
 .Caption = "test"
 .Position = visBarFloating
 .Left = 300
 .Top = 200

 .Protection = visBarNoHorizontalDock
 .Visible = True
 .Enabled = True
 End With

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbar.ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = visCmdPanZoom

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


Document.UndoCheckOut Method (Visio)

 Copy code hover
[image]

Document.UndoCheckOut Method (Visio)
Send feedback

Published: July 16, 2012

Closes a Microsoft Visio document checked out from a Microsoft SharePoint Server site, deletes the local copy of the document, discarding any changes, undoes the checkout, and then reopens the document.

Version Information

Version Added: Visio 2007

Syntax

expression .UndoCheckOut

expression An expression that returns a Document object.

Return Value

Nothing

Remarks

Calling the UndoCheckOut method is the equivalent of clicking Discard Check Out on the Check In drop-down menu (click the File tab, and then click Info).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the UndoCheckOut method to undo the checkout of the active document from a SharePoint server. Before running this macro, check out a Visio document from a SharePoint Server site.

VBA Copy code Copy code
Public Sub UndoCheckOut_Example
    Visio.ActiveDocument.UndoCheckOut
End Sub


Document Events (Visio)

 Copy code hover
[image]

Document Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
AfterDocumentMerge | Occurs when Visio incorporates changes from other users' versions of a document into a merged, co-authored document.
AfterRemoveHiddenInformation | Occurs when hidden information is removed from the document.
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
BeforeDocumentClose | Occurs before a document is closed.
BeforeDocumentSave | Occurs before a document is saved.
BeforeDocumentSaveAs | Occurs just before a document is saved by using the Save As command.
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforePageDelete | Occurs before a page is deleted.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
BeforeStyleDelete | Occurs before a style is deleted.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
DataRecordsetAdded | Occurs when a DataRecordset object is added to a DataRecordsets collection.
DesignModeEntered | Occurs before a document enters design mode.
DocumentChanged | Occurs after certain properties of a document are changed.
DocumentCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.
DocumentCreated | Occurs after a document is created.
DocumentOpened | Occurs after a document is opened.
DocumentSaved | Occurs after a document is saved.
DocumentSavedAs | Occurs after a document is saved by using the Save As command.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
MasterAdded | Occurs after a new master is added to a document.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
PageAdded | Occurs after a new page is added to a document.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelDocumentClose | Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
RuleSetValidated | Occurs when a rule set is validated.
RunModeEntered | Occurs after a document enters run mode.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
StyleAdded | Occurs after a new style is added to a document.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.


Document.AfterDocumentMerge Event (Visio)

 Copy code hover
[image]

Document.AfterDocumentMerge Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs when Visio incorporates changes from other users' versions of a document into a merged, co-authored document.

Syntax

expression .AfterDocumentMerge(coauthMergeObjects)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data type | Description
coauthMergeObjects | Required | IVCOAUTHMERGEEVENT | An object that represents different versions of the merged, co-authored document.

See also

Concepts

Document Object

Other resources

Document Members


Document.AfterRemoveHiddenInformation Event (Visio)

 Copy code hover
[image]

Document.AfterRemoveHiddenInformation Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when hidden information is removed from the document.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _AfterRemoveHiddenInformation(ByVal doc As IVDOCUMENT)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document from which hidden information has been removed.

Remarks

The AfterRemoveHiddenInformation event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the AfterRemoveHiddenInformation event is fired, the EventInfo property returns a string that contains information about which items were removed from the document, consisting of the sum of applicable constant values from the VisRemoveHiddenInfoItems enumeration.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.BeforeDataRecordsetDelete Event (Visio)

 Copy code hover
[image]

Document.BeforeDataRecordsetDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a DataRecordset object is deleted from the DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _BeforeDataRecordsetDelete(ByVal DataRecordset As IVDATARECORDSET)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.BeforeDocumentClose Event (Visio)

 Copy code hover
[image]

Document.BeforeDocumentClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document is closed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeDocumentClose(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.BeforeDocumentSave Event (Visio)

 Copy code hover
[image]

Document.BeforeDocumentSave Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document is saved.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _BeforeDocumentSave(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be saved.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.BeforeDocumentSaveAs Event (Visio)

 Copy code hover
[image]

Document.BeforeDocumentSaveAs Event (Visio)
Send feedback

Published: July 16, 2012

Occurs just before a document is saved by using the Save As command.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _BeforeDocumentSaveAs(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be saved.

Remarks

The BeforeDocumentSaveAs event fires when a document is saved to either a native format (for example, VSD or VDX) or a non-native format (for example, HTM or BMP). It does not fire when a document is saved to DWG, DXF, and DGN formats. To save a document in a non-native format programmatically, you must use the Export method of the Page object. Note that when you call the SaveAs method, Microsoft Visio fires first the BeforeDocumentSaveAs event and then the DocumentSavedAs event. Calling the Export method, however, fires the BeforeDocumentSaveAs event but not the DocumentSavedAs event that follows it in response to the SaveAs method.

The BeforeDocumentSaveAs event is one of a group of events for which the EventInfo property of the Application object contains extra information.

If the BeforeDocumentSaveAs event is fired because a save was initiated by a user or a program, the EventInfo property returns the following string:

"/saveasfile=<filename>"

If it fires because Visio is saving a copy of an open file (for autorecovery or to include as a mail attachment), the EventInfo property will return one of the following strings:

  • If the event is fired for autorecovery purposes, the name of a recovery file in this format: "/autosavefile=C:\TEMP\~$2VSO2FD.vsd"

  • If the event is fired because a document copy is being made to send as a mail attachment, the name of an attachment file in this format: "/mailfile=C:\TEMP\~$2VSO2FD.vsd"

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection by using the AddAdvise method, the vMoreInfo argument to VisEventProc designates the document index: "/doc=1".


Document.BeforeMasterDelete Event (Visio)

 Copy code hover
[image]

Document.BeforeMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a master is deleted from a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.BeforePageDelete Event (Visio)

 Copy code hover
[image]

Document.BeforePageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a page is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforePageDelete(ByVal Page As [IVPAGE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.BeforeSelectionDelete Event (Visio)

 Copy code hover
[image]

Document.BeforeSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before selected objects are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selected objects that are going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. To find out if a shape is locked against deletion, check the value of its LockDelete cell.

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.BeforeShapeTextEdit Event (Visio)

 Copy code hover
[image]

Document.BeforeShapeTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is opened for text editing in the user interface.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _BeforeShapeTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be opened for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.BeforeStyleDelete Event (Visio)

 Copy code hover
[image]

Document.BeforeStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a style is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.ConvertToGroupCanceled Event (Visio)

 Copy code hover
[image]

Document.ConvertToGroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ConvertToGroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.DataRecordsetAdded Event (Visio)

 Copy code hover
[image]

Document.DataRecordsetAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a DataRecordset object is added to a DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetAdded(ByVal DataRecordset As [IVDATARECORDSET])

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that was added.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.DesignModeEntered Event (Visio)

 Copy code hover
[image]

Document.DesignModeEntered Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document enters design mode.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _DesignModeEntered(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to enter design mode.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.DocumentChanged Event (Visio)

 Copy code hover
[image]

Document.DocumentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after certain properties of a document are changed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentChanged(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document whose properties were changed.

Remarks

The DocumentChanged event indicates that one of a document's properties, such as Author or Description, has changed.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.DocumentCloseCanceled Event (Visio)

 Copy code hover
[image]

Document.DocumentCloseCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _DocumentCloseCanceled(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.DocumentCreated Event (Visio)

 Copy code hover
[image]

Document.DocumentCreated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is created.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentCreated(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was created.

Remarks

The DocumentCreated event is often added to the EventList collection of a Microsoft Visio template file (.vst). The event's action is triggered whenever a new document is created based on that template.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

You can add DocumentCreated events to the EventList collection of an Application object, Documents collection, or Document object. The first two are straightforward; if a document is opened or created in the scope of the Application object or its Documents collection, the DocumentCreated event occurs.

However, adding a DocumentCreated event to the EventList collection of a Document object makes sense only if the event's action is visActCodeRunAddon. In this case, the event is persistable; it can be stored with the document. If the document that contains the persistent event is opened, its action is triggered. If a new document is based on or copied from the document that contains the persistent event, the DocumentCreated event is copied to the new document and its action is triggered. However, if the event's action is visActCodeAdvise, that event is not persistable and therefore is not stored with the document; hence, it is never triggered.

You can prevent code from running in response to the DocumentCreated, DocumentOpened, or DocumentAdded event and all events from firing by setting the value of the EventsEnabled property of an Application object to False.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square.

The DocumentCreated event handler runs when a new drawing based on the template that contains this code is created. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentCreated(ByVal vsoDocument As Visio.IVDocument)

'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 'the shape was created locally.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Document.DocumentOpened Event (Visio)

 Copy code hover
[image]

Document.DocumentOpened Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is opened.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentOpened(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was opened.

Remarks

The DocumentOpened event is often added to the EventList collection of a Microsoft Visio template file (.vst). The event's action is triggered whenever an existing document is opened.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

You can add DocumentOpened events to the EventList collection of an Application object, Documents collection, or Document object. The first two are straightforward—if a document is opened or created in the scope of the Application object or its Documents collection, the DocumentOpened event occurs.

However, adding a DocumentOpened event to the EventList collection of a Document object makes sense only if the event's action is visActCodeRunAddon. In this case, the event is persistable—it can be stored with the document. If the document that contains the persistent event is opened, its action is triggered. If a new document is based on or copied from the document that contains the persistent event, the DocumentOpened event is copied to the new document and its action is triggered. However, if the event's action is visActCodeAdvise, that event is not persistable and therefore is not stored with the document; hence it is never triggered.

You can prevent code from running in response to the DocumentCreated, DocumentOpened or DocumentAdded event and all events from firing by setting the value of the EventsEnabled property of an Application object to False.


Document.DocumentSaved Event (Visio)

 Copy code hover
[image]

Document.DocumentSaved Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is saved.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentSaved(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was saved.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


Document.DocumentSavedAs Event (Visio)

 Copy code hover
[image]

Document.DocumentSavedAs Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is saved by using the Save As command.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentSavedAs(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was saved.

Remarks

The DocumentSavedAs event is one of a group of events for which the EventInfo property of the Application object contains extra information.

If the DocumentSavedAs event is fired because a save was initiated by a user or a program, the EventInfo property returns the following string:

"/saveasfile=<filename>"

If it fires because Microsoft Visio is saving a copy of an open file (for autorecovery or to include as a mail attachment), the EventInfo property returns one of the following strings:

  • If the event is fired for autorecovery purposes, the name of a recovery file in this format: "/autosavefile=drivename:\foldername\filename"

  • If the event is fired because a document copy is being made to send as a mail attachment, the name of an attachment file in this format: "/mailfile=drivename:\foldername\filename"

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection created by using the AddAdvise method, the varMoreInfo argument to VisEventProc designates the document index: "/doc=1".


Document.GroupCanceled Event (Visio)

 Copy code hover
[image]

Document.GroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _GroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.MasterAdded Event (Visio)

 Copy code hover
[image]

Document.MasterAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new master is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterAdded(ByVal Master As [IVMASTER])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.MasterChanged Event (Visio)

 Copy code hover
[image]

Document.MasterChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after properties of a master are changed and propagated to its instances.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterChanged(ByVal Master As [IVMASTER])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master whose properties changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.MasterDeleteCanceled Event (Visio)

 Copy code hover
[image]

Document.MasterDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _MasterDeleteCanceled(ByVal Master As [IVMASTER])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.PageAdded Event (Visio)

 Copy code hover
[image]

Document.PageAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new page is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageAdded(ByVal Page As [IVPAGE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was added.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


Document.PageChanged Event (Visio)

 Copy code hover
[image]

Document.PageChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageChanged(ByVal Page As [IVPAGE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that changed.

Remarks

If several pages of a document have default names and any page but the last is deleted, Microsoft Visio will automatically rename the remaining pages to preserve the naming sequence, but the renaming will not trigger the PageChanged event. For example, if a document contains Page-1, Page-2, and Page-3, and then Page-1 is deleted, Page-2 will be renamed Page-1, and Page-3 will be renamed Page-2, but no PageChanged event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.PageDeleteCanceled Event (Visio)

 Copy code hover
[image]

Document.PageDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _PageDeleteCanceled(ByVal Page As [IVPAGE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was going to be deleted.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.QueryCancelConvertToGroup Event (Visio)

 Copy code hover
[image]

Document.QueryCancelConvertToGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelConvertToGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be converted to a group.

Remarks

A Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • If all handlers return False (don't cancel), the conversion is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.QueryCancelDocumentClose Event (Visio)

 Copy code hover
[image]

Document.QueryCancelDocumentClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelDocumentClose(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be closed.

Remarks

A Microsoft Visio instance fires QueryCancelDocumentClose after the user has directed the instance to close a document.

  • If any event handler returns True (cancel), the instance fires DocumentCloseCanceled and does not close the document.

  • If all handlers return False (don't cancel), the instance firesBeforeDocumentClose and then closes the document.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.QueryCancelGroup Event (Visio)

 Copy code hover
[image]

Document.QueryCancelGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be grouped.

Remarks

A Microsoft Visio instance fires QueryCancelGroup after the user has directed the instance to group a selection of shapes.

  • If any event handler returns True (cancel), the instance fires GroupCanceled and does not group the shapes.

  • If all handlers return False (do not cancel), the grouping is performed.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you use Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.QueryCancelMasterDelete Event (Visio)

 Copy code hover
[image]

Document.QueryCancelMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelMasterDelete after the user has directed the instance to delete a master.

  • If any event handler returns True (cancel), the instance fires MasterDeleteCanceled and does not delete the master.

  • If all handlers return False (don't cancel), the instance fires BeforeMasterDelete and then deletes the master.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.QueryCancelPageDelete Event (Visio)

 Copy code hover
[image]

Document.QueryCancelPageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelPageDelete(ByVal Page As [IVPAGE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

A Visio instance fires QueryCancelPageDelete after the user has directed the instance to delete a page.

  • If any event handler returns True (cancel), the instance fires PageDeleteCanceled and does not delete the page.

  • If all handlers return False (don't cancel) the instance fires BeforePageDelete and then deletes the page.

While a Microsoft Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.QueryCancelSelectionDelete Event (Visio)

 Copy code hover
[image]

Document.QueryCancelSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelSelectionDelete after the user has directed the instance to delete one or more shapes.

  • If any event handler returns True (cancel), the instance fires SelectionDeleteCanceled and does not delete the shapes.

  • If all handlers returnFalse (don't cancel), the instance fires BeforeSelectionDelete and BeforeShapeDelete and then deletes the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.QueryCancelStyleDelete Event (Visio)

 Copy code hover
[image]

Document.QueryCancelStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelStyleDelete after the user has directed the instance to delete a style.

  • If any event handler returns True (cancel), the instance fires StyleDeleteCanceled and does not delete the style.

  • If all handlers return False (don't cancel), the instance fires BeforeStyleDelete and then deletes the style.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.QueryCancelUngroup Event (Visio)

 Copy code hover
[image]

Document.QueryCancelUngroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelUngroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be ungrouped.

Remarks

A Microsoft Visio instance fires QueryCancelUngroup after the user has directed the instance to ungroup one or more shapes.

  • If any event handler returns True (cancel), the instance fires UngroupCanceled and does not ungroup the shapes.

  • If all handlers return False (don't cancel), the instance fires ShapeParentChanged, BeforeSelectionDelete, and BeforeShapeDelete, and then ungroups the shapes.

While a Visio instance is firing a query or cancel event, it respondsto inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.RuleSetValidated Event (Visio)

 Copy code hover
[image]

Document.RuleSetValidated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a rule set is validated.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _RuleSetValidated(ByVal RuleSet As ValidationRuleSet)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
RuleSet | Required | ValidationRuleSet | The rule set that was validated.

Remarks

When Microsoft Visio performs validation, it fires a RuleSetValidated event for every rule set that it processes, even if a rule set is empty.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Document.RunModeEntered Event (Visio)

 Copy code hover
[image]

Document.RunModeEntered Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document enters run mode.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _RunModeEntered(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that entered run mode.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.SelectionDeleteCanceled Event (Visio)

 Copy code hover
[image]

Document.SelectionDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _SelectionDeleteCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.ShapeAdded Event (Visio)

 Copy code hover
[image]

Document.ShapeAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _ShapeAdded(ByVal Shape As [IVSHAPE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape or group of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the ShapeAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

To determine if a ShapeAdded event was triggered by a new shape or group of shapes being added to the page, by a set of existing shapes being grouped, or by a paste action, you can use the Application.IsInScope property. If IsInScope returns True when passed visCmdObjectGroup, the ShapeAdded event was triggered by a grouping action. If IsInScope returns True when passed visCmdUFEditPaste or visCmdEditPasteSpecial, the ShapeAdded event was triggered by a paste operation. If IsInScope returns False when passed all of these arguments, the event must have been triggered by new shapes being added to the page.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square. Paste the code into the active document's project in Visio.

The DocumentSaved event handler runs when the active document is saved. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentSaved(ByVal vsoDocument As Visio.IVDocument)

 'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 'the shape was created locally.
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Document.ShapeDataGraphicChanged Event (Visio)

 Copy code hover
[image]

Document.ShapeDataGraphicChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a data graphic is applied to or deleted from a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeDataGraphicChanged(ByVal Shape As IVSHAPE)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape to which the data graphic was applied or from which it was deleted.

Remarks

A data graphic is a Master object of type visTypeDataGraphic. When the same master that is already applied to a shape is re-applied to the shape, the ShapeDataGraphicChanged event does not fire, even if the master has been modified since it was applied originally. If, however, a different data graphic master is applied to the shape, the event does fire.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.ShapeExitedTextEdit Event (Visio)

 Copy code hover
[image]

Document.ShapeExitedTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is no longer open for interactive text editing.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeExitedTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that was closed for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.ShapeParentChanged Event (Visio)

 Copy code hover
[image]

Document.ShapeParentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after shapes are grouped or a group is ungrouped.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeParentChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose parent changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.StyleAdded Event (Visio)

 Copy code hover
[image]

Document.StyleAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new style is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleAdded(ByVal Style As [IVSTYLE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.StyleChanged Event (Visio)

 Copy code hover
[image]

Document.StyleChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleChanged(ByVal Style As [IVSTYLE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.StyleDeleteCanceled Event (Visio)

 Copy code hover
[image]

Document.StyleDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _StyleDeleteCanceled(ByVal Style As [IVSTYLE])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Document.UngroupCanceled Event (Visio)

 Copy code hover
[image]

Document.UngroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _UngroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be ungrouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents Object (Visio)

 Copy code hover
[image]

Documents Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Document object for each open document in a Microsoft Visio instance.

Remarks

To retrieve a Documents collection, use the Documents property of an Application object.

The default property of a Documents collection is Item.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this collection maps to the following types:

  • Microsoft.Office.Interop.Visio.IVDocuments.GetEnumerator() (to enumerate the Document objects.)

  • Microsoft.Office.Interop.Visio.IVDocuments (to access the collection.)


Documents Members (Visio)

 Copy code hover
[image]

Documents Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Document object for each open document in a Microsoft Visio instance.

Events

Name | Description
AfterDocumentMerge | Occurs when Visio incorporates changes from other users' versions of a document into a merged, co-authored document.
AfterRemoveHiddenInformation | Occurs when hidden information is removed from the document.
AfterReplaceShapes | Occurs after a shape-replacement operation.
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
BeforeDocumentClose | Occurs before a document is closed.
BeforeDocumentSave | Occurs before a document is saved.
BeforeDocumentSaveAs | Occurs just before a document is saved by using the Save As command.
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforePageDelete | Occurs before a page is deleted.
BeforeReplaceShapes | Occurs just before a shape-replacement operation.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
BeforeStyleDelete | Occurs before a style is deleted.
CalloutRelationshipAdded | Occurs when a new callout relationship is added to a document.
CalloutRelationshipDeleted | Occurs when a callout relationship is deleted from a document.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ContainerRelationshipAdded | Occurs when a new container relationship is added to the document.
ContainerRelationshipDeleted | Occurs when a container relationship is deleted from the document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
DataRecordsetAdded | Occurs when a DataRecordset object is added to a DataRecordsets collection.
DataRecordsetChanged | Occurs when a data recordset changes as a result of being refreshed.
DesignModeEntered | Occurs before a document enters design mode.
DocumentChanged | Occurs after certain properties of a document are changed.
DocumentCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.
DocumentCreated | Occurs after a document is created.
DocumentOpened | Occurs after a document is opened.
DocumentSaved | Occurs after a document is saved.
DocumentSavedAs | Occurs after a document is saved by using the Save As command.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
MasterAdded | Occurs after a new master is added to a document.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
PageAdded | Occurs after a new page is added to a document.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelDocumentClose | Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelReplaceShapes | Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
ReplaceShapesCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.
RuleSetValidated | Occurs when a rule set is validated.
RunModeEntered | Occurs after a document enters run mode.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
StyleAdded | Occurs after a new style is added to a document.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Methods

Name | Description
Add | Adds a new Document object to the Documents collection.
AddEx | Adds a new stencil or drawing to the Documents collection, while permitting extra information to be passed in an argument.
CanCheckOut | Specifies whether a document can be checked out from a Microsoft SharePoint Server computer.
CheckOut | Marks a specified document as checked out and assigns edit privileges to the current user.
GetNames | Returns the names of all items in a collection.
Open | Opens an existing file so that it can be edited.
OpenEx | Opens an existing Microsoft Visio file, using extra information passed in as an argument.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.


Documents Properties (Visio)

 Copy code hover
[image]

Documents Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.


Documents.Application Property (Visio)

 Copy code hover
[image]

Documents.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Documents object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Documents.Count Property (Visio)

 Copy code hover
[image]

Documents.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Documents object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Documents.EventList Property (Visio)

 Copy code hover
[image]

Documents.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Documents object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Documents.Item Property (Visio)

 Copy code hover
[image]

Documents.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameOrIndex)

expression A variable that represents a Documents collection.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

Document

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.


Documents.ItemFromID Property (Visio)

 Copy code hover
[image]

Documents.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item of a collection using the ID of the item. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemFromID(nID)

expression A variable that represents a Documents collection.

Parameters

Name | Required/Optional | Data Type | Description
nID | Required | Long | The ID of the object to retrieve.

Return Value

Document

Remarks

The ID of a Shape object uniquely identifies the shape within its page or master.

The ID of a Style object uniquely identifies the style within its document.

The ID of a Font object corresponds to the number stored in the Font cell of a row in a shape's Character Properties section. The ID associated with a particular font varies between systems or as fonts are installed on and removed from a given system.

The ID of an Event object uniquely identifies an event in its EventList collection for the life of the collection.


Documents.ObjectType Property (Visio)

 Copy code hover
[image]

Documents.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Documents object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Documents.PersistsEvents Property (Visio)

 Copy code hover
[image]

Documents.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Documents object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Documents Methods (Visio)

 Copy code hover
[image]

Documents Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new Document object to the Documents collection.
AddEx | Adds a new stencil or drawing to the Documents collection, while permitting extra information to be passed in an argument.
CanCheckOut | Specifies whether a document can be checked out from a Microsoft SharePoint Server computer.
CheckOut | Marks a specified document as checked out and assigns edit privileges to the current user.
GetNames | Returns the names of all items in a collection.
Open | Opens an existing file so that it can be edited.
OpenEx | Opens an existing Microsoft Visio file, using extra information passed in as an argument.


Documents.Add Method (Visio)

 Copy code hover
[image]

Documents.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new Document object to the Documents collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add(FileName)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The type or file name of the document to add; if you do not include a path, Visio searches the folder or folders designated in the Application object's TemplatePaths property and all published templates, including published third-party templates.

Return Value

Document

Remarks

To create a new drawing based on no template, pass a zero-length string ("") to the Add method.

To create a new drawing based on another file, like a template, pass the filename of the original file to the Add method. Microsoft Visio opens stencils that are part of the template's workspace and copies styles and other settings associated with the template to the new document. If the template file name is invalid, no document is returned and an error is generated.

To create a new stencil based on no stencil, pass ("vss").

Note Note

Passing a filename as an argument to the Add method is equivalent to opening a file like a template, where a new blank drawing is created that includes content copied from the original.

Example

The following macro shows how to add Document objects such as templates, stencils, and drawings to the Documents collection.

Before running this macro, replace Myfile.vsd with a valid .vsd file.

VBA Copy code Copy code
Public Sub AddDocument_Example()

 Dim vsoDocument As Visio.Document

 'Add a Document object based on the Basic Diagram template.
 Set vsoDocument = Documents.Add("Basic Diagram.vst")

 'Add a Document object based on a drawing (creates a copy of the drawing).
 Set vsoDocument = Documents.Add("Myfile.vsd")

 'Add a Document object based on a stencil (creates a copy of the stencil).
 Set vsoDocument = Documents.Add("Basic Shapes.vss")

 'Add a Document object based on no template.
 Set vsoDocument = Documents.Add("")

End Sub


Documents.AddEx Method (Visio)

 Copy code hover
[image]

Documents.AddEx Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new stencil or drawing to the Documents collection, while permitting extra information to be passed in an argument.

Version Information

Version Added: Visio 2003

Syntax

expression .AddEx(FileName, MeasurementSystem, Flags, LangID)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The type or file name of the document to add; if you do not include a path, Microsoft Visio searches the folder or folders designated in the Application object's TemplatePaths property and all published templates, including published third-party templates.
MeasurementSystem | Optional | VisMeasurementSystem | The measurement units to use in the new document. See Remarks for possible values.
Flags | Optional | Long | Flags that indicate how to open the new document. See Remarks for possible values.
LangID | Optional | Long | The language ID for the document. See Remarks.

Return Value

Document

Remarks

The AddEx method is similar to the Add method as it applies to the Documents collection, except that AddEx provides several additional arguments in which the caller can specify how the document is created.

The MeasurementSystem argument should be one of the following members of VisMeasurementSystem, which is declared in the Visio type library.

Constant | Value | Description
visMSDefault | 0 | Choose metric or US depending on regional options set in Control Panel.
visMSMetric | 1 | Metric measurement system.
visMSUS | 2 | US units measurement system.

The Flags argument should be a combination of one or more of the following members of VisOpenSaveArgs, which is declared in the Visio type library.

Constant | Value | Description
visAddDocked | 4 | Adds a document in a docked window.
visAddHidden | 64 | Adds a document in a hidden window.
visAddMacrosDisabled | 128 | Adds a document with macros disabled.
visAddMinimized | 16 | Adds a document in a minimized window.
visAddNoWorkspace | 256 | Adds a document with no workspace information.
visAddStencil | 512 | Adds a new stencil file.

The LangID argument should be one of the standard IDs used by Microsoft Windows to encode different language versions. For example, the language ID is &H0409 for the U.S. version of Visio. To see a list of language IDs, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN.

To create a new drawing based on no template, pass a zero-length string ("") to the AddEx method.

To create a new drawing based on a template, pass "templatename.vst" to the AddEx method. Visio opens stencils that are part of the template's workspace and copies styles and other settings associated with the template to the new document. If the template file name is invalid, no document is returned and an error is generated.

To create a new stencil based on no stencil, pass ("vss").

To open a copy of a stencil, pass ("stencilname.vss").

To open a copy of a drawing, pass ("drawingname.vsd").

Note Note

Opening a copy of a stencil or drawing is equivalent to selecting Open as Copy in the Open list in the Open dialog box or using the OpenEx method with the visOpenCopy flag.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the AddEx method to create a document based on the "BASICD_U.VST" template that uses the default measurement system units.

VBA Copy code Copy code
Public Sub AddEx_Example()

 Application.Documents.AddEx "BASICD_U.VST", visMSDefault

End Sub


Documents.CanCheckOut Method (Visio)

 Copy code hover
[image]

Documents.CanCheckOut Method (Visio)
Send feedback

Published: July 16, 2012

Specifies whether a document can be checked out from a Microsoft SharePoint Server computer.

Version Information

Version Added: Visio 2002 SR-1

Syntax

expression .CanCheckOut(FileName)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The server path and name of the file.

Return Value

Boolean

Remarks

You cannot check out a file that is already checked out or that is not stored in a document library on a computer running Microsoft SharePoint Server or Microsoft SharePoint Foundation.

Example

This example verifies that a document is not checked out by another user and that it can be checked out.

VBA Copy code Copy code

Sub CheckDocOut(strDocCheckOut As String)
 If Documents.CanCheckOut(strDocCheckOut) = True Then
 Documents.CheckOut strDocCheckOut
 Else
 MsgBox "You are unable to check out this " _
 & "document at this time."
 End If
End Sub

To call the preceding CheckDocOut subroutine, use the following subroutine and replace servername/workspace/drawing.vdx with the path to and name of an actual file located on a Microsoft SharePoint Server computer.

VBA Copy code Copy code

Sub DocOut()
 Call CheckDocOut _
 (strDocCheckOut:="http://servername/workspace/drawing.vdx")
End Sub


Documents.CheckOut Method (Visio)

 Copy code hover
[image]

Documents.CheckOut Method (Visio)
Send feedback

Published: July 16, 2012

Marks a specified document as checked out and assigns edit privileges to the current user.

Version Information

Version Added: Visio 2002 SR-1

Syntax

expression .CheckOut(FileName)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The server path and name of the file.

Return Value

Nothing

Remarks

To check out a file, it must be stored in a document library on a computer running Microsoft SharePoint Server or Microsoft SharePoint Foundation.

Unlike the behavior in the user interface, the CheckOut method does not open the document. Use the Open method to open the document in the drawing window after checking it out.

Example

This example verifies that a document can be checked out. If it can, this example checks it out; otherwise, it returns a message that the document cannot be checked out.

VBA Copy code Copy code

Sub CheckDocOut(strDocCheckOut As String)
    If Documents.CanCheckOut(strDocCheckOut) = True Then
        Documents.CheckOut strDocCheckOut
    Else
        MsgBox "You are unable to check out this document " _
            & "at this time."
    End If
End Sub

To call the preceding CheckDocOut subroutine, use the following subroutine and replace servername/workspace/drawing.vdx with the path to and name of an actual file located on a Microsoft SharePoint Server computer.

VBA Copy code Copy code

Sub DocOut()
    Call CheckDocOut _
        (strDocCheckOut:="http://servername/workspace/drawing.vdx")
End Sub


Documents.GetNames Method (Visio)

 Copy code hover
[image]

Documents.GetNames Method (Visio)
Send feedback

Published: July 16, 2012

Returns the names of all items in a collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNames(NameArray())

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
NameArray() | Required | String | Out paramter. An array that receives the names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNames method succeeds, NameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. NameArray() is an out paramter that is allocated by the GetNames method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.


Documents.Open Method (Visio)

 Copy code hover
[image]

Documents.Open Method (Visio)
Send feedback

Published: July 16, 2012

Opens an existing file so that it can be edited.

Version Information

Version Added: Visio 2.0

Syntax

expression .Open(FileName)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of a file to open.

Return Value

Document

Remarks

When you use the Open method to open a Document object, it opens a Microsoft Visio file as an original. Depending on the file name extension, the Open method opens a drawing (.vsd), a stencil (.vss), a template (.vst), a workspace (.vsw), an XML drawing (.vdx), an XML stencil (.vsx), or an XML template (.vtx). You can also use this method to open and convert non-Visio files to Visio files. If the file does not exist or the file name is invalid, no Document object is returned and an error is generated.

If you pass a valid stencil (.vss) file name, the original stencil file opens. Starting with Microsoft Office Visio 2003, only user-created stencils are editable. By default, Visio stencils are not editable. Unless you want to create or edit the masters, open a stencil as read-only.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to open a blank document, a new document based on a template, and an existing document.

Before running this macro, replace path\filename with the path to and file name of a valid template file (.vst) on your computer.

VBA Copy code Copy code

Public Sub OpenDocument_Example()

 Dim vsoDocument As Visio.Document

 'Open a blank document (not based on a template).
 Set vsoDocument = Documents.Add("")

 'Open a new document based on a template.
 Set vsoDocument = Documents.Add _
 ("path\filename")

 'Open an existing document.
 Set vsoDocument = Documents.Open _
 ("path\filename")

End Sub


Documents.OpenEx Method (Visio)

 Copy code hover
[image]

Documents.OpenEx Method (Visio)
Send feedback

Published: July 16, 2012

Opens an existing Microsoft Visio file, using extra information passed in as an argument.

Version Information

Version Added: Visio 4.5

Syntax

expression .OpenEx(FileName, Flags)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file to open.
Flags | Required | Integer | Flags that indicate how to open the file.

Return Value

Document

Remarks

The OpenEx method is identical to the Open method, except that it provides an extra argument in which the caller can specify how the document opens.

The Flags argument should be a combination of zero or more of the following values.

Constant | Value
visOpenCopy | &H1
visOpenRO | &H2
visOpenDocked | &H4
visOpenDontList | &H8
visOpenMinimized | &H10
visOpenRW | &H20
visOpenHidden | &H40
visOpenMacrosDisabled | &H80
visOpenNoWorkspace | &H100

If visOpenDocked is specified, the file appears in a docked rather than an MDI window, provided that the file is a stencil file and there is an active drawing window in which to put the docked stencil window.

If visOpenDontList is specified, the name of the opened file does not appear in the list of recently opened documents in the Recent Documents list on the Recent tab (click the File tab, and then click Recent).

If visOpenMinimized is specified, the file opens minimized—it is not active. This flag is not supported in versions of Visio earlier than 5.0b.

If visOpenMacrosDisabled is specified, the file opens with Visual Basic macros disabled. This flag is not supported in versions earlier than Visio 2002.

If visOpenHidden is specified, the file opens in a hidden window.

If visOpenNoWorkspace is specified, the file opens with no workspace information.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVDocuments.OpenEx(string, short)

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the OpenEx method to open a copy of a stencil file in Visio.

VBA Copy code Copy code

Public Sub OpenEx_Example()

    'Use the OpenEx method to open a copy of a stencil.
    Documents.OpenEx "Basic_U.vss", visOpenDocked + visOpenCopy

End Sub


Documents Events (Visio)

 Copy code hover
[image]

Documents Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
AfterDocumentMerge | Occurs when Visio incorporates changes from other users' versions of a document into a merged, co-authored document.
AfterRemoveHiddenInformation | Occurs when hidden information is removed from the document.
AfterReplaceShapes | Occurs after a shape-replacement operation.
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
BeforeDocumentClose | Occurs before a document is closed.
BeforeDocumentSave | Occurs before a document is saved.
BeforeDocumentSaveAs | Occurs just before a document is saved by using the Save As command.
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforePageDelete | Occurs before a page is deleted.
BeforeReplaceShapes | Occurs just before a shape-replacement operation.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
BeforeStyleDelete | Occurs before a style is deleted.
CalloutRelationshipAdded | Occurs when a new callout relationship is added to a document.
CalloutRelationshipDeleted | Occurs when a callout relationship is deleted from a document.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ContainerRelationshipAdded | Occurs when a new container relationship is added to the document.
ContainerRelationshipDeleted | Occurs when a container relationship is deleted from the document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
DataRecordsetAdded | Occurs when a DataRecordset object is added to a DataRecordsets collection.
DataRecordsetChanged | Occurs when a data recordset changes as a result of being refreshed.
DesignModeEntered | Occurs before a document enters design mode.
DocumentChanged | Occurs after certain properties of a document are changed.
DocumentCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.
DocumentCreated | Occurs after a document is created.
DocumentOpened | Occurs after a document is opened.
DocumentSaved | Occurs after a document is saved.
DocumentSavedAs | Occurs after a document is saved by using the Save As command.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
MasterAdded | Occurs after a new master is added to a document.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
PageAdded | Occurs after a new page is added to a document.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelDocumentClose | Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelReplaceShapes | Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
ReplaceShapesCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.
RuleSetValidated | Occurs when a rule set is validated.
RunModeEntered | Occurs after a document enters run mode.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
StyleAdded | Occurs after a new style is added to a document.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.


Documents.AfterDocumentMerge Event (Visio)

 Copy code hover
[image]

Documents.AfterDocumentMerge Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs when Visio incorporates changes from other users' versions of a document into a merged, co-authored document.

Syntax

expression .AfterDocumentMerge(coauthMergeObjects)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data type | Description
coauthMergeObjects | Required | IVCOAUTHMERGEEVENT | An object that represents different versions of the merged, co-authored document.

See also

Concepts

Documents Object

Other resources

Documents Members


Documents.AfterRemoveHiddenInformation Event (Visio)

 Copy code hover
[image]

Documents.AfterRemoveHiddenInformation Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when hidden information is removed from the document.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _AfterRemoveHiddenInformation(ByVal doc As IVDOCUMENT)

expression An expression that returns a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document from which hidden information has been removed.

Remarks

The AfterRemoveHiddenInformation event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the AfterRemoveHiddenInformation event is fired, the EventInfo property returns a string that contains information about which items were removed from the document, consisting of the sum of applicable constant values from the VisRemoveHiddenInfoItems enumeration.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.AfterReplaceShapes Event (Visio)

 Copy code hover
[image]

Documents.AfterReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs after a shape-replacement operation.

Syntax

expression .AfterReplaceShapes(sel)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data type | Description
sel | Required | IVSELECTION | A Selection object that represents the replacement shape or shapes.

See also

Concepts

Documents Object

Other resources

Documents Members


Documents.BeforeDataRecordsetDelete Event (Visio)

 Copy code hover
[image]

Documents.BeforeDataRecordsetDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a DataRecordset object is deleted from the DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _BeforeDataRecordsetDelete(ByVal DataRecordset As IVDATARECORDSET)

expression An expression that returns a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.BeforeDocumentClose Event (Visio)

 Copy code hover
[image]

Documents.BeforeDocumentClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document is closed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeDocumentClose(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.BeforeDocumentSave Event (Visio)

 Copy code hover
[image]

Documents.BeforeDocumentSave Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document is saved.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _BeforeDocumentSave(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be saved.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.BeforeDocumentSaveAs Event (Visio)

 Copy code hover
[image]

Documents.BeforeDocumentSaveAs Event (Visio)
Send feedback

Published: July 16, 2012

Occurs just before a document is saved by using the Save As command.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _BeforeDocumentSaveAs(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be saved.

Remarks

The BeforeDocumentSaveAs event fires when a document is saved to either a native format (for example, VSD or VDX) or a non-native format (for example, HTM or BMP). It does not fire when a document is saved to DWG, DXF, and DGN formats. To save a document in a non-native format programmatically, you must use the Export method of the Page object. Note that when you call the SaveAs method, Microsoft Visio fires first the BeforeDocumentSaveAs event and then the DocumentSavedAs event. Calling the Export method, however, fires the BeforeDocumentSaveAs event but not the DocumentSavedAs event that follows it in response to the SaveAs method.

The BeforeDocumentSaveAs event is one of a group of events for which the EventInfo property of the Application object contains extra information.

If the BeforeDocumentSaveAs event is fired because a save was initiated by a user or a program, the EventInfo property returns the following string:

"/saveasfile=<filename>"

If it fires because Visio is saving a copy of an open file (for autorecovery or to include as a mail attachment), the EventInfo property will return one of the following strings:

  • If the event is fired for autorecovery purposes, the name of a recovery file in this format: "/autosavefile=C:\TEMP\~$2VSO2FD.vsd"

  • If the event is fired because a document copy is being made to send as a mail attachment, the name of an attachment file in this format: "/mailfile=C:\TEMP\~$2VSO2FD.vsd"

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection by using the AddAdvise method, the vMoreInfo argument to VisEventProc designates the document index: "/doc=1".


Documents.BeforeMasterDelete Event (Visio)

 Copy code hover
[image]

Documents.BeforeMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a master is deleted from a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.BeforePageDelete Event (Visio)

 Copy code hover
[image]

Documents.BeforePageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a page is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforePageDelete(ByVal Page As [IVPAGE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.BeforeReplaceShapes Event (Visio)

 Copy code hover
[image]

Documents.BeforeReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs just before a shape-replacement operation.

Syntax

expression .BeforeReplaceShapes(replaceShapes)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.

See also

Concepts

Documents Object

Other resources

Documents Members


Documents.BeforeSelectionDelete Event (Visio)

 Copy code hover
[image]

Documents.BeforeSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before selected objects are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selected objects that are going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. To find out if a shape is locked against deletion, check the value of its LockDelete cell.

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.BeforeShapeDelete Event (Visio)

 Copy code hover
[image]

Documents.BeforeShapeDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is deleted.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeShapeDelete(ByVal Shape As [IVSHAPE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeShapeDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use the VBA WithEvents keyword to sink the BeforeShapeDelete event.

For performance considerations, the Document object's event set does not include the BeforeShapeDelete event. To sink the BeforeShapeDelete event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Documents.BeforeShapeTextEdit Event (Visio)

 Copy code hover
[image]

Documents.BeforeShapeTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is opened for text editing in the user interface.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _BeforeShapeTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be opened for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.BeforeStyleDelete Event (Visio)

 Copy code hover
[image]

Documents.BeforeStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a style is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.CalloutRelationshipAdded Event (Visio)

 Copy code hover
[image]

Documents.CalloutRelationshipAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a new callout relationship is added to a document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _CalloutRelationshipAdded(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the new callout shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event that you want to create, see Event codes.


Documents.CalloutRelationshipDeleted Event (Visio)

 Copy code hover
[image]

Documents.CalloutRelationshipDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a callout relationship is deleted from a document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _CalloutRelationshipDeleted(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the callout shape pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively. When Microsoft Visio deletes both shapes in the container relationship simultaneously, for example when both shapes are deleted from a drawing as part of a selection, the event does not fire.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event that you want to create, see Event codes.


Documents.CellChanged Event (Visio)

 Copy code hover
[image]

Documents.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


Documents.ConnectionsAdded Event (Visio)

 Copy code hover
[image]

Documents.ConnectionsAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections have been established between shapes.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsAdded(ByVal Connects As [IVCONNECTS])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that were established.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsAdded event. To sink the ConnectionsAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Documents.ConnectionsDeleted Event (Visio)

 Copy code hover
[image]

Documents.ConnectionsDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections between shapes have been removed.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsDeleted(ByVal Connects As [IVCONNECTS])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that have been removed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsDeleted event. To sink the ConnectionsDeleted event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Documents.ContainerRelationshipAdded Event (Visio)

 Copy code hover
[image]

Documents.ContainerRelationshipAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a new container relationship is added to the document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _ContainerRelationshipAdded(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the new container shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Documents.ContainerRelationshipDeleted Event (Visio)

 Copy code hover
[image]

Documents.ContainerRelationshipDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a container relationship is deleted from the document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _ContainerRelationshipDeleted(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the container shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively. When Microsoft Visio deletes both shapes in the container relationship simultaneously, for example when both shapes are deleted from a drawing as part of a selection, the event does not fire.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Documents.ConvertToGroupCanceled Event (Visio)

 Copy code hover
[image]

Documents.ConvertToGroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ConvertToGroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.DataRecordsetAdded Event (Visio)

 Copy code hover
[image]

Documents.DataRecordsetAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a DataRecordset object is added to a DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetAdded(ByVal DataRecordset As [IVDATARECORDSET])

expression An expression that returns a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that was added.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.DataRecordsetChanged Event (Visio)

 Copy code hover
[image]

Documents.DataRecordsetChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a data recordset changes as a result of being refreshed.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetChanged(ByVal DataRecordsetChanged As IVDATARECORDSETCHANGEDEVENT)

expression An expression that returns a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetChanged | Required | [IVDATARECORDSETCHANGEDEVENT] | The data recordset that changed.

Remarks

When the DataRecordsetChanged event fires, the DataRecordsetChangedEvent object is passed to the IVisEventProc.VisEventProc method as the pSubjectObj parameter, which represents he subject of the event—the object to which the event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.DesignModeEntered Event (Visio)

 Copy code hover
[image]

Documents.DesignModeEntered Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document enters design mode.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _DesignModeEntered(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to enter design mode.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.DocumentChanged Event (Visio)

 Copy code hover
[image]

Documents.DocumentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after certain properties of a document are changed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentChanged(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document whose properties were changed.

Remarks

The DocumentChanged event indicates that one of a document's properties, such as Author or Description, has changed.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.DocumentCloseCanceled Event (Visio)

 Copy code hover
[image]

Documents.DocumentCloseCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _DocumentCloseCanceled(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.DocumentCreated Event (Visio)

 Copy code hover
[image]

Documents.DocumentCreated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is created.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentCreated(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was created.

Remarks

The DocumentCreated event is often added to the EventList collection of a Microsoft Visio template file (.vst). The event's action is triggered whenever a new document is created based on that template.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

You can add DocumentCreated events to the EventList collection of an Application object, Documents collection, or Document object. The first two are straightforward; if a document is opened or created in the scope of the Application object or its Documents collection, the DocumentCreated event occurs.

However, adding a DocumentCreated event to the EventList collection of a Document object makes sense only if the event's action is visActCodeRunAddon. In this case, the event is persistable; it can be stored with the document. If the document that contains the persistent event is opened, its action is triggered. If a new document is based on or copied from the document that contains the persistent event, the DocumentCreated event is copied to the new document and its action is triggered. However, if the event's action is visActCodeAdvise, that event is not persistable and therefore is not stored with the document; hence, it is never triggered.

You can prevent code from running in response to the DocumentCreated, DocumentOpened, or DocumentAdded event and all events from firing by setting the value of the EventsEnabled property of an Application object to False.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square.

The DocumentCreated event handler runs when a new drawing based on the template that contains this code is created. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentCreated(ByVal vsoDocument As Visio.IVDocument)

'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 'the shape was created locally.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Documents.DocumentOpened Event (Visio)

 Copy code hover
[image]

Documents.DocumentOpened Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is opened.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentOpened(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was opened.

Remarks

The DocumentOpened event is often added to the EventList collection of a Microsoft Visio template file (.vst). The event's action is triggered whenever an existing document is opened.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

You can add DocumentOpened events to the EventList collection of an Application object, Documents collection, or Document object. The first two are straightforward—if a document is opened or created in the scope of the Application object or its Documents collection, the DocumentOpened event occurs.

However, adding a DocumentOpened event to the EventList collection of a Document object makes sense only if the event's action is visActCodeRunAddon. In this case, the event is persistable—it can be stored with the document. If the document that contains the persistent event is opened, its action is triggered. If a new document is based on or copied from the document that contains the persistent event, the DocumentOpened event is copied to the new document and its action is triggered. However, if the event's action is visActCodeAdvise, that event is not persistable and therefore is not stored with the document; hence it is never triggered.

You can prevent code from running in response to the DocumentCreated, DocumentOpened or DocumentAdded event and all events from firing by setting the value of the EventsEnabled property of an Application object to False.


Documents.DocumentSaved Event (Visio)

 Copy code hover
[image]

Documents.DocumentSaved Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is saved.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentSaved(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was saved.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


Documents.DocumentSavedAs Event (Visio)

 Copy code hover
[image]

Documents.DocumentSavedAs Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is saved by using the Save As command.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentSavedAs(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was saved.

Remarks

The DocumentSavedAs event is one of a group of events for which the EventInfo property of the Application object contains extra information.

If the DocumentSavedAs event is fired because a save was initiated by a user or a program, the EventInfo property returns the following string:

"/saveasfile=<filename>"

If it fires because Microsoft Visio is saving a copy of an open file (for autorecovery or to include as a mail attachment), the EventInfo property returns one of the following strings:

  • If the event is fired for autorecovery purposes, the name of a recovery file in this format: "/autosavefile=drivename:\foldername\filename"

  • If the event is fired because a document copy is being made to send as a mail attachment, the name of an attachment file in this format: "/mailfile=drivename:\foldername\filename"

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection created by using the AddAdvise method, the varMoreInfo argument to VisEventProc designates the document index: "/doc=1".


Documents.FormulaChanged Event (Visio)

 Copy code hover
[image]

Documents.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Documents.GroupCanceled Event (Visio)

 Copy code hover
[image]

Documents.GroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _GroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.MasterAdded Event (Visio)

 Copy code hover
[image]

Documents.MasterAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new master is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterAdded(ByVal Master As [IVMASTER])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.MasterChanged Event (Visio)

 Copy code hover
[image]

Documents.MasterChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after properties of a master are changed and propagated to its instances.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterChanged(ByVal Master As [IVMASTER])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master whose properties changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.MasterDeleteCanceled Event (Visio)

 Copy code hover
[image]

Documents.MasterDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _MasterDeleteCanceled(ByVal Master As [IVMASTER])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.PageAdded Event (Visio)

 Copy code hover
[image]

Documents.PageAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new page is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageAdded(ByVal Page As [IVPAGE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was added.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


Documents.PageChanged Event (Visio)

 Copy code hover
[image]

Documents.PageChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageChanged(ByVal Page As [IVPAGE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that changed.

Remarks

If several pages of a document have default names and any page but the last is deleted, Microsoft Visio will automatically rename the remaining pages to preserve the naming sequence, but the renaming will not trigger the PageChanged event. For example, if a document contains Page-1, Page-2, and Page-3, and then Page-1 is deleted, Page-2 will be renamed Page-1, and Page-3 will be renamed Page-2, but no PageChanged event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.PageDeleteCanceled Event (Visio)

 Copy code hover
[image]

Documents.PageDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _PageDeleteCanceled(ByVal Page As [IVPAGE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was going to be deleted.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.QueryCancelConvertToGroup Event (Visio)

 Copy code hover
[image]

Documents.QueryCancelConvertToGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelConvertToGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be converted to a group.

Remarks

A Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • If all handlers return False (don't cancel), the conversion is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.QueryCancelDocumentClose Event (Visio)

 Copy code hover
[image]

Documents.QueryCancelDocumentClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelDocumentClose(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be closed.

Remarks

A Microsoft Visio instance fires QueryCancelDocumentClose after the user has directed the instance to close a document.

  • If any event handler returns True (cancel), the instance fires DocumentCloseCanceled and does not close the document.

  • If all handlers return False (don't cancel), the instance firesBeforeDocumentClose and then closes the document.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.QueryCancelGroup Event (Visio)

 Copy code hover
[image]

Documents.QueryCancelGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be grouped.

Remarks

A Microsoft Visio instance fires QueryCancelGroup after the user has directed the instance to group a selection of shapes.

  • If any event handler returns True (cancel), the instance fires GroupCanceled and does not group the shapes.

  • If all handlers return False (do not cancel), the grouping is performed.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you use Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.QueryCancelMasterDelete Event (Visio)

 Copy code hover
[image]

Documents.QueryCancelMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelMasterDelete after the user has directed the instance to delete a master.

  • If any event handler returns True (cancel), the instance fires MasterDeleteCanceled and does not delete the master.

  • If all handlers return False (don't cancel), the instance fires BeforeMasterDelete and then deletes the master.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.QueryCancelPageDelete Event (Visio)

 Copy code hover
[image]

Documents.QueryCancelPageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelPageDelete(ByVal Page As [IVPAGE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

A Visio instance fires QueryCancelPageDelete after the user has directed the instance to delete a page.

  • If any event handler returns True (cancel), the instance fires PageDeleteCanceled and does not delete the page.

  • If all handlers return False (don't cancel) the instance fires BeforePageDelete and then deletes the page.

While a Microsoft Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.QueryCancelReplaceShapes Event (Visio)

 Copy code hover
[image]

Documents.QueryCancelReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.

Syntax

expression .QueryCancelReplaceShapes(replaceShapes)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.
lpboolRet | Required | BOOL |

See also

Concepts

Documents Object

Other resources

Documents Members


Documents.QueryCancelSelectionDelete Event (Visio)

 Copy code hover
[image]

Documents.QueryCancelSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelSelectionDelete after the user has directed the instance to delete one or more shapes.

  • If any event handler returns True (cancel), the instance fires SelectionDeleteCanceled and does not delete the shapes.

  • If all handlers returnFalse (don't cancel), the instance fires BeforeSelectionDelete and BeforeShapeDelete and then deletes the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.QueryCancelStyleDelete Event (Visio)

 Copy code hover
[image]

Documents.QueryCancelStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelStyleDelete after the user has directed the instance to delete a style.

  • If any event handler returns True (cancel), the instance fires StyleDeleteCanceled and does not delete the style.

  • If all handlers return False (don't cancel), the instance fires BeforeStyleDelete and then deletes the style.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.QueryCancelUngroup Event (Visio)

 Copy code hover
[image]

Documents.QueryCancelUngroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelUngroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be ungrouped.

Remarks

A Microsoft Visio instance fires QueryCancelUngroup after the user has directed the instance to ungroup one or more shapes.

  • If any event handler returns True (cancel), the instance fires UngroupCanceled and does not ungroup the shapes.

  • If all handlers return False (don't cancel), the instance fires ShapeParentChanged, BeforeSelectionDelete, and BeforeShapeDelete, and then ungroups the shapes.

While a Visio instance is firing a query or cancel event, it respondsto inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.ReplaceShapesCanceled Event (Visio)

 Copy code hover
[image]

Documents.ReplaceShapesCanceled Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.

Syntax

expression .ReplaceShapesCanceled(replaceShapes)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.

See also

Concepts

Documents Object

Other resources

Documents Members


Documents.RuleSetValidated Event (Visio)

 Copy code hover
[image]

Documents.RuleSetValidated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a rule set is validated.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _RuleSetValidated(ByVal RuleSet As ValidationRuleSet)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
RuleSet | Required | ValidationRuleSet | The rule set that was validated.

Remarks

When Microsoft Visio performs validation, it fires a RuleSetValidated event for every rule set that it processes, even if a rule set is empty.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Documents.RunModeEntered Event (Visio)

 Copy code hover
[image]

Documents.RunModeEntered Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document enters run mode.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _RunModeEntered(ByVal doc As [IVDOCUMENT])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that entered run mode.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.SelectionAdded Event (Visio)

 Copy code hover
[image]

Documents.SelectionAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionAdded(ByVal Selection As [IVSELECTION])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the SelectionAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the SelectionAdded event.

For performance considerations, the Document object's event set does not include the SelectionAdded event. To sink the SelectionAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Documents.SelectionDeleteCanceled Event (Visio)

 Copy code hover
[image]

Documents.SelectionDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _SelectionDeleteCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.ShapeAdded Event (Visio)

 Copy code hover
[image]

Documents.ShapeAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _ShapeAdded(ByVal Shape As [IVSHAPE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape or group of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the ShapeAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

To determine if a ShapeAdded event was triggered by a new shape or group of shapes being added to the page, by a set of existing shapes being grouped, or by a paste action, you can use the Application.IsInScope property. If IsInScope returns True when passed visCmdObjectGroup, the ShapeAdded event was triggered by a grouping action. If IsInScope returns True when passed visCmdUFEditPaste or visCmdEditPasteSpecial, the ShapeAdded event was triggered by a paste operation. If IsInScope returns False when passed all of these arguments, the event must have been triggered by new shapes being added to the page.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square. Paste the code into the active document's project in Visio.

The DocumentSaved event handler runs when the active document is saved. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentSaved(ByVal vsoDocument As Visio.IVDocument)

 'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 'the shape was created locally.
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Documents.ShapeChanged Event (Visio)

 Copy code hover
[image]

Documents.ShapeChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a property of a shape that is not stored in a cell is changed in a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _ShapeChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose property changed.

Remarks

To determine which properties have changed when ShapeChanged fires, use the EventInfo property. The string returned by the EventInfo property contains a list of substrings that identify the properties that changed.

Changes to the following shape properties cause the ShapeChanged event to fire:

  • Name (the EventInfo property contains "/name")

  • Data1 (the EventInfo property contains "/data1")

  • Data2 (the EventInfo property contains "/data2")

  • Data3 (the EventInfo property contains "/data3")

  • UniqueID (the EventInfo property contains "/uniqueid")

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection that was created by using AddAdvise, the varMoreInfo argument to VisEventProc contains the string: "/doc=1 /page=1 /shape=Sheet.3"

Note Note

You can use VBA WithEvents variables to sink the ShapeChanged event.

For performance considerations, the Document object's event set does not include the ShapeChanged event. To sink the ShapeChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Documents.ShapeDataGraphicChanged Event (Visio)

 Copy code hover
[image]

Documents.ShapeDataGraphicChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a data graphic is applied to or deleted from a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeDataGraphicChanged(ByVal Shape As IVSHAPE)

expression An expression that returns a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape to which the data graphic was applied or from which it was deleted.

Remarks

A data graphic is a Master object of type visTypeDataGraphic. When the same master that is already applied to a shape is re-applied to the shape, the ShapeDataGraphicChanged event does not fire, even if the master has been modified since it was applied originally. If, however, a different data graphic master is applied to the shape, the event does fire.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.ShapeExitedTextEdit Event (Visio)

 Copy code hover
[image]

Documents.ShapeExitedTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is no longer open for interactive text editing.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeExitedTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that was closed for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.ShapeLinkAdded Event (Visio)

 Copy code hover
[image]

Documents.ShapeLinkAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is linked to a data row.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkAdded(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long)

expression An expression that returns a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is linked to data.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row linked to the shape.
DataRowID | Required | Long | The ID of the data row linked to the shape.

Remarks

The ShapeLinkAdded event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkAdded event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.ShapeLinkDeleted Event (Visio)

 Copy code hover
[image]

Documents.ShapeLinkDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the link between a shape and a data row is deleted.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkDeleted(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long )

expression An expression that returns a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose link to a data row was broken.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row that was linked to the shape.
DataRowID | Required | Long | The ID of the data row that was linked to the shape.

Remarks

The ShapeLinkDeleted event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkDeleted event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.ShapeParentChanged Event (Visio)

 Copy code hover
[image]

Documents.ShapeParentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after shapes are grouped or a group is ungrouped.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeParentChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose parent changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.StyleAdded Event (Visio)

 Copy code hover
[image]

Documents.StyleAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new style is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleAdded(ByVal Style As [IVSTYLE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.StyleChanged Event (Visio)

 Copy code hover
[image]

Documents.StyleChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleChanged(ByVal Style As [IVSTYLE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.StyleDeleteCanceled Event (Visio)

 Copy code hover
[image]

Documents.StyleDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _StyleDeleteCanceled(ByVal Style As [IVSTYLE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Documents.TextChanged Event (Visio)

 Copy code hover
[image]

Documents.TextChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the text of a shape is changed in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _TextChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose text changed.

Remarks

The TextChanged event is fired when the raw text of a shape changes, such as when the characters Microsoft Visio stores for the shape change. If a shape's characters change because a user is typing, the TextChanged event does not fire until the text editing session terminates.

When a field is added to or removed from a shape's text, its raw text changes; hence, a TextChanged event fires. However, no TextChanged event fires when the text in a field changes. For example, a shape has a text field that shows its width. A TextChanged event does not fire when the shape's width changes, because the raw text stored for the shape has not changed, even though the apparent (expanded) text of the shape does change. Use the CellChanged event for one of the cells in the Text Fields section to detect when the text in a text field changes.

To access a shape's raw text, use the Text property. To access the text of a shape in which text fields have been expanded, use the Characters.Text property. You can determine the location and properties of text fields in a shape's text by using the Shape.Characters object.

In Visio 5.0 and earlier versions, the raw characters reported by the Text property for a field included four characters, the first being the escape character. Starting with Visio 2000, only a single escape character is present in the raw text stream.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the TextChanged event.

For performance considerations, the Document object's event set does not include the TextChanged event. To sink the TextChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Documents.UngroupCanceled Event (Visio)

 Copy code hover
[image]

Documents.UngroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _UngroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be ungrouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl Object (Visio)

 Copy code hover
[image]

DrawingControl Object (Visio)
Send feedback

Published: July 16, 2012

A programmable ActiveX control that enables you to build Microsoft Visio functionality into programs you create in Microsoft Visual Studio and other development platforms.

Version Information

Version Added: Visio 2003

Remarks

Use the Document property of the DrawingControl object to get the Visio Document object associated with the instance of the Microsoft Visio Drawing Control and thereby gain access to the Visio object model.

Use the HostID property of the DrawingControl object to assign a GUID or other string representation of the container application to a registry key.

Use the NegotiateMenus and Negotiate Toolbars properties of the DrawingControl object to determine whether Visio menus and toolbars are merged with those of the host container application in the Visio Drawing Control, and to enable programmatic customizing of Visio menus and toolbars.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Use the PageSizingBehavior property of the DrawingControl object to specify how the behavior of the control changes as the control is resized, with respect to the drawing page and any shapes on it.

Use the Src property of the DrawingControl object to specify the Visio drawing to appear in the Visio Drawing Control.

Use the Window property of the DrawingControl object to get the Visio Window object associated with the instance of the Visio Drawing Control and thereby gain access to the Visio object model.

The DrawingControl object has no default property.


DrawingControl Members (Visio)

 Copy code hover
[image]

DrawingControl Members (Visio)
Send feedback

Published: July 16, 2012


DrawingControl Properties (Visio)

 Copy code hover
[image]

DrawingControl Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

None.


DrawingControl.Document Property (Visio)

 Copy code hover
[image]

DrawingControl.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a DrawingControl object.

Return Value

Document


DrawingControl.HostID Property (Visio)

 Copy code hover
[image]

DrawingControl.HostID Property (Visio)
Send feedback

Published: July 16, 2012

String representation of the GUID of the host application of the Microsoft Visio Drawing Control. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .HostID

expression A variable that represents a DrawingControl object.

Return Value

String

Remarks

Setting this property is optional. Set HostID at design time, for example in the Properties window in your Microsoft Visual Studio project.

Setting the HostID property creates (or modifies) a subkey at the following location in the registry:

HKEY_CURRENTUSER\Software\Microsoft\Office\14.0\VisioHosts\

If you set HostID, use a unique string that identifies your program, preferably a unique GUID, although any string less than 128 characters or less in length that contains no backslash ("\") or forward slash ("/") character is valid. A GUID should be no more than 40 characters. Write your Setup program so that when it uninstalls your program, it deletes the registry key and all its subkeys.

All instances of the Visio Drawing Control in your program share the same HostID value. If you set HostID multiple times for multiple instances of the Visio Drawing Control within the same application, later values will overwrite earlier ones in the registry.

HostID data is global to all instances of the Drawing Control in a given Win32 process. If you change any of the registry settings associated with any instance of the control at the HostID location, that setting is changed for all instances.

If you leave HostID set to the default, an empty string (""), your application will share application settings, for example, those you can set in the Visio Options dialog box (click the File tab, and then click Options), with Visio itself. If you set a HostID value, your application will have its own persistent registry-based values for these settings. In addition, you thereby leave Visio settings unchanged. If you have more than one application that contains a Drawing Control and you want each to have its own application settings, assign each a different HostID.

Caution note Caution

Modifying the Microsoft Windows registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).


DrawingControl.NegotiateMenus Property (Visio)

 Copy code hover
[image]

DrawingControl.NegotiateMenus Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio menus are merged with those of the host application when the Microsoft Visio Drawing Control has the keyboard focus. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .NegotiateMenus

expression A variable that represents a DrawingControl object.

Return Value

Boolean

Remarks

You can set the NegotiateMenus property either at design time (for example, in the Properties window in Microsoft Visual Basic 6.0), or at run time, as shown in the following example. It is recommended that you set NegotiateMenus at design time. If you do set NegotiateMenus at run time, set the property prior to in-place activation of the Visio Drawing Control.

When NegotiateMenus is set to True, you can use the methods and properties of the Visio object model to customize Visio menus in the Visio Drawing Control window.

Visio task panes are implemented as toolbars. If you set NegotiateMenus to True, but set NegotiateToolbars to False, menu commands such as Task Pane (View menu) and Microsoft Visio Help (Help menu) will be unavailable.

Note Note

If NegotiateMenus is True, the Visio Drawing Control supports OLE2 menu merging. For this merging to function properly, the host container application must implement the IOleInPlaceFrame interface correctly. For more information, search for "IOleInPlaceFrame" on MSDN.

When there is only a single instance of the control in your application, if you set the NegotiateMenus property to True and the NegotiateToolbars property to False, or vice versa, Visio task panes will not be displayed as expected. In order for Visio task panes to appear in the Visio Drawing Control, both properties must be set to the same value.

However, if your application uses multiple instances of the Visio Drawing Control, you can set either the NegotiateMenus property or the NegotiateToolbars property to True, but not both. If both properties are set to True when you are using multiple instances of the control in a single application, you will experience unexpected behavior.

Example

The following example shows how to set the NegotiateMenus property at run time in the Form_Load() sub procedure of your Visual Basic program. For examples of how to display or modify one or more particular Visio menus, see the topics for the UIObject object and its member methods and properties, in this Automation Reference.

VBA Copy code Copy code
Private Sub Form_Load()

 vsoDrawingControl.NegotiateMenus = True

End Sub


DrawingControl.NegotiateToolbars Property (Visio)

 Copy code hover
[image]

DrawingControl.NegotiateToolbars Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio toolbars are merged with those of the host application when the Microsoft Visio Drawing Control is UI-active (has the keyboard focus). Read/write.

Version Information

Version Added: Visio 2002 SR-1

Syntax

expression .NegotiateToolbars

expression A variable that represents a DrawingControl object.

Return Value

Boolean

Remarks

You can set the NegotiateToolbars property either at design time (for example, in the Properties window in Microsoft Visual Basic 6.0), or at run time, as shown in the following example. It is recommended that you set NegotiateToolbars at design time. If you do set NegotiateToolbars at run time, set the property prior to in-place activation of the Visio Drawing Control.

When NegotiateToolbars is set to True, you can use the methods and properties of the Visio object model to customize Visio toolbars in the Visio Drawing Control window.

Visio task panes are implemented as toolbars. If you set NegotiateMenus to True, but set NegotiateToolbars to False, menu commands such as Task Pane (View menu) and Microsoft Office Visio Help (Help menu) will be unavailable.

Note Note

If NegotiateToolbars is True, the Visio Drawing Control supports toolbar-space negotiation by means of the IOleInPlaceFrame interface. For this negotiation to function properly, the host container application must implement IOleInPlaceFrame correctly. For more information, search for "IOleInPlaceFrame" on MSDN.

When there is only a single instance of the control in your application, if you set the NegotiateMenus property to True and the NegotiateToolbars property to False, or vice versa, Visio task panes will not be displayed as expected. In order for Visio task panes to appear in the Visio Drawing Control, both properties must be set to the same value.

However, if your application uses multiple instances of the Visio Drawing Control, you can set either the NegotiateMenus property or the NegotiateToolbars property to True, but not both. If both properties are set to True when you are using multiple instances of the control in a single application, you will experience unexpected behavior.

Example

The following example shows how to set the NegotiateToolbars property at run time in the Form_Load() sub procedure of your Visual Basic program. For examples of how to display or modify one or more particular Visio toolbars, see the topics for the UIObject object and its member methods and properties, in this reference.

VBA Copy code Copy code
Private Sub Form_Load()

 vsoDrawingControl.NegotiateToolbars = True

End Sub


DrawingControl.PageSizingBehavior Property (Visio)

 Copy code hover
[image]

DrawingControl.PageSizingBehavior Property (Visio)
Send feedback

Published: July 16, 2012

Specifies how drawing pages and shapes in the Microsoft Visio Drawing Control react when the control is resized, usually when an existing drawing file is loaded into the control by means of the Src property. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .PageSizingBehavior

expression A variable that represents a DrawingControl object.

Return Value

VisPageSizingBehaviors

Remarks

Possible values for PageSizingBehavior are declared in the Visio type library in VisPageSizingBehaviors and shown in the following table.

Constant | Value | Description
visNeverResizePages | 0 | Does not automatically resize pages under any circumstances. The default.
visResizePages | 1 | Automatically resizes all pages when the Visio Drawing Control is resized or when a new document is loaded into it. Leaves shapes unchanged.

You can set the PageSizingBehavior property either at design time (for example, in the Properties window in Microsoft Visual Basic 6.0), or at run time, typically in the Form_Load() procedure. It is recommended that you set PageSizingBehavior at design time.

If PageSizingBehavior is set to visResizePages, when a new document is loaded into the Visio Drawing Control, the pages of that document are resized to match the size of the control itself. However, the shapes on those pages neither change size nor move; they retain their existing sizes and their locations relative to the coordinate system of the Visio page, which has its origin in the bottom left corner of the page.

If PageSizingBehavior is set to the default,visNeverResizePages, when a new document is loaded into the Visio Drawing Control, the pages of that document (and the shapes on the page) retain their existing size. In this case, the size of the control in the container application has no relation to the size of the pages it displays; it is simply an open "window" onto the page or pages.


DrawingControl.ShutdownBehavior Property (Visio)

 Copy code hover
[image]

DrawingControl.ShutdownBehavior Property (Visio)
See also Send feedback

Determines how the Visio Drawing Control unloads the Visio application when the DrawingControl object is released. Read/write Integer.

Version Information

Version Added: Visio 2013

Syntax

expression .ShutdownBehavior

expression A variable that represents a DrawingControl object.

Return value

Integer

Remarks

A value of 0 (the default) does not unload MSO dlls when the drawing control is released. A value of 1 unloads the Visio application and MSO dlls when the drawing control is released.

See also

Concepts

DrawingControl Object

Other resources

DrawingControl Members


DrawingControl.Src Property (Visio)

 Copy code hover
[image]

DrawingControl.Src Property (Visio)
Send feedback

Published: July 16, 2012

The full path, including file name, of the Microsoft Visio file used to initialize a DrawingControl object. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .Src

expression A variable that represents a DrawingControl object.

Return Value

String

Remarks

You can set the Src property either at design time (for example, in the Properties window in Microsoft Visual Basic 6.0), or at run time, typically in the Form_Load() procedure, as shown in the following example. It is recommended that you set Src at design time.

The source file can be any valid Visio file type, including .vsd, .vdx, .vss, .vsx, .vst, and .vtx. You can load a file that you distribute with your program or any other file that users have access to, including files on their computer, on their local network, or on the Web.

When it attempts to open a file you specify in the Src property, the Visio Drawing Control behaves in much the same way Visio does when it attempts to open a file; it first searches all the paths listed in the DrawingPaths property string. If the path to the file you want to open is listed in that string, you can specify just the file name. If not, you must specify a fully-qualified path and file name.

When you set the Src property to load a file into the Visio Drawing Control, the control opens a copy of the file, but does not keep the original file open for writing. As a result, you cannot use the Document.Save method to save changes to a file loaded into the Visio Drawing Control. To save changes in a file, first use the Src property to load the file into the control, and then set Src to an empty string (""). To save the modified file to disk, use the Document.SaveAs method.

If you do not set the Src property to an empty string after loading a drawing into the Visio Drawing Control, each time you close and reopen your application, the original drawing will be loaded, and any modifications you or your users have made will be lost.

Example

The following example shows how to set the Src property at run time in the Form_Load() sub procedure of your Visual Basic program. Before running this example, replace Fullpath\filename with the full path to and file name of the Visio file you want to display in the Visio Drawing Control window.

VBA Copy code Copy code
Private Sub Form_Load()

 vsoDrawingControl.Src = "Fullpath\filename"

End Sub


DrawingControl.Window Property (Visio)

 Copy code hover
[image]

DrawingControl.Window Property (Visio)
Send feedback

Published: July 16, 2012

Returns the window associated with an instance of the Microsoft Visio Drawing Control. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Window

expression A variable that represents a DrawingControl object.

Return Value

Window

Remarks

For the DrawingControl object, the Window property returns the window that the control is displaying. The value is valid only when the control is in place and active.

Example

The following macro shows how to use the Window property to print the caption of the window associated with the current instance of Visio in the Immediate window.

VBA Copy code Copy code

Public Sub Window_Example()

 Debug.Print Application.Window.Caption

End Sub


DrawingControl Events (Visio)

 Copy code hover
[image]

DrawingControl Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

None.


DrawingControl.AfterRemoveHiddenInformation Event (Visio)

 Copy code hover
[image]

DrawingControl.AfterRemoveHiddenInformation Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when hidden information is removed from the document.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _AfterRemoveHiddenInformation(ByVal doc As IVDOCUMENT)

expression An expression that returns a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document from which hidden information has been removed.

Remarks

The AfterRemoveHiddenInformation event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the AfterRemoveHiddenInformation event is fired, the EventInfo property returns a string that contains information about which items were removed from the document, consisting of the sum of applicable constant values from the VisRemoveHiddenInfoItems enumeration.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforeDataRecordsetDelete Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeDataRecordsetDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a DataRecordset object is deleted from the DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _BeforeDataRecordsetDelete(ByVal DataRecordset As IVDATARECORDSET)

expression An expression that returns a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforeDocumentClose Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeDocumentClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document is closed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeDocumentClose(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforeDocumentSave Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeDocumentSave Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document is saved.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _BeforeDocumentSave(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be saved.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforeDocumentSaveAs Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeDocumentSaveAs Event (Visio)
Send feedback

Published: July 16, 2012

Occurs just before a document is saved by using the Save As command.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _BeforeDocumentSaveAs(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be saved.

Remarks

The BeforeDocumentSaveAs event fires when a document is saved to either a native format (for example, VSD or VDX) or a non-native format (for example, HTM or BMP). It does not fire when a document is saved to DWG, DXF, and DGN formats. To save a document in a non-native format programmatically, you must use the Export method of the Page object. Note that when you call the SaveAs method, Microsoft Visio fires first the BeforeDocumentSaveAs event and then the DocumentSavedAs event. Calling the Export method, however, fires the BeforeDocumentSaveAs event but not the DocumentSavedAs event that follows it in response to the SaveAs method.

The BeforeDocumentSaveAs event is one of a group of events for which the EventInfo property of the Application object contains extra information.

If the BeforeDocumentSaveAs event is fired because a save was initiated by a user or a program, the EventInfo property returns the following string:

"/saveasfile=<filename>"

If it fires because Visio is saving a copy of an open file (for autorecovery or to include as a mail attachment), the EventInfo property will return one of the following strings:

  • If the event is fired for autorecovery purposes, the name of a recovery file in this format: "/autosavefile=C:\TEMP\~$2VSO2FD.vsd"

  • If the event is fired because a document copy is being made to send as a mail attachment, the name of an attachment file in this format: "/mailfile=C:\TEMP\~$2VSO2FD.vsd"

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection by using the AddAdvise method, the vMoreInfo argument to VisEventProc designates the document index: "/doc=1".


DrawingControl.BeforeMasterDelete Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a master is deleted from a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeMasterDelete(ByVal master As [IVMASTER])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforePageDelete Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforePageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a page is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforePageDelete(ByVal Page As [IVPAGE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforeSelectionDelete Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before selected objects are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selected objects that are going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. To find out if a shape is locked against deletion, check the value of its LockDelete cell.

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforeShapeTextEdit Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeShapeTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is opened for text editing in the user interface.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _BeforeShapeTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be opened for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforeStyleDelete Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a style is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforeWindowClosed Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeWindowClosed Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a window is closed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeWindowClosed(ByVal Window As [IVWINDOW])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforeWindowPageTurn Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeWindowPageTurn Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a window is about to show a different page.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeWindowPageTurn(ByVal Window As [IVWINDOW])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to show a different page.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.BeforeWindowSelDelete Event (Visio)

 Copy code hover
[image]

DrawingControl.BeforeWindowSelDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the shapes in the selection of a window are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeWindowSelDelete(ByVal Window As [IVWINDOW])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that contains the selection that is going to be deleted.

Remarks

The BeforeWindowSelDelete event fires if user interactions cause shapes in a window to be deleted. It doesn't fire if a program deletes shapes in a window by using the Cut method, for example.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.ConvertToGroupCanceled Event (Visio)

 Copy code hover
[image]

DrawingControl.ConvertToGroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ConvertToGroupCanceled(ByVal selection As [IVSELECTION])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.DataRecordsetAdded Event (Visio)

 Copy code hover
[image]

DrawingControl.DataRecordsetAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a DataRecordset object is added to a DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetAdded(ByVal DataRecordset As [IVDATARECORDSET])

expression An expression that returns a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that was added.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.DesignModeEntered Event (Visio)

 Copy code hover
[image]

DrawingControl.DesignModeEntered Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document enters design mode.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _DesignModeEntered(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to enter design mode.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.DocumentChanged Event (Visio)

 Copy code hover
[image]

DrawingControl.DocumentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after certain properties of a document are changed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentChanged(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document whose properties were changed.

Remarks

The DocumentChanged event indicates that one of a document's properties, such as Author or Description, has changed.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.DocumentCloseCanceled Event (Visio)

 Copy code hover
[image]

DrawingControl.DocumentCloseCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _DocumentCloseCanceled(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.DocumentCreated Event (Visio)

 Copy code hover
[image]

DrawingControl.DocumentCreated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is created.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentCreated(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was created.

Remarks

The DocumentCreated event is often added to the EventList collection of a Microsoft Visio template file (.vst). The event's action is triggered whenever a new document is created based on that template.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

You can add DocumentCreated events to the EventList collection of an Application object, Documents collection, or Document object. The first two are straightforward; if a document is opened or created in the scope of the Application object or its Documents collection, the DocumentCreated event occurs.

However, adding a DocumentCreated event to the EventList collection of a Document object makes sense only if the event's action is visActCodeRunAddon. In this case, the event is persistable; it can be stored with the document. If the document that contains the persistent event is opened, its action is triggered. If a new document is based on or copied from the document that contains the persistent event, the DocumentCreated event is copied to the new document and its action is triggered. However, if the event's action is visActCodeAdvise, that event is not persistable and therefore is not stored with the document; hence, it is never triggered.

You can prevent code from running in response to the DocumentCreated, DocumentOpened, or DocumentAdded event and all events from firing by setting the value of the EventsEnabled property of an Application object to False.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square.

The DocumentCreated event handler runs when a new drawing based on the template that contains this code is created. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentCreated(ByVal vsoDocument As Visio.IVDocument)

'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 'the shape was created locally.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


DrawingControl.DocumentOpened Event (Visio)

 Copy code hover
[image]

DrawingControl.DocumentOpened Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is opened.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentOpened(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was opened.

Remarks

The DocumentOpened event is often added to the EventList collection of a Microsoft Visio template file (.vst). The event's action is triggered whenever an existing document is opened.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

You can add DocumentOpened events to the EventList collection of an Application object, Documents collection, or Document object. The first two are straightforward—if a document is opened or created in the scope of the Application object or its Documents collection, the DocumentOpened event occurs.

However, adding a DocumentOpened event to the EventList collection of a Document object makes sense only if the event's action is visActCodeRunAddon. In this case, the event is persistable—it can be stored with the document. If the document that contains the persistent event is opened, its action is triggered. If a new document is based on or copied from the document that contains the persistent event, the DocumentOpened event is copied to the new document and its action is triggered. However, if the event's action is visActCodeAdvise, that event is not persistable and therefore is not stored with the document; hence it is never triggered.

You can prevent code from running in response to the DocumentCreated, DocumentOpened or DocumentAdded event and all events from firing by setting the value of the EventsEnabled property of an Application object to False.


DrawingControl.DocumentSaved Event (Visio)

 Copy code hover
[image]

DrawingControl.DocumentSaved Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is saved.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentSaved(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was saved.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


DrawingControl.DocumentSavedAs Event (Visio)

 Copy code hover
[image]

DrawingControl.DocumentSavedAs Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is saved by using the Save As command.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentSavedAs(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was saved.

Remarks

The DocumentSavedAs event is one of a group of events for which the EventInfo property of the Application object contains extra information.

If the DocumentSavedAs event is fired because a save was initiated by a user or a program, the EventInfo property returns the following string:

"/saveasfile=<filename>"

If it fires because Microsoft Visio is saving a copy of an open file (for autorecovery or to include as a mail attachment), the EventInfo property returns one of the following strings:

  • If the event is fired for autorecovery purposes, the name of a recovery file in this format: "/autosavefile=drivename:\foldername\filename"

  • If the event is fired because a document copy is being made to send as a mail attachment, the name of an attachment file in this format: "/mailfile=drivename:\foldername\filename"

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection created by using the AddAdvise method, the varMoreInfo argument to VisEventProc designates the document index: "/doc=1".


DrawingControl.GroupCanceled Event (Visio)

 Copy code hover
[image]

DrawingControl.GroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _GroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.KeyDown Event (Visio)

 Copy code hover
[image]

DrawingControl.KeyDown Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is pressed.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, ByVal CancelDefault As Boolean)

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | The key that was pressed. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the SHIFT and CTRL keys for the event. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 12, it indicates that the user held down both SHIFT and CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio does not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyDown does not have the prefix "Query," but it is still a query event. That is, you can cancel processing the message sent by KeyDown, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

Note Note

Pressing an accelererator key combination, for example, CTRL + C, does not fire the KeyDown event.

If you are using VBA, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyDown event. In the Immediate window, the handler prints the code of the key that was pressed to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


DrawingControl.KeyPress Event (Visio)

 Copy code hover
[image]

DrawingControl.KeyPress Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is pressed.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyPress(ByVal KeyAscii As Long, ByVal CancelDefault As Boolean)

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
KeyAscii | Required | Long | The ASCII value of the key that was pressed. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyAscii are the ASCII codes. To see a list of these codes, search for "ASCII character codes" on MSDN.

If you set CancelDefault to True, Visio does not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyPress does not have the prefix "Query," but it is still a query event. That is, you can cancel processing the message sent by KeyPress, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

Note Note

Pressing an accelererator key combination, for example, CTRL + C, does not fire the KeyPress event.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyPress event. In the Immediate window, the handler prints the ASCII code of the key that was pressed to fire the event.


DrawingControl.KeyUp Event (Visio)

 Copy code hover
[image]

DrawingControl.KeyUp Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is released.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, ByVal CancelDefault As Boolean)

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | The key that was released. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the SHIFT and CTRL keys for the event. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 12, it indicates that the user held down both SHIFT and CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyUp does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by KeyUp, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

If you are using Microsoft Visual Basic or VBA, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, press any key, and then release it to fire a KeyUp event. In the Immediate window, the handler prints the code of the key that was released to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


DrawingControl.MasterAdded Event (Visio)

 Copy code hover
[image]

DrawingControl.MasterAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new master is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterAdded(ByVal master As [IVMASTER])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.MasterChanged Event (Visio)

 Copy code hover
[image]

DrawingControl.MasterChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after properties of a master are changed and propagated to its instances.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterChanged(ByVal master As [IVMASTER])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master whose properties changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.MasterDeleteCanceled Event (Visio)

 Copy code hover
[image]

DrawingControl.MasterDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _MasterDeleteCanceled(ByVal master As [IVMASTER])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.MouseDown Event (Visio)

 Copy code hover
[image]

DrawingControl.MouseDown Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a mouse button is clicked.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was pressed. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseDown does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseDown, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseDown event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event.


DrawingControl.MouseMove Event (Visio)

 Copy code hover
[image]

DrawingControl.MouseMove Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the mouse is moved.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was clicked. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseMove does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseMove, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then move the mouse briefly in the active window to fire a series of MouseMove events. In the Immediate window, the handler prints a list of x- and y-position value pairs, each of which corresponds to the mouse position when a MouseMove event fired.


DrawingControl.MouseUp Event (Visio)

 Copy code hover
[image]

DrawingControl.MouseUp Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a mouse button is released.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was released. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseUp does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseUp, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseUp event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event.


DrawingControl.OnKeystrokeMessageForAddon Event (Visio)

 Copy code hover
[image]

DrawingControl.OnKeystrokeMessageForAddon Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.

Version Information

Version Added: Visio 2002

Syntax

Private Sub expression _OnKeystrokeMessageForAddon(ByVal MSG As [IVMSGWRAP])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
MSG | Required | [IVMSGWRAP] | The message that Visio receives.

Remarks

Returns True to indicate that the message was handled by the add-on. Otherwise, returns False.

The OnKeystrokeMessageForAddon event enables add-ons to intercept and process accelerator and keystroke messages directed at their own add-on windows and child windows of their add-on windows. Only add-on windows created using the Add method will source this event.

For this event to fire, the add-on window or one of its child windows must have keystroke focus and the Visio message loop must receive the keystroke message. This event does not fire if the message loop associated with an add-on is handling messages instead of Visio.

Visio fires the OnKeystrokeMessageForAddon event when it receives messages in the following range:

WM_KEYDOWN | 0x0100
WM_KEYUP | 0x0101
WM_CHAR | 0x0102
WM_DEADCHAR | 0x0103
WM_SYSKEYDOWN | 0x0104
WM_SYSKEYUP | 0x0105
WM_SYSCHAR | 0x0106
WM_SYSDEADCHAR | 0x0107

The MSGWrap object, passed to the event handler when the OnKeystrokeMessageForAddon event fires, wraps the Microsoft Windows MSG structure, which contains message data. See the MSGWrap object for more information, or refer to your Windows documentation.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.PageAdded Event (Visio)

 Copy code hover
[image]

DrawingControl.PageAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new page is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageAdded(ByVal page As [IVPAGE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was added.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


DrawingControl.PageChanged Event (Visio)

 Copy code hover
[image]

DrawingControl.PageChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageChanged(ByVal page As [IVPAGE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that changed.

Remarks

If several pages of a document have default names and any page but the last is deleted, Microsoft Visio will automatically rename the remaining pages to preserve the naming sequence, but the renaming will not trigger the PageChanged event. For example, if a document contains Page-1, Page-2, and Page-3, and then Page-1 is deleted, Page-2 will be renamed Page-1, and Page-3 will be renamed Page-2, but no PageChanged event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.PageDeleteCanceled Event (Visio)

 Copy code hover
[image]

DrawingControl.PageDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _PageDeleteCanceled(ByVal page As [IVPAGE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was going to be deleted.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.QueryCancelConvertToGroup Event (Visio)

 Copy code hover
[image]

DrawingControl.QueryCancelConvertToGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelConvertToGroup(ByVal selection As [IVSELECTION])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be converted to a group.

Remarks

A Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • If all handlers return False (don't cancel), the conversion is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.QueryCancelDocumentClose Event (Visio)

 Copy code hover
[image]

DrawingControl.QueryCancelDocumentClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelDocumentClose(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be closed.

Remarks

A Microsoft Visio instance fires QueryCancelDocumentClose after the user has directed the instance to close a document.

  • If any event handler returns True (cancel), the instance fires DocumentCloseCanceled and does not close the document.

  • If all handlers return False (don't cancel), the instance firesBeforeDocumentClose and then closes the document.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.QueryCancelGroup Event (Visio)

 Copy code hover
[image]

DrawingControl.QueryCancelGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be grouped.

Remarks

A Microsoft Visio instance fires QueryCancelGroup after the user has directed the instance to group a selection of shapes.

  • If any event handler returns True (cancel), the instance fires GroupCanceled and does not group the shapes.

  • If all handlers return False (don't cancel), the grouping is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is grouped, the initial shape will be deleted and replaced with new shapes. In such cases, the Visio instance will subsequently fire BeforeSelectionDelete and BeforeShapeDelete events before grouping the shapes.

While a Visio instance is firing a query or cancel event, it will respond to inquiries from client code but will refuse to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.QueryCancelMasterDelete Event (Visio)

 Copy code hover
[image]

DrawingControl.QueryCancelMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelMasterDelete(ByVal master As [IVMASTER])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelMasterDelete after the user has directed the instance to delete a master.

  • If any event handler returns True (cancel), the instance fires MasterDeleteCanceled and does not delete the master.

  • If all handlers return False (don't cancel), the instance fires BeforeMasterDelete and then deletes the master.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.QueryCancelPageDelete Event (Visio)

 Copy code hover
[image]

DrawingControl.QueryCancelPageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelPageDelete(ByVal page As [IVPAGE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

A Visio instance fires QueryCancelPageDelete after the user has directed the instance to delete a page.

  • If any event handler returns True (cancel), the instance fires PageDeleteCanceled and does not delete the page.

  • If all handlers return False (don't cancel) the instance fires BeforePageDelete and then deletes the page.

While a Microsoft Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.QueryCancelSelectionDelete Event (Visio)

 Copy code hover
[image]

DrawingControl.QueryCancelSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelSelectionDelete(ByVal selection As [IVSELECTION])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelSelectionDelete after the user has directed the instance to delete one or more shapes.

  • If any event handler returns True (cancel), the instance fires SelectionDeleteCanceled and does not delete the shapes.

  • If all handlers returnFalse (don't cancel), the instance fires BeforeSelectionDelete and BeforeShapeDelete and then deletes the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.QueryCancelStyleDelete Event (Visio)

 Copy code hover
[image]

DrawingControl.QueryCancelStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelStyleDelete(ByVal style As [IVSTYLE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelStyleDelete after the user has directed the instance to delete a style.

  • If any event handler returns True (cancel), the instance fires StyleDeleteCanceled and does not delete the style.

  • If all handlers return False (don't cancel), the instance fires BeforeStyleDelete and then deletes the style.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.QueryCancelUngroup Event (Visio)

 Copy code hover
[image]

DrawingControl.QueryCancelUngroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelUngroup(ByVal selection As [IVSELECTION])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be ungrouped.

Remarks

A Microsoft Visio instance fires QueryCancelUngroup after the user has directed the instance to ungroup one or more shapes.

  • If any event handler returns True (cancel), the instance fires UngroupCanceled and does not ungroup the shapes.

  • If all handlers return False (don't cancel), the instance fires ShapeParentChanged, BeforeSelectionDelete, and BeforeShapeDelete, and then ungroups the shapes.

While a Visio instance is firing a query or cancel event, it respondsto inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.QueryCancelWindowClose Event (Visio)

 Copy code hover
[image]

DrawingControl.QueryCancelWindowClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelWindowClose(ByVal Window As [IVWINDOW])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to be closed.

Remarks

A Microsoft Visio instance fires QueryCancelWindowClose after the user has directed the instance to close a window.

  • If any event handler returns True (cancel), the instance fires WindowCloseCanceled and does not close the window.

  • If all handlers return False (don't cancel), the instance fires BeforeWindowClosed and then closes the window.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but it refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.RunModeEntered Event (Visio)

 Copy code hover
[image]

DrawingControl.RunModeEntered Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document enters run mode.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _RunModeEntered(ByVal doc As [IVDOCUMENT])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that entered run mode.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.SelectionChanged Event (Visio)

 Copy code hover
[image]

DrawingControl.SelectionChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a set of shapes selected in a window changes.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionChanged(ByVal Window As [IVWINDOW])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window in which the selection changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.SelectionDeleteCanceled Event (Visio)

 Copy code hover
[image]

DrawingControl.SelectionDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _SelectionDeleteCanceled(ByVal selection As [IVSELECTION])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.ShapeAdded Event (Visio)

 Copy code hover
[image]

DrawingControl.ShapeAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _ShapeAdded(ByVal shape As [IVSHAPE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape or group of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the ShapeAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

To determine if a ShapeAdded event was triggered by a new shape or group of shapes being added to the page, by a set of existing shapes being grouped, or by a paste action, you can use the Application.IsInScope property. If IsInScope returns True when passed visCmdObjectGroup, the ShapeAdded event was triggered by a grouping action. If IsInScope returns True when passed visCmdUFEditPaste or visCmdEditPasteSpecial, the ShapeAdded event was triggered by a paste operation. If IsInScope returns False when passed all of these arguments, the event must have been triggered by new shapes being added to the page.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square. Paste the code into the active document's project in Visio.

The DocumentSaved event handler runs when the active document is saved. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentSaved(ByVal vsoDocument As Visio.IVDocument)

 'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 'the shape was created locally.
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


DrawingControl.ShapeDataGraphicChanged Event (Visio)

 Copy code hover
[image]

DrawingControl.ShapeDataGraphicChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a data graphic is applied to or deleted from a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeDataGraphicChanged(ByVal Shape As IVSHAPE)

expression An expression that returns a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape to which the data graphic was applied or from which it was deleted.

Remarks

A data graphic is a Master object of type visTypeDataGraphic. When the same master that is already applied to a shape is re-applied to the shape, the ShapeDataGraphicChanged event does not fire, even if the master has been modified since it was applied originally. If, however, a different data graphic master is applied to the shape, the event does fire.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.ShapeExitedTextEdit Event (Visio)

 Copy code hover
[image]

DrawingControl.ShapeExitedTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is no longer open for interactive text editing.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeExitedTextEdit(ByVal shape As [IVSHAPE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that was closed for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.ShapeParentChanged Event (Visio)

 Copy code hover
[image]

DrawingControl.ShapeParentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after shapes are grouped or a group is ungrouped.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeParentChanged(ByVal shape As [IVSHAPE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose parent changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.StyleAdded Event (Visio)

 Copy code hover
[image]

DrawingControl.StyleAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new style is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleAdded(ByVal style As [IVSTYLE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.StyleChanged Event (Visio)

 Copy code hover
[image]

DrawingControl.StyleChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleChanged(ByVal Style As [IVSTYLE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.StyleDeleteCanceled Event (Visio)

 Copy code hover
[image]

DrawingControl.StyleDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _StyleDeleteCanceled(ByVal style As [IVSTYLE])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.UngroupCanceled Event (Visio)

 Copy code hover
[image]

DrawingControl.UngroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _UngroupCanceled(ByVal selection As [IVSELECTION])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be ungrouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.ViewChanged Event (Visio)

 Copy code hover
[image]

DrawingControl.ViewChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the zoom level or scroll position of a drawing window changes.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ViewChanged(ByVal Window As [IVWINDOW])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window whose zoom level or scroll position changed.

Remarks

This event fires whenever the zoom level or scroll position of a Window object of the type visDrawing changes.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.WindowActivated Event (Visio)

 Copy code hover
[image]

DrawingControl.WindowActivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the active window changes in a Microsoft Visio instance.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _WindowActivated(ByVal Window As [IVWINDOW])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that was activated.

Remarks

The WindowActivated event indicates that the active window has changed in a Visio instance. This event implies that the ActiveDocument and ActivePage properties of the Application object may also have changed; in contrast, any time the ActiveDocument or ActivePage property changes, a WindowActivated event is always generated.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.WindowChanged Event (Visio)

 Copy code hover
[image]

DrawingControl.WindowChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the size or position of a window changes.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _WindowChanged(ByVal Window As [IVWINDOW])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window whose size or position has changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.WindowCloseCanceled Event (Visio)

 Copy code hover
[image]

DrawingControl.WindowCloseCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _WindowCloseCanceled(ByVal Window As [IVWINDOW])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that was going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


DrawingControl.WindowTurnedToPage Event (Visio)

 Copy code hover
[image]

DrawingControl.WindowTurnedToPage Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a window shows a different page.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _WindowTurnedToPage(ByVal Window As [IVWINDOW])

expression A variable that represents a DrawingControl object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that shows a different page.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Event Object (Visio)

 Copy code hover
[image]

Event Object (Visio)
Send feedback

Published: July 16, 2012

A member of the EventList collection of a source object such as a Document. An event encapsulates an event code.

Version Information

Version Added: Visio 4.0

Remarks

An Event object can trigger two kinds of actions: it can run an add-on, or it can send a notification of the event to the calling program. To create an Event object, use the Add or AddAdvise method of an EventList object.

The default property of an Event object is Event.

The Event property of the Event object establishes the event that triggers the action, and its Action property indicates the action to be performed.

Use the Persistable property to find out if the event can be stored with a Microsoft Visio document, or the Persistent property to find out if the event is stored. Use the Trigger method to trigger an Event object's action without waiting for the event to occur. Use the Enabled property to temporarily disable an event.


Event Members (Visio)

 Copy code hover
[image]

Event Members (Visio)
Send feedback

Published: July 16, 2012

A member of the EventList collection of a source object such as a Document. An event encapsulates an event code.

Methods

Name | Description
Delete | Deletes an object.
GetFilterActions | Returns an array of the filter actions set for the Event object.
GetFilterCommands | Returns an array of command ranges and a True or False value indicating how to filter events for that command range.
GetFilterObjects | Returns an array of object types and a True or False value indicating how to filter events for that object.
GetFilterSRC | Returns an array of cell ranges and a True or False value indicating whether you are filtering events for that range.
SetFilterActions | Specifies the extensions to the MouseMove event that Visio reports.
SetFilterCommands | Specifies an array of command ranges and a True or False value indicating how to filter events for each command range.
SetFilterObjects | Specifies an array of object types and a True or False value indicating how to filter events for each object.
SetFilterSRC | Specifies an array of cell ranges and a True or False value indicating how to filter events for each cell range.
Trigger | Causes an event's action to be performed.

Properties

Name | Description
Action | Gets or sets the action code of an Event object. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Enabled | Determines whether or not an Event object is currently enabled. Read/write.
Event | Gets or sets the event code of an Event object—an event-action pair. When the event occurs, the action is performed. Read/write.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of an Event object in the EventList collection. Read-only.
ObjectType | Returns an object's type. Read-only.
Persistable | Determines whether an event can potentially persist within its document. Read-only.
Persistent | Determines whether an event persists with its document. Read/write.
Target | Gets or sets the target of an event. Read/write.
TargetArgs | Gets or sets the arguments to be sent to the target of an event. Read/write.


Event Properties (Visio)

 Copy code hover
[image]

Event Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Action | Gets or sets the action code of an Event object. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Enabled | Determines whether or not an Event object is currently enabled. Read/write.
Event | Gets or sets the event code of an Event object—an event-action pair. When the event occurs, the action is performed. Read/write.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of an Event object in the EventList collection. Read-only.
ObjectType | Returns an object's type. Read-only.
Persistable | Determines whether an event can potentially persist within its document. Read-only.
Persistent | Determines whether an event persists with its document. Read/write.
Target | Gets or sets the target of an event. Read/write.
TargetArgs | Gets or sets the arguments to be sent to the target of an event. Read/write.


Event.Action Property (Visio)

 Copy code hover
[image]

Event.Action Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the action code of an Event object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Action

expression A variable that represents a Event object.

Return Value

Integer

Remarks

An Event object consists of an event-action pair; an event triggers an action. An action code is the numeric constant for the action that the event triggers.

Microsoft Visio supports the following action codes.

Constant | Value
visActCodeRunAddon | 1
visActCodeAdvise | 2


Event.Application Property (Visio)

 Copy code hover
[image]

Event.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents an Event object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Event.Enabled Property (Visio)

 Copy code hover
[image]

Event.Enabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether or not an Event object is currently enabled. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Enabled

expression A variable that represents an Event object.

Return Value

Integer

Remarks

You can get and set the Enabled property of an Event object. An Event object that is disabled does not perform its action when its event occurs.


Event.Event Property (Visio)

 Copy code hover
[image]

Event.Event Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the event code of an Event object—an event-action pair. When the event occurs, the action is performed. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Event

expression A variable that represents a Event object.

Return Value

Integer

Remarks

If the action code of the Event object is visActCodeRunAddon, the event also specifies the target of the action and the arguments to send to the target. This information is stored in the Target and TargetArgs properties, respectively.

If the action code of the Event object is visActCodeAdvise, the event also specifies the object to receive event notifications (sometimes called the sink object) and arguments to send to the sink object along with the notification.

Event codes are declared by the Microsoft Visio type library in VisEventCodes. They are prefixed with "visEvt". For a list of event codes, see Event Codes.

A program can use the Trigger method to cause an Event object's action to be performed without waiting for the event to occur.


Event.EventList Property (Visio)

 Copy code hover
[image]

Event.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents an Event object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Event.ID Property (Visio)

 Copy code hover
[image]

Event.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ID of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ID

expression A variable that represents an Event object.

Return Value

Long

Remarks

The ID of a shape is unique only within the scope of the page or master. The ID of a page, master, or style is unique within the scope of the document.

If a shape, page, master, or style is deleted, future objects in the same scope may be assigned the same ID. Therefore, persisting shape or style IDs in separate data stores is generally not as sound as persisting unique IDs using the UniqueID property.

For Shape objects, you can use the ID property with methods such as GetResults and SetResults to get or set many cell values at once, possibly cells in many different shapes. To do this, you must pass shape IDs to the methods. If you create shapes by using the DropMany method, the method returns the IDs of the shapes it creates to your program.

For Font objects, the ID property corresponds to the number stored in the Font cell of the row in a shape's Character Properties section. For example, to apply the font named "Arial" to a shape's text, create a Font object that represents "Arial," get the ID of that font, and then set the CharProps property of the Shape object to that ID.

The ID associated with a particular font varies from system to system or as fonts are installed and removed on a given system.

For Window objects, the ID property can be used with the ItemFromID property of a Windows collection to retrieve a Window object from the collection without iterating through the collection. A Window object whose Type property is set to visAnchorBarBuiltIn returns an ID of visWinIDCustProp, visWinIDDrawingExplorer, visWinIDFormulaTracing, visWinIDMasterExplorer, visWinIDPanZoom, visWinIDSizePos, or visWinIDStencilExplorer. A Window object whose Type property is set to visAnchorBarAddon returns an ID that is unique within its Windows collection for the lifetime of that collection. If a Window object has an ID of visInvalWinID, you cannot use the ItemFromID property to retrieve the Window object from its collection.

For Event objects, the ID property uniquely identifies an Event object in its EventList collection. As long as a reference is held on an EventList collection or on the source object of an EventList collection, you can cache the ID property of any Event object in the list. Even if other events are added to or removed from the list, the cached ID can be used later to identify the original event. If an event is persistent, its ID can be cached indefinitely. While the event with that ID might be removed, no new Event object in the same EventList collection is given the same ID.


Event.Index Property (Visio)

 Copy code hover
[image]

Event.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of an Event object in the EventList collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Event object.

Return Value

Integer

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Event.ObjectType Property (Visio)

 Copy code hover
[image]

Event.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents an Event object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Event.Persistable Property (Visio)

 Copy code hover
[image]

Event.Persistable Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an event can potentially persist within its document. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .Persistable

expression A variable that represents a Event object.

Return Value

Integer

Remarks

The Persistable property of an Event object indicates whether the event can persist, that is, whether the Event object can be stored with a Microsoft Visio document between executions of a program. An Event object can persist if the following conditions are true:

  1. The action code of the Event object must be visActCodeRunAddon. If the action code is visActCodeAdvise, the event won't persist and must be re-created by a program at run time.

  2. The source object must be capable of containing persistent events in its EventList collection. The source object's PersistsEvents property indicates whether it can contain persistent events. The only source objects currently capable of containing persistent events are Document, Master, and Page objects.

If these conditions are met, any of the following events are persistable:

  • BeforeMasterDelete

  • BeforePageDelete

  • BeforeShapeDelete

  • DocumentOpened

  • DocumentCreated

  • MasterAdded

  • PageAdded

Although an Event object's Persistable property indicates whether an event can persist, its Persistent property indicates whether that event actually persists. When an Event object is first created, its Persistent property is set to the same value as its Persistable property. That is, a persistable event's Persistent property is set to True, and a nonpersistable event's Persistent property is set to False.

A nonpersistent event exists as long as a reference is held on the Event object, the EventList object that contains the Event object, or the source object that has the EventList object. When the last reference to any of these objects is released, the nonpersistent event ceases to exist.

You can change the initial setting for a persistable event by setting its Persistent property to False. In this case, the event doesn't persist with its document, even though it could. However, you cannot change the Persistent property of a nonpersistent event; attempting to do so will cause an exception.

Note Note

Events handled in a Microsoft Visual Basic for Applications (VBA) project are persistent.


Event.Persistent Property (Visio)

 Copy code hover
[image]

Event.Persistent Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an event persists with its document. Read/write.

Version Information

Version Added: Visio 4.1

Syntax

expression .Persistent

expression A variable that represents a Event object.

Return Value

Integer

Remarks

An event is persistable if its action code is visActCodeRunAddon and the event's source object is capable of containing persistent events.

When an event is first created, its Persistent property is set to the same value as its Persistable property; if an event can persist, Microsoft Visio assumes it should persist. You can change the initial setting for a persistable event by setting its Persistent property to False. However, you cannot change the Persistent property of a nonpersistable event—attempting to do so causes an exception.

A nonpersistent event exists as long as a reference is held on the Event object, the EventList object that contains the Event object, or the source object that has the EventList object. When the last reference to any of these objects is released, the nonpersistent event ceases to exist.

A persistent event exists until its Event object is deleted from the source object's EventList collection.

Note Note

Events handled in a Microsoft Visual Basic for Applications (VBA) project are persistent.


Event.Target Property (Visio)

 Copy code hover
[image]

Event.Target Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the target of an event. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Target

expression A variable that represents a Event object.

Return Value

String

Remarks

An event consists of an event-action pair. When the event occurs, the action is performed. An event also specifies the target of the action and arguments to send to the target.

If the action code of the event is visActCodeRunAddon, the Target property contains the name of the add-on to run.

If the action code of the event is visActCodeAdvise, the Target property is not available. Attempting to get or set the Target property for such an event causes an exception.


Event.TargetArgs Property (Visio)

 Copy code hover
[image]

Event.TargetArgs Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the arguments to be sent to the target of an event. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TargetArgs

expression A variable that represents a Event object.

Return Value

String

Remarks

An event consists of an event-action pair. When the event occurs, the action is performed. An event also specifies the target of the action and arguments to send to the target.

When you use visActCodeRunAddon, the TargetArgs property contains the arguments to send to the add-on when it is run.

When you use visActCodeAdvise, the TargetArgs property contains the string specified with the AddAdvise method when the Event object was created. When the program receives notification of the event, it can get the Event object and its TargetArgs property to obtain the string.


Event Methods (Visio)

 Copy code hover
[image]

Event Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.
GetFilterActions | Returns an array of the filter actions set for the Event object.
GetFilterCommands | Returns an array of command ranges and a True or False value indicating how to filter events for that command range.
GetFilterObjects | Returns an array of object types and a True or False value indicating how to filter events for that object.
GetFilterSRC | Returns an array of cell ranges and a True or False value indicating whether you are filtering events for that range.
SetFilterActions | Specifies the extensions to the MouseMove event that Visio reports.
SetFilterCommands | Specifies an array of command ranges and a True or False value indicating how to filter events for each command range.
SetFilterObjects | Specifies an array of object types and a True or False value indicating how to filter events for each object.
SetFilterSRC | Specifies an array of cell ranges and a True or False value indicating how to filter events for each cell range.
Trigger | Causes an event's action to be performed.


Event.Delete Method (Visio)

 Copy code hover
[image]

Event.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents an Event object.

Return Value

Nothing


Event.GetFilterActions Method (Visio)

 Copy code hover
[image]

Event.GetFilterActions Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of the filter actions set for the Event object.

Version Information

Version Added: Visio 2007

Syntax

expression .GetFilterActions

expression An expression that returns a Event object.

Return Value

Long()

Remarks

The event filters described in the array returned by the GetFilterActions method provide developers a way of ignoring specified mouse-event extensions based on extension (action) type. The array returned is that passed to the SetFilterActions method for this Event object. The array that is returned by the GetFilterActions method can be interpreted in the following manner.

The number of elements in the array is a multiple of 3, as follows:

  • The first element contains the beginning mouse action (MouseMove event extension) of the range (any member of VisFilterActions ).

  • The second element contains the end mouse action (MouseMove event extension) of the range (any member of VisFilterActions whose value is higher than that of the first element ).

  • The third element contains a True or False value indicating whether you want to listen to events for that action range (True to listen to events of a certain sub-type, or MouseMove event extension; False to exclude an event sub-type).

The filter actions that are returned in the first and second array elements of each element triplet are defined in the VisFilterActions enumeration, which is declared in the Visio type library, and shown in the following table. Note that mouse actions that occupy the second position in an array-element triplet will always be later in the sequence (that is, higher in value) than those that occupy the first position in an array-element triplet.

Constant | Value | Description
visFilterMouseMoveDragBegin | 1 | Filter the DragBegin extension of the MouseMove event.
visFilterMouseMoveDragDrop | 5 | Filter the DragDrop extension of the MouseMove event.
visFilterMouseMoveDragEnter | 2 | Filter the DragEnter extension of the MouseMove event.
visFilterMouseMoveDragLeave | 4 | Filter the DragLeave extension of the MouseMove event.
visFilterMouseMoveDragOver | 3 | Filter the DragOver extension of the MouseMove event.
visFilterMouseMoveNoDrag | 0 | Do not filter any extensions of the MouseMove event.

For more information about using event extensions to define filter actions, see the SetFilterActions method.


Event.GetFilterCommands Method (Visio)

 Copy code hover
[image]

Event.GetFilterCommands Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of command ranges and a True or False value indicating how to filter events for that command range.

Version Information

Version Added: Visio 2002

Syntax

expression .GetFilterCommands

expression A variable that represents an Event object.

Return Value

Long()

Remarks

The event filters described in the array returned by the GetFilterCommands method provide developers a way of ignoring specified events based on command ID. The array returned is that passed to the SetFilterCommands method for this Event object.

The array that is returned by the GetFilterCommands method can be interpreted in the following manner:

The number of elements in the array is a multiple of 3, as follows:

  • The first element contains the beginning command ID of the range (any member of VisUICmds).

  • The second element contains the end command ID of the range (any member of VisUICmds ).

  • The third element contains a True or False value, which indicates whether you are listening to events for that command range (True to listen to events; False to exclude events).

For an event to successfully pass through a command filter, it must satisfy the following criteria:

  • It must have a valid command ID.

  • If all filters are True, the event must match at least one filter.

  • If all filters are False, the event must not match any filter.

  • If the filters are a mixture of True and False, the event must match at least one True filter and not match any False filters.

If there are no True ranges defined in the array, events are considered True.

For details about using command IDs to define event filters, see the SetFilterCommands method.


Event.GetFilterObjects Method (Visio)

 Copy code hover
[image]

Event.GetFilterObjects Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of object types and a True or False value indicating how to filter events for that object.

Version Information

Version Added: Visio 2002

Syntax

expression .GetFilterObjects

expression A variable that represents an Event object.

Return Value

Long()

Remarks

The event filters described in the array returned by the GetFilterObjects method provide developers a way of ignoring specified events based on object type. The array returned is that passed to the SetFilterObjects method for this Event object.

The array that is returned by the GetFilterObjects method can be interpreted in the following manner.

The number of elements in the array is a multiple of 2:

  • The first element contains an object type (one of visTypePage , visTypeGroup , visTypeShape , visTypeForeignObject , visTypeGuide , or visTypeDoc ).

  • The second element contains a True or False value indicating whether you are listening to events for that object (True to listen to an object's events; False to exclude an object's events).

For an event to successfully pass through an object event filter, it must satisfy the following criteria:

  • It must be a valid object type.

  • If all filters are True, the event must match at least one filter.

  • If all filters are False, the event must not match any filter.

  • If the filters are a mixture of True and False, the event must match at least one True filter and not match any False filters.

If there are no True ranges defined in the array, events are considered True.

For details about defining event filters using command IDs, see the SetFilterObjects method.


Event.GetFilterSRC Method (Visio)

 Copy code hover
[image]

Event.GetFilterSRC Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of cell ranges and a True or False value indicating whether you are filtering events for that range.

Version Information

Version Added: Visio 2002

Syntax

expression .GetFilterSRC

expression A variable that represents an Event object.

Return Value

Integer()

Remarks

The event filters described in the array returned by the GetFilterSRC method provide developers a way of ignoring specified events based on object type. The array returned is that passed to the SetFilterSRC method for this Event object.

The array that is returned by the GetFilterSRC method can be interpreted in the following manner.

The number of elements in the array is a multiple of 7. These seven elements contain the following values:

  • The first three elements describe the section, row, and cell of the beginning cell of the range.

  • The next three elements describe the section, row, and cell of the end cell of the range.

  • The last element contains a True or False value indicating whether you want to receive events for the specified range of cells (True to listen to events for a range of cells; False to exclude events for the range of cells).

For an event to successfully pass through a cell range filter, it must satisfy the following criteria:

  • It must be a valid section, row, cell reference.

  • If all filters are True, the event must match at least one filter.

  • If all filters are False, the event must not match any filter.

  • If the filters are a mixture of True and False, the event must match at least one True filter and not match any False filters.

If there are no True ranges defined in the array, events are considered True.

For details about using command IDs to define event filters, see the SetFilterSRC method.


Event.SetFilterActions Method (Visio)

 Copy code hover
[image]

Event.SetFilterActions Method (Visio)
Send feedback

Published: July 16, 2012

Specifies the extensions to the MouseMove event that Visio reports.

Version Information

Version Added: Visio 2007

Syntax

expression .SetFilterActions(filterActionStream())

expression An expression that returns a Event object.

Parameters

Name | Required/Optional | Data Type | Description
filterActionStream() | Required | Long | An array of action/value pairs. For more information, see Remarks.

Return Value

Nothing

Remarks

The SetFilterActions method provides a way of ignoring selected extensions of the MouseMove event based on extension type. Extension types are based on mouse actions that are part of a drag and drop operation, as shown in the table below. By default, Visio reports firings of all event extensions.

The filterActionStream parameter is an array defined in the following way. The number of elements in filterActionStream is a multiple of 3:

  • The first element contains the beginning mouse action (MouseMove event extension) of the range (any member of VisFilterActions ).

  • The second element contains the end mouse action (MouseMove event extension) of the range (any member of VisFilterActions whose value is higher than that of the first element ).

  • The third element contains a True or False value indicating whether you want to listen to events for that action range (True to listen to events of a certain sub-type, or MouseMove event extension; False to exclude an event sub-type).

The filter actions that you can place in the first and second array elements of each element triplet are defined in the VisFilterActions enumeration, which is declared in the Visio type library, and shown in the following table.

Constant | Value | Description
visFilterMouseMoveDragBegin | 1 | Filter the DragBegin extension of the MouseMove event.
visFilterMouseMoveDragDrop | 5 | Filter the DragDrop extension of the MouseMove event.
visFilterMouseMoveDragEnter | 2 | Filter the DragEnter extension of the MouseMove event.
visFilterMouseMoveDragLeave | 4 | Filter the DragLeave extension of the MouseMove event.
visFilterMouseMoveDragOver | 3 | Filter the DragOver extension of the MouseMove event.
visFilterMouseMoveNoDrag | 0 | Do not filter any extensions of the MouseMove event.

For example, if you want to listen to all MouseEvent extensions except the DragOver event extension, you can build an array like the following:

VBA Copy code Copy code
Dim alngFilterActions(1 to 1 * 3) As Long
    alngFilterActions(1) = visFilterMouseMoveDragDrop
    alngFilterActions(2) = visFilterMouseMoveDragDrop
    alngFilterActions(3) = False

Or, to listen only to the DragEnter event extension, ignoring mouse actions that come before and after, set up an array like the following:

VBA Copy code Copy code
Dim alngFilterActions(1 To (3 * 3)) As Long

    'Listen to the "DragEnter" mouse action.
    alngFilterActions(1) = visFilterMouseMoveDragEnter
    alngFilterActions(2) = visFilterMouseMoveDragEnter
    alngFilterActions(3) = True

    'Ignore any mouse actions before "DragEnter."
    alngFilterActions(4) = visFilterMouseMoveDragBegin
    alngFilterActions(5) = visFilterMouseMoveDragEnter  - 1
    alngFilterActions(6) = False

    'Ignore any mouse actions after "DragEnter."
    alngFilterActions(7) = visFilterMouseMoveDragEnter + 1
    alngFilterActions(8) = visFilterMouseMoveDragDrop
    alngFilterActions(9) = False

Note that mouse actions that occupy the second position in an array-element triplet must always be later in the sequence (that is, higher in value) than those that occupy the first position in an array-element triplet.


Event.SetFilterCommands Method (Visio)

 Copy code hover
[image]

Event.SetFilterCommands Method (Visio)
Send feedback

Published: July 16, 2012

Specifies an array of command ranges and a True or False value indicating how to filter events for each command range.

Version Information

Version Added: Visio 2002

Syntax

expression .SetFilterCommands(Commands())

expression A variable that represents an Event object.

Parameters

Name | Required/Optional | Data Type | Description
Commands() | Required | Long | An array of command ranges and a True or False value specifying how to filter events for each command range.

Return Value

Nothing

Remarks

When an Event object created with the AddAdvise method is added to the EventList collection of a source object, the default behavior is that all occurrences of that event are passed to the event sink. The SetFilterCommands method provides a way of ignoring selected events based on command ID.

The Commands() parameter passed to SetFilterCommands is an array defined in the following way.

The number of elements in Commands() is a multiple of 3:

  • The first element contains the beginning command ID of the range (any member of VisUICmds).

  • The second element contains the end command ID of the range (any member of VisUICmds).

  • The third element contains a True or False value, which indicates whether you are listening to events for that command range (True to listen to events; False to exclude events).

For an event to successfully pass through a command filter, it must satisfy the following criteria:

  • It must have a valid command ID.

  • If all filters are True, the event must match at least one filter.

  • If all filters are False, the event must not match any filter.

  • If the filters are a mixture of True and False, the event must match at least one True filter and not match any False filters.

If there are no True ranges in the array, events are considered True.

For example, to set up an array that blocks out a single command, use the following:

VBA Copy code Copy code

    Dim aFilterCommands(1 To (1 * 3)) As Long

    'Ignore the layout command.
    aFilterCommands(1) = visCmdLayoutDynamic
    aFilterCommands(2) = visCmdLayoutDynamic
    aFilterCommands(3) = False

Or, to set up an array that listens only to the Send to Back command:

VBA Copy code Copy code

    Dim aFilterCommands(1 To (3 * 3)) As Long

    'Pay attention to the "Send to Back" command.
    aFilterCommands(1) = visCmdObjectSendToBack
    aFilterCommands(2) = visCmdObjectSendToBack
    aFilterCommands(3) = True

    'Ignore any command IDs before the "Send to Back" command.
    aFilterCommands(4) = visCmdFirst
    aFilterCommands(5) = visCmdObjectSendToBack - 1
    aFilterCommands(6) = False

    'Ignore any command IDs after the "Send to Back" command.
    aFilterCommands(7) = visCmdObjectSendToBack + 1
    aFilterCommands(8) = visCmdLast
    aFilterCommands(9) = False


Event.SetFilterObjects Method (Visio)

 Copy code hover
[image]

Event.SetFilterObjects Method (Visio)
Send feedback

Published: July 16, 2012

Specifies an array of object types and a True or False value indicating how to filter events for each object.

Version Information

Version Added: Visio 2002

Syntax

expression .SetFilterObjects(Objects())

expression A variable that represents an Event object.

Parameters

Name | Required/Optional | Data Type | Description
Objects() | Required | Long | An array of objects types and a True or False value specifying how to filter events for each object type.

Return Value

Nothing

Remarks

When an Event object created with the AddAdvise method is added to the EventList collection of a source object, the default behavior is that all occurrences of that event are passed to the event sink. The SetFilterObjects method provides a way to ignore selected events based on object type.

The Objects() parameter passed to SetFilterObjects is an array defined in the following manner.

The number of elements in the array is a multiple of 2:

  • The first element contains an object type (one of visTypePage, visTypeGroup, visTypeShape, visTypeForeignObject, visTypeGuide, or visTypeDoc).

  • The second element contains a True or False value indicating whether you are listening to events for that object (True to listen to an object's events; False to exclude an object's events).

For an event to successfully pass through an object event filter, it must satisfy the following criteria:

  • It must be a valid object type.

  • If all filters are True, the event must match at least one filter.

  • If all filters are False, the event must not match any filter.

  • If the filters are a mixture of True and False, the event must match at least one True filter and not match any False filters.

If there are no True ranges defined in the array, events are considered True.

For example, if you want to listen only to events sourced by a shape or guide, you can pass an array like the following:

VBA Copy code Copy code

 Dim aFilterObjects(1 To (2 * 2)) As Long
 aFilterObjects(1) = visTypeShape
 aFilterObjects(2) = True
 aFilterObjects(3) = visTypeGuide
 aFilterObjects(4) = True


Event.SetFilterSRC Method (Visio)

 Copy code hover
[image]

Event.SetFilterSRC Method (Visio)
Send feedback

Published: July 16, 2012

Specifies an array of cell ranges and a True or False value indicating how to filter events for each cell range.

Version Information

Version Added: Visio 2002

Syntax

expression .SetFilterSRC(SRCStream())

expression A variable that represents an Event object.

Parameters

Name | Required/Optional | Data Type | Description
SRCStream() | Required | Integer | An array of cell ranges and a True or False value specifying how to filter events for each range.

Return Value

Nothing

Remarks

When an Event object created with the AddAdvise method is added to the EventList collection of a source object, the default behavior is that all occurrences of that event are passed to the event sink. The SetFilterSRC method provides a way to ignore selected events based on a range of cells.

The SRCStream() parameter passed to SetFilterSRC is an array defined in the following manner:

The number of elements in the array is a multiple of 7:

  • The first three elements describe the section, row, and cell of the beginning cell of the range.

  • The next three elements describe the section, row, and cell of the end cell of the range.

  • The last element contains a True or False value indicating how to filter events for the cell range (True to listen to events for a range of cells; False to exclude events for a range of cells).

For an event to successfully pass through a cell range filter, it must satisfy the following criteria:

  • It must be a valid section, row, cell reference.

  • If all filters are True, the event must match at least one filter.

  • If all filters are False, the event must not match any filter.

  • If the filters are a mixture of True and False, the event must match at least one True filter and not match any False filters.

If there are no True ranges defined in the array, events are considered True.

For example, if you want to listen for any changes in the Value cell of the second row in the Shape Data section, use the following:

VBA Copy code Copy code

 Dim aFilterSRC(1 To (1 * 7)) As Integer
 aFilterSRC(1) = visSectionProp
 aFilterSRC(2) = visRowProp + 1
 aFilterSRC(3) = visCustPropsValue
 aFilterSRC(4) = visSectionProp
 aFilterSRC(5) = visRowProp + 1
 aFilterSRC(6) = visCustPropsValue
 aFilterSRC(7) = True


Event.Trigger Method (Visio)

 Copy code hover
[image]

Event.Trigger Method (Visio)
Send feedback

Published: July 16, 2012

Causes an event's action to be performed.

Version Information

Version Added: Visio 4.0

Syntax

expression .Trigger(ContextString)

expression A variable that represents an Event object.

Parameters

Name | Required/Optional | Data Type | Description
ContextString | Required | String | The string to send to the target of the event.

Return Value

Nothing

Remarks

Triggering an event causes the action associated with the event to be performed. The specified context string is passed to the target of the action:

  • If the action is to run an add-on (visEvtCodeRunAddon), the string is passed in the command line string sent to the add-on.

  • If the action is to send a notification to the calling program (visEvtCodeAdvise), the string is passed in the moreInfo parameter of the notification.


EventList Object (Visio)

 Copy code hover
[image]

EventList Object (Visio)
Send feedback

Published: July 16, 2012

Includes an Event object for each event to which an object should respond. The object that possesses the event list is sometimes called the source object.

Version Information

Version Added: Visio 4.0

Remarks

To retrieve an EventList collection, use the EventList property of the source object.

The default property of EventList is Item.

In general, the level of the source object in the Microsoft Visio object hierarchy determines the scope of its response. For example, if an Event object for the DocumentOpened event is in the EventList collection of a Document object, that event's action is triggered only when that document is opened. If the same Event object is in the EventList collection of an Application object, the event's action is triggered whenever any document is opened in that instance of Visio.

To create an Event object that runs an add-on, use the Add method of an EventList collection.

To create an Event object that sends a notification, use the AddAdvise method.


EventList Members (Visio)

 Copy code hover
[image]

EventList Members (Visio)
Send feedback

Published: July 16, 2012

Includes an Event object for each event to which an object should respond. The object that possesses the event list is sometimes called the source object.

Methods

Name | Description
Add | Adds an Event object that runs an add-on when an event occurs. The Event object is added to the EventList collection of the source object whose events you want to receive.
AddAdvise | Adds an Event object to the EventList collection of the source object whose events you want to receive. When selected events occur, the source object notifies your sink object.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ObjectType | Returns an object's type. Read-only.


EventList Properties (Visio)

 Copy code hover
[image]

EventList Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ObjectType | Returns an object's type. Read-only.


EventList.Application Property (Visio)

 Copy code hover
[image]

EventList.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents an EventList object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


EventList.Count Property (Visio)

 Copy code hover
[image]

EventList.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents an EventList object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


EventList.Item Property (Visio)

 Copy code hover
[image]

EventList.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(Index)

expression A variable that represents an EventList collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Integer | The index number of the object in its collection.

Return Value

Event

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


EventList.ItemFromID Property (Visio)

 Copy code hover
[image]

EventList.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item of a collection using the ID of the item. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemFromID(nID)

expression A variable that represents an EventList collection.

Parameters

Name | Required/Optional | Data Type | Description
nID | Required | Long | The ID of the object to retrieve.

Return Value

Event

Remarks

The ID of a Shape object uniquely identifies the shape within its page or master.

The ID of a Style object uniquely identifies the style within its document.

The ID of a Font object corresponds to the number stored in the Font cell of a row in a shape's Character Properties section. The ID associated with a particular font varies between systems or as fonts are installed on and removed from a given system.

The ID of an Event object uniquely identifies an event in its EventList collection for the life of the collection.


EventList.ObjectType Property (Visio)

 Copy code hover
[image]

EventList.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents an EventList object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


EventList Methods (Visio)

 Copy code hover
[image]

EventList Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds an Event object that runs an add-on when an event occurs. The Event object is added to the EventList collection of the source object whose events you want to receive.
AddAdvise | Adds an Event object to the EventList collection of the source object whose events you want to receive. When selected events occur, the source object notifies your sink object.


EventList.Add Method (Visio)

 Copy code hover
[image]

EventList.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds an Event object that runs an add-on when an event occurs. The Event object is added to the EventList collection of the source object whose events you want to receive.

Version Information

Version Added: Visio 4.1

Syntax

expression .Add(EventCode, Action, Target, TargetArgs)

expression A variable that represents an EventList collection.

Parameters

Name | Required/Optional | Data Type | Description
EventCode | Required | Integer | The event(s) to capture.
Action | Required | Integer | The action to perform. Must be visActCodeRunAddon, a member of VisEventCodes in the Visio type Library.
Target | Required | String | The name of your add-on.
TargetArgs | Required | String | The string that is passed to your Event object to set its TargetArgs property.

Return Value

Event

Remarks

The source object whose EventList collection contains the Event object establishes the scope in which the events are reported. Events are reported for the source object and objects lower in the object model hierarchy. For example, to run an add-on when a particular document is opened, add an Event object for the DocumentOpened event to the EventList collection of that document. To run an add-on when any document is opened in an instance of the application, add the Event object to the EventList collection of the Application object.

Creating Event objects is a common way to handle events from C++ or other non-Microsoft Visual Basic solutions. When you use the Visual Basic WithEvents keyword to handle events, all the events in a source object's event set fire, but when you create Event objects, your program will only be notified of the events you select. Depending on your solution, this may result in improved performance.

Event objects that run add-ons can be persistent: that is, they can be stored with a Visio document. To be persistent, an Event object's Persistent and Persistable properties must both be True.

The arguments passed to the Add method set the initial values of the Event object's Event, Action (visActCodeRunAddon), Target, and TargetArgs properties.

Event codes are declared by the Visio type library and have the prefix visEvt. Event codes are often a combination of constants. For example, visEvtAdd+visEvtDoc is the event code for the DocumentAdded event. To find an event code for the event you want to create, see Event Codes.

To create an Event object that advises the caller's sink object about an event, see the AddAdvise method.

Example

The following example shows how to add an Event object that runs an add-on to the EventList collection of the source object, in this case a Document object, whose events you want to receive.

Before running this macro, replace path\filename with a valid path and file name for an executable add-on (EXE) in your Visio project. The add-on should take no arguments.

VBA Copy code Copy code
Public Sub AddEvent_Example()

 Dim vsoAddons As Visio.Addons
 Dim vsoEventList As Visio.EventList
 Dim vsoDocument As Visio.Document
 Dim vsoEvent As Visio.Event
 Dim vsoAddon As Visio.Addon

 'Add a document based on the Basic Diagram template.
 Set vsoDocument = Documents.Add("Basic Diagram.vst")

 'Add an add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add("path\filename")

 'Add a BeforeDeleteSelection event to the EventList collection
 'of the Document object. The event will start your add-on,
 'which takes no arguments.
 Set vsoEventList = vsoDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtCodeBefSelDel, _
 visActCodeRunAddon, _
 "path\filename", "")

End Sub


EventList.AddAdvise Method (Visio)

 Copy code hover
[image]

EventList.AddAdvise Method (Visio)
Send feedback

Published: July 16, 2012

Adds an Event object to the EventList collection of the source object whose events you want to receive. When selected events occur, the source object notifies your sink object.

Version Information

Version Added: Visio 4.1

Syntax

expression .AddAdvise(EventCode, SinkIUnkOrIDisp, IIDSink, TargetArgs)

expression A variable that represents an EventList object.

Parameters

Name | Required/Optional | Data Type | Description
EventCode | Required | Integer | The event(s) that generate notifications.
SinkIUnkOrIDisp | Required | Variant | A reference to a COM interface on the object that is to receive event notifications.
IIDSink | Required | String | Reserved for future use. Must be "".
TargetArgs | Required | String | The string that is passed to your Event object to set its TargetArgs property.

Return Value

Event

Remarks

Event objects created with the AddAdvise method have an Action property of visActCodeAdvise. They are not persistent, that is, they cannot be stored with a Visio document and must be re-created at run time.

The source object whose EventList collection contains the Event object establishes the scope in which the events are reported. Events are reported for the source object and objects lower in the object model hierarchy. For example, to receive notification when a particular document is saved, add an Event object for the DocumentSaved event to the EventList collection of that document. To receive notification when any document is opened in an instance of the application, add the Event object to the EventList collection of the Application object.

Creating Event objects is a common way to handle events from C++ or other non-Microsoft Visual Basic solutions. When you use the Visual Basic WithEvents keyword to handle events, all the events in a source object's event set fire. When you create Event objects to handle events, however, your program will only be notified of the events you select. Depending on your solution, this may result in improved performance.

The EventCode argument is often a combination of constants. For example, visEvtMod+visEvtCell is the event code for the CellChanged event. Event constants are declared by the Visio type library and are prefixed with visEvt. To find an event code for the event you want to create, see Event codes.

The arguments passed to the AddAdvise method set the initial values of the Event object's Event, Action (visCodeRunAddAdvise), and TargetArgs properties.

Beginning with Visio 2002, you can use event filters to refine the events that you receive in your program. You can filter events by object, cell, ranges of cells, or command ID. For details about using event filters, see the method topics prefixed with SetFilter and GetFilter.

Event objects created with the AddAdvise method have an Action property of visActCodeAdvise. They are not persistent, that is, they cannot be stored with a Visio document and must be re-created at run time.

The source object whose EventList collection contains the Event object establishes the scope in which the events are reported. Events are reported for the source object and objects lower in the object model hierarchy. For example, to receive notification when a particular document is saved, add an Event object for the DocumentSaved event to the EventList collection of that document. To receive notification when any document is opened in an instance of the application, add the Event object to the EventList collection of the Application object.

Creating Event objects is a common way to handle events from C++ or other non-Microsoft Visual Basic solutions. When you use the Visual Basic WithEvents keyword to handle events, all the events in a source object's event set fire. When you create Event objects to handle events, however, your program will only be notified of the events you select. Depending on your solution, this may result in improved performance.

The EventCode argument is often a combination of constants. For example, visEvtMod+visEvtCell is the event code for the CellChanged event. Event constants are declared by the Visio type library and are prefixed with visEvt. To find an event code for the event you want to create, see Event codes.

The arguments passed to the AddAdvise method set the initial values of the Event object's Event, Action (visCodeRunAddAdvise), and TargetArgs properties.

Beginning with Visio 2002, you can use event filters to refine the events that you receive in your program. You can filter events by object, cell, ranges of cells, or command ID. For details about using event filters, see the method topics prefixed with SetFilter and GetFilter.

Enabling your program to handle event notifications from Microsoft Visual Basic or Visual Basic for Applications

To handle notifications, you should create a class module that implements the IVisEventProc interface and then create an instance of this class to pass as an argument to the AddAdvise method.

The IVisEventProc interface contains a single function with the following declaration:

VBA Copy code Copy code
Implements IVisEventProc

Private Function IVisEventProc_VisEventProc( _
    ByVal nEventCode As Integer, _
    ByVal pSourceObj As Object, _
    ByVal nEventID As Long, _
    ByVal nEventSeqNum As Long, _
    ByVal pSubjectObj As Object, _
    ByVal vMoreInfo As Variant) As Variant
End Function

Following are descriptions of the arguments to VisEventProc .

Argument

Description

nEventCode

The event(s) that occurred. You can provide a distinct object for each event or provide a single object that receives all notifications and switches internally based on nEventCode.

pSourceObj

The object whose EventList collection contains the Event object that triggered the notification.

nEventID

The unique identifier of the Event object within the EventList collection. (Unlike the Index property of the EventList collection, nEventID does not change as Event objects are added to or deleted from the collection.) You can get the Event object from VisEventProc by using the following code:

VBA Copy code Copy code
pSourceObj.EventList.ItemFromID(nEventID)

nEventSeqNum

The ordinal position of the event with respect to the sequence of events that have occurred in the calling instance of the application. The first event that occurs in a Visio instance has a sequence number of 1, the second event 2, and so forth. In some cases, you can use the sequence number in conjunction with the EventInfo property to obtain more information about the event.

pSubjectObj

The object that the event is about. For example, the subject of a ShapeAdded event is a Shape object representing the shape that was just added, while the subject of a BeforeSelectionDelete event is a Selection object in which the shapes that are about to be deleted are selected.

vMoreInfo

Additional information about the subject of the event. For many events, it is a string similar to the command line the application passes the add-ons it executes. If the notification does not include additional information, this parameter is set to Nothing. For details about notification parameters for a particular event, see the particular event topic in this Automation Reference.

If nEventCode identifies a query event (events prefixed with Query), return True to cancel the event, and False to allow it to happen. The value is arbitrary for other events. If no explicit value is returned, Microsoft Visual Basic for Applications (VBA) returns an empty Variant, which Visio interprets as False.

The connection between the source object and the Event object exists until one of the following occurs:

  • The program deletes the Event object.

  • The program releases the last reference to the source object. (The EventList collection and Event objects hold a reference on their source object.)

  • The application terminates.

Beginning with Visio 2000, VisEventProc is defined as a function that returns a value. However, Visio only looks at return values from calls to VisEventProc that are passed a query event code. Event objects that provide VisEventProc through IDispatch require no change. To modify existing event handlers so that they can handle query events, change the Sub procedure to a Function procedure and return the appropriate value. (For details about query events, see this reference for event topics prefixed with Query.)

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Office Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in Microsoft Visual Basic for Applications (VBA) or Visual Basic, naming the module clsEventSink. You can then use the event-sink module that follows to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance.

Copy code Copy code
Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
    ByVal nEventCode As Integer, _
    ByVal pSourceObj As Object, _
    ByVal nEventID As Long, _
    ByVal nEventSeqNum As Long, _
    ByVal pSubjectObj As Object, _
    ByVal vMoreInfo As Variant) As Variant

    Dim strMessage As String

    'Find out which event fired
    Select Case nEventCode
        Case visEvtCodeDocSave
            strMessage = "DocumentSaved (" & nEventCode & ")"
        Case (visEvtPage + visEvtAdd)
            strMessage = "PageAdded (" & nEventCode & ")"
        Case visEvtCodeShapeDelete
            strMessage = "ShapesDeleted(" & nEventCode & ")"
        Case Else
            strMessage = "Other (" & nEventCode & ")"
    End Select

    'Display the event name and the event code
    Debug.Print strMessage

End Function

The following VBA module shows how to use the AddAdvise method to sink events. The module contains two public procedures.

The CreateEventObjects procedure creates an instance of a sink-object (event-handling) class named clsEventSink that gets passed to the AddAdvise method, and that receives notifications of events. In addition, the procedure creates three Event objects to send notifications of firings of three events sourced by the Document object to the sink object: DocumentSaved, PageAdded, and ShapesDeleted.

The DeleteEventObjects procedure deletes these Event objects when your program is finished using them.

The clsEventSink class implements the IVisEventProc interface.

The example assumes that there is an active document in the Visio application window.

Copy code Copy code
Option Explicit

Private mEventSink As clsEventSink

Dim vsoDocumentEvents As Visio.EventList
Dim vsoDocumentSavedEvent As Visio.Event
Dim vsoPageAddedEvent As Visio.Event
Dim vsoShapesDeletedEvent As Visio.Event

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Public Sub CreateEventObjects()

    'Create an instance of the clsEventSink class
    'to pass to the AddAdvise method.
    Set mEventSink = New clsEventSink

    'Get the EventList collection of the active document.
    Set vsoDocumentEvents = ActiveDocument.EventList

    'Add Event objects that will send notifications.
    'Add an Event object for the DocumentSaved event.
    Set vsoDocumentSavedEvent= vsoDocumentEvents.AddAdvise( _
     visEvtCodeDocSave, mEventSink, "", "Document saved...")

    'Add an Event object for the PageAdded event.
    Set vsoPageAddedEvent= vsoDocumentEvents.AddAdvise( _
     visEvtAdd + visEvtPage, mEventSink, "", "Page added...")

    'Add an Event object for the ShapesDeleted event.
    Set vsoShapesDeletedEvent = vsoDocumentEvents.AddAdvise( _
     visEvtCodeShapeDelete, mEventSink, "", "Shapes deleted...")

End Sub

Public Sub DeleteEventObjects()

    'Delete the Event object for the DocumentSaved event.
    vsoDocumentSavedEvent.Delete
    Set vsoDocumentSavedEvent = Nothing

    'Delete the Event object for the PageAdded event.
    vsoPageAddedEvent.Delete
    Set vsoPageAddedEvent = Nothing

    'Delete the Event object for the ShapesDeleted event.
    vsoShapesDeletedEvent.Delete
    Set vsoShapesDeletedEvent = Nothing

End Sub


Font Object (Visio)

 Copy code hover
[image]

Font Object (Visio)
Send feedback

Published: July 16, 2012

Represents a typeface that is either applied to text in a document or available for use on the system.

Version Information

Version Added: Visio 4.0

Remarks

The default property of a Font object is Name.

A Font object maps its name (for example, "Arial") to the font ID (for example, 3) that Microsoft Visio stores in a Font cell in a Character section of a shape whose text is formatted with that font. Font IDs can change when a document is opened on different systems or when fonts are installed or removed.


Font Members (Visio)

 Copy code hover
[image]

Font Members (Visio)
Send feedback

Published: July 16, 2012

Represents a typeface that is either applied to text in a document or available for use on the system.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Attributes | Returns the attributes of the a Font object. Read-only.
CharSet | Returns the Microsoft Windows character set for a Font object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a Font object in the Fonts collection. Read-only.
Name | Specifies the name of an object. Read-only.
ObjectType | Returns an object's type. Read-only.
PitchAndFamily | Returns the pitch and family code for a Font object. Read-only.
Stat | Returns status information for an object. Read-only.


Font Properties (Visio)

 Copy code hover
[image]

Font Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Attributes | Returns the attributes of the a Font object. Read-only.
CharSet | Returns the Microsoft Windows character set for a Font object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a Font object in the Fonts collection. Read-only.
Name | Specifies the name of an object. Read-only.
ObjectType | Returns an object's type. Read-only.
PitchAndFamily | Returns the pitch and family code for a Font object. Read-only.
Stat | Returns status information for an object. Read-only.


Font.Application Property (Visio)

 Copy code hover
[image]

Font.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Font object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Font.Attributes Property (Visio)

 Copy code hover
[image]

Font.Attributes Property (Visio)
Send feedback

Published: July 16, 2012

Returns the attributes of the a Font object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Attributes

expression A variable that represents a Font object.

Return Value

Integer

Remarks

When you get the Attributes property of a Font object, the following value is returned.

Constant | Value
visFont0Alias | 128

A font marked as the font 0 alias is used instead of font 0 (the default font). The font 0 alias is used in some localized versions of Microsoft Visio and is controlled by means of entries in the registry.


Font.CharSet Property (Visio)

 Copy code hover
[image]

Font.CharSet Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Microsoft Windows character set for a Font object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CharSet

expression A variable that represents a Font object.

Return Value

Integer

Remarks

The Windows character set specifies character mapping for a font. The possible values of the CharSet property correspond to those of the lfCharSet member of the Windows LOGFONT data structure. For details, search for "LOGFONT" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Font.Document Property (Visio)

 Copy code hover
[image]

Font.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Font object.

Return Value

Document


Font.ID Property (Visio)

 Copy code hover
[image]

Font.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ID of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ID

expression A variable that represents a Font object.

Return Value

Long

Remarks

For Font objects, the ID property corresponds to the number stored in the Font cell of the row in a shape's Character Properties section. For example, to apply the font named "Arial" to a shape's text, create a Font object that represents "Arial," get the ID of that font, and then set the CharProps property of the Shape object to that ID.

The ID associated with a particular font varies from system to system or as fonts are installed and removed on a given system.


Font.Index Property (Visio)

 Copy code hover
[image]

Font.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Font object in the Fonts collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Font object.

Return Value

Integer

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Font.Name Property (Visio)

 Copy code hover
[image]

Font.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a Font object.

Return Value

String

Remarks

You can get, but not set, the Name property of an Addon object or a Font object.


Font.ObjectType Property (Visio)

 Copy code hover
[image]

Font.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Font object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Font.PitchAndFamily Property (Visio)

 Copy code hover
[image]

Font.PitchAndFamily Property (Visio)
Send feedback

Published: July 16, 2012

Returns the pitch and family code for a Font object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .PitchAndFamily

expression A variable that represents a Font object.

Return Value

Integer

Remarks

The possible values of the PitchAndFamily property correspond to those of the lfPitchAndFamily member of the Windows LOGFONT data structure. For details, search for "LOGFONT" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Font.Stat Property (Visio)

 Copy code hover
[image]

Font.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Font object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Fonts Object (Visio)

 Copy code hover
[image]

Fonts Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Font object for each font applied to text in a document or available on the system.

Version Information

Version Added: Visio 4.0

Remarks

To retrieve a Fonts collection, use the Fonts property of a Document object.

The default property of a Fonts collection is Item.

To retrieve a Font object by its font ID (the value shown in the Font cell in a shape's Character section), use the ItemFromID property.


Fonts Members (Visio)

 Copy code hover
[image]

Fonts Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Font object for each font applied to text in a document or available on the system.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.


Fonts Properties (Visio)

 Copy code hover
[image]

Fonts Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.


Fonts.Application Property (Visio)

 Copy code hover
[image]

Fonts.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Fonts object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Fonts.Count Property (Visio)

 Copy code hover
[image]

Fonts.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Fonts object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Fonts.Document Property (Visio)

 Copy code hover
[image]

Fonts.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Fonts object.

Return Value

Document


Fonts.Item Property (Visio)

 Copy code hover
[image]

Fonts.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameOrIndex)

expression A variable that represents a Fonts collection.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

Font

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.


Fonts.ItemFromID Property (Visio)

 Copy code hover
[image]

Fonts.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item of a collection using the ID of the item. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemFromID(nID)

expression A variable that represents a Fonts collection.

Parameters

Name | Required/Optional | Data Type | Description
nID | Required | Long | The ID of the object to retrieve.

Return Value

Font

Remarks

The ID of a Shape object uniquely identifies the shape within its page or master.

The ID of a Style object uniquely identifies the style within its document.

The ID of a Font object corresponds to the number stored in the Font cell of a row in a shape's Character Properties section. The ID associated with a particular font varies between systems or as fonts are installed on and removed from a given system.

The ID of an Event object uniquely identifies an event in its EventList collection for the life of the collection.


Fonts.ObjectType Property (Visio)

 Copy code hover
[image]

Fonts.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Fonts object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Fonts.Stat Property (Visio)

 Copy code hover
[image]

Fonts.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Fonts object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Global Object (Visio)

 Copy code hover
[image]

Global Object (Visio)
Send feedback

Published: July 16, 2012

The Microsoft Visio global object is automatically available to Microsoft Visual Basic for Applications (VBA) code that is part of the VBA project of a Visio document. The Visio global object is not available to code in other contexts.

Version Information

Version Added: Visio 4.5

Remarks

Members of the global object can be accessed without qualification. For example, to access the ActivePage member of the global object:

VBA Copy code Copy code
    Set vsoPage = ActivePage

The preceding syntax is different from the syntax you would use for accessing members of non-global objects. For example:

VBA Copy code Copy code
    Set vsoPage = vsoApplication.ActivePage
Note Note

The VBA project of every Visio document also has a class module called ThisDocument. When referenced from code in the VBA project, the ThisDocument module returns a reference to the project's Document object.


Global Members (Visio)

 Copy code hover
[image]

Global Members (Visio)
Send feedback

Published: July 16, 2012

The Microsoft Visio global object is automatically available to Microsoft Visual Basic for Applications (VBA) code that is part of the VBA project of a Visio document. The Visio global object is not available to code in other contexts.

Properties

Name | Description
ActiveDocument | Returns the active Document object, which is the document shown in the active window. Read-only.
ActivePage | Returns the active Page object. Read-only.
ActiveWindow | Returns the active Window object. Read-only.
Addons | Returns the Addons collection of an Application or InvisibleApp object. Read-only.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Documents | Returns the Documents collection for a Microsoft Visio instance. Read-only.
Vbe | Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Visio documents. Read-only.
Windows | Returns the Windows collection for a Microsoft Visio instance or window. Read-only.


Global Properties (Visio)

 Copy code hover
[image]

Global Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveDocument | Returns the active Document object, which is the document shown in the active window. Read-only.
ActivePage | Returns the active Page object. Read-only.
ActiveWindow | Returns the active Window object. Read-only.
Addons | Returns the Addons collection of an Application or InvisibleApp object. Read-only.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Documents | Returns the Documents collection for a Microsoft Visio instance. Read-only.
Vbe | Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Visio documents. Read-only.
Windows | Returns the Windows collection for a Microsoft Visio instance or window. Read-only.


Global.ActiveDocument Property (Visio)

 Copy code hover
[image]

Global.ActiveDocument Property (Visio)
Send feedback

Published: July 16, 2012

Returns the active Document object, which is the document shown in the active window. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ActiveDocument

expression A variable that represents a Global object.

Return Value

Document

Remarks

When no documents are open, there is no active document and the ActiveDocument property returns the value Nothing and does not raise an exception.

If your code is in the Microsoft Visual Basic project of a Visio document, the ActiveDocument property often, but not necessarily, returns a reference to the ThisDocument object, a class module in the Visual Basic project of every Microsoft Visio document. If the ThisDocument object is shown in the active window, the ActiveDocument object and the ThisDocument object refer to the same document. When the ThisDocument object is referenced from code in a project, it returns a reference to the project's Document object.

Whether you use the ActiveDocument object or the ThisDocument object depends on the purpose of your code.

You can compare the result returned by the ActiveDocument property with the value Nothing to determine if a document is active. If the value of the Application.Documents.Count property is greater than zero, at least one document is open and active.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows two safe ways to get an active document (if one exists). In each case, it prints the name of the active document in the Immediate window. The code gets the active document without qualification from the Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document.

VBA Copy code Copy code

Public Sub ActiveDocument_Example()

 Dim vsoDocument As Document

 'First method
 If Documents.Count > 0 Then
 Set vsoDocument = ActiveDocument
 Debug.Print vsoDocument.Name
 Else
 Debug.Print "No active document."
 End If

 'Second method
 If Not(ActiveDocument Is Nothing) Then
 Set vsoDocument = ActiveDocument
 Debug.Print vsoDocument.Name
 Else
 Debug.Print "No active document."
 End If

End Sub


Global.ActivePage Property (Visio)

 Copy code hover
[image]

Global.ActivePage Property (Visio)
Send feedback

Published: July 16, 2012

Returns the active Page object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ActivePage

expression A variable that represents a Global object.

Return Value

Page

Remarks

The ActivePage property returns a Page object only when the active window displays a drawing page; otherwise, it returns Nothing. To verify that a page is active, use the Is operator to compare the ActivePage property with Nothing.

It is possible to get the active window without qualification from the Microsoft Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document. For example, you can use this code:

VBA Copy code Copy code
Set vsoPage = ActivePage

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the active page without qualification from the Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document.

VBA Copy code Copy code

Public Sub ActivePage_Example()

 Dim vsoPage As Page

 'Find out if a page exists, and if it does, get the page.
 If Not(ActivePage Is Nothing) Then
 Set vsoPage = ActivePage
 Debug.Print vsoPage.Name
 Else
 Debug.Print "No active page."
 End If

End Sub


Global.ActiveWindow Property (Visio)

 Copy code hover
[image]

Global.ActiveWindow Property (Visio)
Send feedback

Published: July 16, 2012

Returns the active Window object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ActiveWindow

expression A variable that represents a Global object.

Return Value

Window

Remarks

The active window can be one of the following window types: Drawing, Stencil, ShapeSheet, Edit Icon, or a Drawing or Stencil window created by an add-on. The application's active window can only be an MDI frame window—it cannot be one of the floating, docked, or anchored windows. For a complete list of window types, see the Type property.

If a window in an instance of Microsoft Visio is not active, the ActiveWindow property returns Nothing.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to get the active window without qualification from the Microsoft Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document.

VBA Copy code Copy code

Public Sub ActiveWindow_Example()

 Dim vsoWindow As Visio.Window

 'Get the active window.
 Set vsoWindow = ActiveWindow

 'To verify that we got the active window, print its caption.
 Debug.Print vsoWindow.Caption

End Sub


Global.Addons Property (Visio)

 Copy code hover
[image]

Global.Addons Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Addons collection of an Application or InvisibleApp object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Addons

expression A variable that represents a Global object.

Return Value

Addons

Remarks

The Addons collection includes an Addon object for each add-on in the folders specified by the AddonPaths property and for each add-on that is added dynamically to the collection by other add-ons.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the Addons collection and add an add-on to it.

Before running this macro, replace path\filename with a valid path and file name for an add-on in your Visio project.

VBA Copy code Copy code

Public Sub Addons_Example()

 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Add an add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add("path\filename")

End Sub


Global.Application Property (Visio)

 Copy code hover
[image]

Global.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Global object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Global.Documents Property (Visio)

 Copy code hover
[image]

Global.Documents Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Documents collection for a Microsoft Visio instance. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Documents

expression A variable that represents a Global object.

Return Value

Documents

Remarks

You can iterate through a Documents collection by using the Count property to retrieve the number of documents in the collection. You can use the Item property to retrieve individual elements from a collection.


Global.Vbe Property (Visio)

 Copy code hover
[image]

Global.Vbe Property (Visio)
Send feedback

Published: July 16, 2012

Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Visio documents. Read-only.

Version Information

Version Added: Visio 4.5

Syntax

expression .Vbe

expression A variable that represents a Global object.

Return Value

Object

Remarks

To get information about the object returned by the Vbe property, follow these steps:

To get information about the object returned by the Vbe property

  1. In the Code group on the Developer tab, click Visual Basic.

  2. In the Visual Basic Editor, on the Tools menu, click References.

  3. In the References dialog box, click Microsoft Visual Basic for Applications Extensibility 5.3, and then click OK.

  4. On the View menu, click Object Browser.

  5. In the Project/Library list, select the VBIDE type library.

  6. In the Classes list, examine the class named VBE.

Beginning with Visio 2002, the Vbe property raises an exception if you are running in a security-enhanced environment and your system administrator has blocked access to the VBA object model. There is no user interface or programmatic way to turn this on—the system administrator must turn on (or off) access by setting a Group Policy. This helps protect against viruses that spread by accessing the Visual Basic projects in commonly used templates and injecting the virus code into them.

Example

This VBA macro shows how to use the Vbe property to determine how many VBA projects are open in an instance of Visio.

Before running this code, make sure the Trust access to the VBA project object model check box is selected under Developer Macro Settings on the Macro Settings page of the Trust Center dialog box (click the File tab, click Options, click Trust Center, and then click Trust Center Settings).

VBA Copy code Copy code

Public Sub Vbe_Example()

     Dim vbideVBE As VBIDE.VBE

     Set vbideVBE = Visio.Application.Vbe
     Debug.Print vbideVBE.VBProjects.Count

End Sub


Global.Windows Property (Visio)

 Copy code hover
[image]

Global.Windows Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Windows collection for a Microsoft Visio instance or window. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Windows

expression A variable that represents a Global object.

Return Value

Windows

Example

This Microsoft Visual Basic macro gets the Windows collection of the Application object and prints the ID of each window in the collection in the Immediate window.

VBA Copy code Copy code
Public Sub Windows_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoWindows As Visio.Windows
 Dim intCounter As Integer

 'Get the Windows collection.
 Set vsoApplication = Application
 Set vsoWindows = vsoApplication.Windows

 For intCounter = 1 To vsoWindows.Count
 Debug.Print vsoWindows.Item(intCounter).ID
 Next intCounter

End Sub


GraphicItem Object (Visio)

 Copy code hover
[image]

GraphicItem Object (Visio)
Send feedback

Published: July 16, 2012

Represents a single component part of a data graphic master (a Master object of type visTypeDataGraphic) that is responsible for a specific graphical adornment of the master.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Remarks

The default property of a GraphicItem object is ID.

GraphicItem objects can be of four types:

  • Color by value

  • Data bar

  • Icon set

  • Text callout

You cannot create or significantly modify GraphicItem objects programmatically—you must perform these tasks in the Visio user interface (UI). For more information about creating and modifying data graphics in the UI, search for "data graphic" in Visio end-user Help.

However, the properties and methods listed below do permit some programmatic modification of GraphicItem objects. In particular, you can modify the position of a graphic item relative to the shape or selection it's associated with; the Z-order (the order in which Visio draws graphic items) of a GraphicItem object in the GraphicItems collection; and the expression (value) used to evaluate a graphic item against the rule that determines how it is displayed.

Use the DataGraphic property to get the Master object of type visTypeDataGraphic that contains the GraphicItem object.

Use the GetExpression method to get the current expression against which the graphic item's rule is evaluated.

Use the SetExpression method to set the current expression against which the graphic item's rule is evaluated.

Use the Delete method to delete a GraphicItem object from the GraphicItems collection.

Use the HorizontalPosition property to get or set the horizontal position of the graphic item relative to the shape or selection that it's associated with.

Use the VerticalPosition property to get or set thevertical position of the graphic item relative to the shape or selection that it's associated with.

Use the UseDataGraphicPosition property to get or set whether a GraphicItem object inherits the settings of the DataGraphicHorizontalPosition and DataGraphicVerticalPosition properties of the data graphic master it belongs to (when set to True), or whether the GraphicItem object's own HorizontalPosition and Vertical Position settings are applied (when set to False).


GraphicItem Members (Visio)

 Copy code hover
[image]

GraphicItem Members (Visio)
Send feedback

Published: July 16, 2012

Represents a single component part of a data graphic master (a Master object of type visTypeDataGraphic) that is responsible for a specific graphical adornment of the master.

Methods

Name | Description
Delete | Deletes a GraphicItem object from the GraphicItems collection of a Master object of type visTypeDataGraphic.
GetExpression | Gets the label of the shape data item (custom property) that the GraphicItem represents, or the value of the expression string that is part of a GraphicItem object's rule, against which shape data is evaluated.
SetExpression | Sets the value of the expression string that is part of a GraphicItem object's rule, against which shape data (custom properties) are evaluated.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with a GraphicItem object. Read-only.
DataGraphic | Returns the Master object of type visTypeDataGraphic that contains the graphic item. Read-only.
Description | Returns a string that describes the type of the graphic item. Read-only.
Document | Gets the Document object that contains the Master object of type visTypeDataGraphic that contains the GraphicItem object. Read-only.
HorizontalPosition | Gets or sets the horizontal position of the GraphicItem object relative to the shape to which it is applied. Read/write.
ID | Gets the unique identifier of the GraphicItem object. Read-only.
Index | Gets or sets the ordinal position of a GraphicItem object in the GraphicItems collection of a data graphic master—a Master object of type visTypeDataGraphic. Read/write.
ObjectType | Returns visObjTypeGraphicItem, the type of a GraphicItem object. Read-only.
Stat | Returns status information for an object. Read-only.
Tag | Gets or sets a user-defined string expression that can store extra data related to your program. Read/write.
Type | Returns the type of the graphic item. Read-only.
UseDataGraphicPosition | Gets or sets whether to use the current default callout position for graphic items of the data graphic master to whose GraphicItems collection the graphic item belongs. Read/write.
VerticalPosition | Gets or sets the vertical position of the GraphicItem object relative to the shape to which it is applied. Read/write.


GraphicItem Properties (Visio)

 Copy code hover
[image]

GraphicItem Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with a GraphicItem object. Read-only.
DataGraphic | Returns the Master object of type visTypeDataGraphic that contains the graphic item. Read-only.
Description | Returns a string that describes the type of the graphic item. Read-only.
Document | Gets the Document object that contains the Master object of type visTypeDataGraphic that contains the GraphicItem object. Read-only.
HorizontalPosition | Gets or sets the horizontal position of the GraphicItem object relative to the shape to which it is applied. Read/write.
ID | Gets the unique identifier of the GraphicItem object. Read-only.
Index | Gets or sets the ordinal position of a GraphicItem object in the GraphicItems collection of a data graphic master—a Master object of type visTypeDataGraphic. Read/write.
ObjectType | Returns visObjTypeGraphicItem, the type of a GraphicItem object. Read-only.
Stat | Returns status information for an object. Read-only.
Tag | Gets or sets a user-defined string expression that can store extra data related to your program. Read/write.
Type | Returns the type of the graphic item. Read-only.
UseDataGraphicPosition | Gets or sets whether to use the current default callout position for graphic items of the data graphic master to whose GraphicItems collection the graphic item belongs. Read/write.
VerticalPosition | Gets or sets the vertical position of the GraphicItem object relative to the shape to which it is applied. Read/write.


GraphicItem.Application Property (Visio)

 Copy code hover
[image]

GraphicItem.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio associated with a GraphicItem object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Application

expression An expression that returns a GraphicItem object.

Return Value

Application


GraphicItem.DataGraphic Property (Visio)

 Copy code hover
[image]

GraphicItem.DataGraphic Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Master object of type visTypeDataGraphic that contains the graphic item. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataGraphic

expression An expression that returns a GraphicItem object.

Return Value

Master


GraphicItem.Description Property (Visio)

 Copy code hover
[image]

GraphicItem.Description Property (Visio)
Send feedback

Published: July 16, 2012

Returns a string that describes the type of the graphic item. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Description

expression A variable that represents a GraphicItem object.

Return Value

String

Remarks

The possible values of the description property correspond to the four types of graphic items available in the New Item list in the New Data Graphic or Edit Data Graphic dialog box in the Microsoft Visio user interface: Text, Data Bar, Icon Set, and Color by Value.


GraphicItem.Document Property (Visio)

 Copy code hover
[image]

GraphicItem.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that contains the Master object of type visTypeDataGraphic that contains the GraphicItem object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Document

expression An expression that returns a GraphicItem object.

Return Value

Document


GraphicItem.HorizontalPosition Property (Visio)

 Copy code hover
[image]

GraphicItem.HorizontalPosition Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the horizontal position of the GraphicItem object relative to the shape to which it is applied. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .HorizontalPosition

expression An expression that returns a GraphicItem object.

Return Value

VisGraphicPositionHorizontal

Remarks

The default horizontal callout position for graphic items in the GraphicItems collection of a Master object of type visTypeDataGraphic, commonly called a data graphic master, is specified by the settings of the Master.DataGraphicHorizontalPosition property. If GraphicItem.UseDataGraphicPosition is True, the graphic item is positioned according to the default setting. If UseDataGraphicPosition is False, its horizontal position is determined by the settings of the GraphicItem.HorizontalPosition property.

Note, however, that users can manually re-position a data graphic that was applied to a shape by using the control handle of the data graphic. A position set in this manner takes precedence over the position specified by property settings.

The setting of the HorizontalPosition property corresponds to the setting of the Horizontal list box under Callout position in the New Text (or Edit Text), New Icon Set (or Edit Icon Set), or New Data Bar (or Edit Data Bar) dialog box, depending on the type of the graphic item, in the Microsoft Visio user interface (UI). However, this is the case only if Use default position is cleared.

The following possible values for the HorizontalPosition property are from the VisGraphicPositionHorizontal enumeration, which is declared in the Visio type library.

Constant | Value | Description
visGraphicFarLeft | 0 | The right edge of the graphic item's alignment box is aligned with the left edge of the shape or container's alignment box.
visGraphicLeftEdge | 1 | The vertical centerline of the graphic item's alignment box is aligned with the left edge of the shape or container's alignment box.
visGraphicLeft | 2 | The left edge of the graphic item's alignment box is aligned with the left edge of the shape or container's alignment box.
visGraphicCenter | 3 | The vertical centerline of the graphic item's alignment box is aligned with the vertical centerline of the shape or container's alignment box.
visGraphicRight | 4 | The right edge of the graphic item's alignment box is aligned with the right edge of the shape or container's alignment box.
visGraphicRightEdge | 5 | The vertical centerline of the graphic item's alignment box is aligned with the right edge of the shape or container's alignment box.
visGraphicFarRight | 6 | The left edge of the graphic item's alignment box is aligned with the right edge of the shape or container's alignment box.
Note Note

Before you can set any property of a graphic item, you must use the Master.Open method to open for editing a copy of the data graphic master whose GraphicItems collection the graphic item belongs to. When you are finished setting properties, use the Master.Close method to commit changes.


GraphicItem.ID Property (Visio)

 Copy code hover
[image]

GraphicItem.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the unique identifier of the GraphicItem object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ID

expression A variable that represents a GraphicItem object.

Return Value

Long

Remarks

ID is the default property of GraphicItem. The ID of each GraphicItem object is unique in the GraphicItems collection to which it belongs.


GraphicItem.Index Property (Visio)

 Copy code hover
[image]

GraphicItem.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the ordinal position of a GraphicItem object in the GraphicItems collection of a data graphic master—a Master object of type visTypeDataGraphic. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Index

expression A variable that represents a GraphicItem object.

Return Value

Long

Remarks

The index of a graphic item is originally determined by the order in which the item was added to the collection. The GraphicItems collection is 1-based.

The index order of graphic items affects the stacking order for multiple grpahic item callouts assigned to the same location. In addition, it determiones which graphic item takes precedence in control over a cell in the Microsoft Visio ShapeSheet spreadsheet when conflicting conditions set by multiple graphic items are all true .

Note Note

Before you can set any property of a graphic item, you must use the Master.Open method to open a copy of the data graphic master that contains the graphic item for editing. When you are finished setting properties, use the Master.Close method to commit changes.


GraphicItem.ObjectType Property (Visio)

 Copy code hover
[image]

GraphicItem.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeGraphicItem, the type of a GraphicItem object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ObjectType

expression An expression that returns a GraphicItem object.

Return Value

VisObjectTypes

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


GraphicItem.Stat Property (Visio)

 Copy code hover
[image]

GraphicItem.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Stat

expression A variable that represents a GraphicItem object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


GraphicItem.Tag Property (Visio)

 Copy code hover
[image]

GraphicItem.Tag Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets a user-defined string expression that can store extra data related to your program. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Tag

expression An expression that returns a GraphicItem object.

Return Value

String

Remarks

Microsoft Visio makes no use of the Tag property, nor does its value appear anywhere in the user interface. The Tag property is intended to be used by developers to store additional information about a graphic item or a data graphic.

For example, you can assign a Tag property value to a particular graphic item as an identifier. Then, by writing a procedure that iterates through the GraphicItems collection and looks for a graphic item that has that specific Tag value, you can find the graphic item.

Note Note

Before you can set any property of a graphic item, you must use the Master.Open method to open a copy of the data graphic master that contains the graphic item for editing. When you are finished setting properties, use the Master.Close method to commit changes.


GraphicItem.Type Property (Visio)

 Copy code hover
[image]

GraphicItem.Type Property (Visio)
Send feedback

Published: July 16, 2012

Returns the type of the graphic item. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Type

expression A variable that represents a GraphicItem object.

Return Value

VisGraphicItemTypes

Remarks

The following possible values for the Type property are from the VisGraphicItemTypes enumeration. which is declared in the Visio type library. These values correspond to the graphic item types listed in the New Item list in the New Data Graphic and Edit Data Graphic dialog boxes in the Microsoft Visio user interface.

Constant | Value | Description
visTypeIconSet | 2 | Represents an Icon Set graphic item.
visTypeTextCallout | 3 | Represents a Text graphic item.
visTypeDataBar | 4 | Represents a Data Bar graphic item.
visTypeColorByValue | 5 | Represents a Color by Value graphic item.
visTypeHeading | 6 | Represents a Text graphic item that has a Callout type of Heading x.


GraphicItem.UseDataGraphicPosition Property (Visio)

 Copy code hover
[image]

GraphicItem.UseDataGraphicPosition Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets whether to use the current default callout position for graphic items of the data graphic master to whose GraphicItems collection the graphic item belongs. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .UseDataGraphicPosition

expression An expression that returns a GraphicItem object.

Return Value

Boolean

Remarks

The default callout position for graphic items in the GraphicItems collection of a Master object of type visTypeDataGraphic, commonly called a data graphic master, is specified by the settings of the Master.DataGraphicVerticalPosition and Master.DataGraphicHorizontalPosition properties. If GraphicItem.UseDataGraphicPosition is True, the graphic item is positioned according to the default setting. If UseDataGraphicPosition is False, its position is determined by the settings of the GraphicItem.VerticalPosition and GraphicItem.HorizontalPosition properties.

In addition, if the HorizontalPosition and VerticalPosition property values of a graphic item are equal to the DataGraphicHorizontalPosition and DataGraphicVerticalPosition property values, the value of the UseDataGraphicPosition property for that graphic item is automatically set to True.

Note, however, that users can manually re-position a data graphic that has been applied to a shape by using the control handle of the data graphic. A position set in this manner takes precedence over the position specified by property settings.

Note Note

Before you can set any property of a graphic item, you must use the Master.Open method to open for editing a copy of the data graphic master whose GraphicItems collection the graphic item belongs to. When you are finished setting properties, use the Master.Close method to commit changes.

The setting of the UseDataGraphicPosition property corresponds to the setting of the Use default position box under Callout position in the New Text (or Edit Text), New Icon Set (or Edit Icon Set), or New Data Bar (or Edit Data Bar) dialog box, depending on the type of the graphic item, in the Microsoft Visio user interface.


GraphicItem.VerticalPosition Property (Visio)

 Copy code hover
[image]

GraphicItem.VerticalPosition Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the vertical position of the GraphicItem object relative to the shape to which it is applied. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .VerticalPosition

expression An expression that returns a GraphicItem object.

Return Value

VisGraphicPositionVertical

Remarks

The default vertical callout position for graphic items in the GraphicItems collection of a Master object of type visTypeDataGraphic, commonly called a data graphic master, is specified by the settings of the Master.DataGraphicVerticalPosition property. If GraphicItem.UseDataGraphicPosition is True, the graphic item is positioned according to the default setting. If UseDataGraphicPosition is False, its vertical position is determined by the settings of the GraphicItem.VerticalPosition property.

Note, however, that users can manually re-position a data graphic that has been applied to a shape by using the control handle of the data graphic. A position set in this manner takes precedence over the position specified by property settings.

The setting of the VerticalPosition property corresponds to the setting of the Vertical list box under Callout position in the New Text (or Edit Text), New Icon Set (or Edit Icon Set), or New Data Bar (or Edit Data Bar) dialog box, depending on the type of the graphic item, in the Microsoft Visio user interface (UI). However, this is the case only if Use default position is cleared.

The following possible values for the VerticalPosition property are from the VisGraphicPositionVertical enumeration, which is declared in the Visio type library.

Constant | Value | Description
visGraphicBelow | 0 | The top edge of the graphic item's alignment box is aligned with the bottom edge of the shape or container's alignment box.
visGraphicBottomEdge | 1 | The horizontal centerline of the graphic item's alignment box is aligned with the bottom edge of the shape or container's alignment box.
visGraphicBottom | 2 | The bottom edge of the graphic item's alignment box is aligned with the bottom edge of the shape or container's alignment box.
visGraphicMiddle | 3 | The horizontal centerline of the graphic item's alignment box is aligned with the horizontal centerline of the shape or container's alignment box.
visGraphicTop | 4 | The top edge of the graphic item's alignment box is aligned with the top edge of the shape or container's alignment box.
visGraphicTopEdge | 5 | The horizontal centerline of the graphic item's alignment box is aligned with the top edge of the shape or container's alignment box.
visGraphicAbove | 6 | The bottom edge of the graphic item's alignment box is aligned with the top edge of the shape or container's alignment box.
Note Note

Before you can set any property of a graphic item, you must use the Master.Open method to open for editing a copy of the data graphic master whose GraphicItems collection the graphic item belongs to. When you are finished setting properties, use the Master.Close method to commit changes.


GraphicItem Methods (Visio)

 Copy code hover
[image]

GraphicItem Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes a GraphicItem object from the GraphicItems collection of a Master object of type visTypeDataGraphic.
GetExpression | Gets the label of the shape data item (custom property) that the GraphicItem represents, or the value of the expression string that is part of a GraphicItem object's rule, against which shape data is evaluated.
SetExpression | Sets the value of the expression string that is part of a GraphicItem object's rule, against which shape data (custom properties) are evaluated.


GraphicItem.Delete Method (Visio)

 Copy code hover
[image]

GraphicItem.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes a GraphicItem object from the GraphicItems collection of a Master object of type visTypeDataGraphic.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Delete

expression A variable that represents a GraphicItem object.

Return Value

Nothing

Remarks

Before you can delete a graphic item, you must use the Master.Open method to open for editing a copy of the data graphic master whose GraphicItems collection the graphic item belongs to. After you have deleted the graphic item and made whatever other edits you want to make, use the Master.Close method to commit changes.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Delete method to delete an existing graphic item from the GraphicItems collection of a Master object. It deletes the graphic item most recently added to the collection and prints the count of graphic items in the collection of the master copy, both before and after the deletion, to the Immediate window. After it closes the master copy, it also prints the count of graphic items in the collection of the master itself, to show that actions performed on the copy get committed to the master.

The macro assumes that there is an existing data graphic master in your project in whose GraphicItems collection has at least one member. You can determine the name of an existing data graphic master by moving your mouse over the master in the Data Graphics task pane in the Visio user interface. The master in this example is named "Data Graphic."

VBA Copy code Copy code
Public Sub Delete_Example()

    Dim vsoMaster As Visio.Master
    Dim vsoMasterCopy As Visio.Master
    Dim intGraphicItemCount As Integer

    Set vsoMaster = ActiveDocument.Masters("Data Graphic")
    Set vsoMasterCopy = vsoMaster.Open

    intGraphicItemCount = vsoMasterCopy.GraphicItems.Count

    Debug.Print "Before delete", intGraphicItemCount
    vsoMasterCopy.GraphicItems(intGraphicItemCount).Delete
    Debug.Print "After delete", vsoMasterCopy.GraphicItems.Count
    vsoMasterCopy.Close
    Debug.Print "After close", vsoMaster.GraphicItems.Count

End Sub


GraphicItem.GetExpression Method (Visio)

 Copy code hover
[image]

GraphicItem.GetExpression Method (Visio)
Send feedback

Published: July 16, 2012

Gets the label of the shape data item (custom property) that the GraphicItem represents, or the value of the expression string that is part of a GraphicItem object's rule, against which shape data is evaluated.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetExpression(Field, Expression)

expression An expression that returns a GraphicItem object.

Parameters

Name | Required/Optional | Data Type | Description
Field | Required | VisGraphicField | Out parameter. A constant value from the VisGraphicField enumeration specifying whether Expression is a shape-data-item label or the formula in the ShapeSheet spreadsheet of the primary data field (column) assigned to the GraphicItem. See Remarks for possible values.
Expression | Required | String | Out parameter. The ShapeSheet expression associated with the Field parameter.

Return Value

Nothing

Remarks

The Field value returned as an out parameter is one of the following values from the VisGraphicField enumeration, which is declared in the Microsoft Visio type library.

Constant | Value | Description
visGraphicPropertyLabel | 1 | The label of a shape data item.
visGraphicExpression | 2 | The ShapeSheet formula of a shape data item.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetExpression method to get the value of the expression string for a data graphic item. It gets the most recently applied expression for the first graphic item in the GraphicItems collection of the Master object of type visTypeDataGraphic (commonly called a data graphic) named "Data Graphic," and prints the field and the expression in the Immediate window.

Note Note

You can determine the name of an existing data graphic master by moving your mouse over the master in the Data Graphics task pane in the Visio user interface.

The macro assumes that a data graphic named "Data Graphic" exists in the current document. For more information about adding a data graphic master to the Masters collection of the current document, see Masters.AddEx .

VBA Copy code Copy code
Public Sub GetExpression()

    Dim vsoGraphicItem As Visio.GraphicItem
    Set vsoGraphicItem = ActiveDocument.Masters("Data Graphic").GraphicItems(1)
    Dim strExpression As String
    Dim fieldName As VisGraphicField

    vsoGraphicItem.GetExpression fieldName, strExpression
    Debug.Print strExpression
    Debug.Print fieldName

End Sub


GraphicItem.SetExpression Method (Visio)

 Copy code hover
[image]

GraphicItem.SetExpression Method (Visio)
Send feedback

Published: July 16, 2012

Sets the value of the expression string that is part of a GraphicItem object's rule, against which shape data (custom properties) are evaluated.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .SetExpression(Field, Expression)

expression An expression that returns a GraphicItem object.

Parameters

Name | Required/Optional | Data Type | Description
Field | Required | VisGraphicField | The label or formula of the primary data field (column) assigned to the GraphicItem. See Remarks for possible values.
Expression | Required | String | The ShapeSheet expression associated with the Field parameter.

Return Value

Nothing

Remarks

The Field parameter should be one of the following values from the VisGraphicField enumeration, which is declared in the Microsoft Visio Type Library.

Constant | Value | Description
visGraphicPropertyLabel | 1 | The label of a shape data item.
visGraphicExpression | 2 | The ShapeSheet formula of a shape data item.

When you pass the SetExpression method a shape-data-item label (that is, when you pass visGraphicPropertyLabel for the Field parameter), you must enclose the label within curly braces ({}). For example, if you want to pass the name of the "Cost" shape-data item, you must write it like this: {Cost}.

You can reference the shape data of a shape other than the one to which the data graphic is applied by passing the name of the shape followed by an exclamation point (!) and then the name of the field. For example, in the example shown below, to refer to the width of the shape named Ellipse.34, you could use the following syntax:

VBA Copy code Copy code
vsoGraphicItem.SetExpression visGraphicExpression, "Ellipse.34!Width"

Before you can edit a graphic item, including setting its expression string, you must use the Master.Open method to open for editing a copy of the data graphic master whose GraphicItems collection the graphic item belongs to. After you have set the expression of the graphic item and made whatever other edits you want to make, use the Master.Close method to commit changes.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the SetExpression method to set the value of the expression string for a data graphic item. It opens a copy of the Master object of type visTypeDataGraphic (commonly called a data graphic) named "Data Graphic," and then sets the expression of the first graphic item in the GraphicItems collection of the data graphic to display the width of any shape to which the data graphic is applied.

Note Note

You can determine the name of an existing data graphic master by moving your mouse over the master in the Data Graphics task pane in the Visio user interface.

Then it closes the master and uses the GetExpression method to get the mostly recently applied expression for the graphic item. Finally, it prints the field type and the value of the expression in the Immediate window.

The macro assumes that a data graphic named "Data Graphic" exists in the current document. For more information about adding a data graphic master to the Masters collection of the current document, see Masters.AddEx .

VBA Copy code Copy code
Public Sub SetExpression_Example()

    Dim vsoMaster As Visio.Master
    Dim vsoMasterCopy As Visio.Master
    Dim vsoGraphicItem As Visio.GraphicItem
    Dim strExpression As String
    Dim fieldType As VisGraphicField

    Set vsoMaster = Visio.ActiveDocument.Masters("Data Graphic")
    Set vsoMasterCopy = vsoMaster.Open
    Set vsoGraphicItem = vsoMasterCopy.GraphicItems(1)

    vsoGraphicItem.SetExpression visGraphicExpression, "Width"
    vsoMasterCopy.Close

    vsoMaster.GraphicItems(1).GetExpression fieldType, strExpression

    Debug.Print "Field type is "; fieldType
    Debug.Print "Expression is "; strExpression

End Sub


GraphicItems Object (Visio)

 Copy code hover
[image]

GraphicItems Object (Visio)
Send feedback

Published: July 16, 2012

The collection of GraphicItem objects associated with a Master object of type visTypeDataGraphic.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Remarks

The default property of the GraphicItems collection is Item.

The AddCopy method adds a copy of an existing GraphicItem object to the GraphicItems collection. The GraphicItem object to be added must already exist in another master of type visTypeDataGraphic.

Use the DataGraphic property to return the Master object of type visTypeDataGraphic that the GraphicItems collection is associated with.

Note Note

You must create masters of type visTypeDataGraphic by using the Visio user interface—you cannot create them programmatically. For more information about creating these masters, search for "data graphics" in Visio end-user Help.


GraphicItems Members (Visio)

 Copy code hover
[image]

GraphicItems Members (Visio)
Send feedback

Published: July 16, 2012

The collection of GraphicItem objects associated with a Master object of type visTypeDataGraphic.

Methods

Name | Description
AddCopy | Adds a copy of a GraphicItem object to the GraphicItems collection of a Master object of type visTypeDataGraphic.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with the GraphicItems collection. Read-only.
Count | Returns the number of GraphicItem objects in the GraphicItems collection. Read-only.
DataGraphic | Returns the Master object of type visTypeDataGraphic that contains the GraphicItems collection. Read-only.
Document | Gets the Document object that contains the Master object of type visTypeDataGraphic that contains the GraphicItems collection. Read-only.
Item | Returns the GraphicItem object at the specified index position in the GraphicItems collection. Read-only.
ItemFromID | Returns a GraphicItem object from the GraphicItems collection by using the unique ID of the object. Read-only.
ObjectType | Returns visObjTypeGraphicItems, the type of a GraphicItems object. Read-only.
Stat | Returns status information for an object. Read-only.


GraphicItems Properties (Visio)

 Copy code hover
[image]

GraphicItems Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio associated with the GraphicItems collection. Read-only.
Count | Returns the number of GraphicItem objects in the GraphicItems collection. Read-only.
DataGraphic | Returns the Master object of type visTypeDataGraphic that contains the GraphicItems collection. Read-only.
Document | Gets the Document object that contains the Master object of type visTypeDataGraphic that contains the GraphicItems collection. Read-only.
Item | Returns the GraphicItem object at the specified index position in the GraphicItems collection. Read-only.
ItemFromID | Returns a GraphicItem object from the GraphicItems collection by using the unique ID of the object. Read-only.
ObjectType | Returns visObjTypeGraphicItems, the type of a GraphicItems object. Read-only.
Stat | Returns status information for an object. Read-only.


GraphicItems.Application Property (Visio)

 Copy code hover
[image]

GraphicItems.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio associated with the GraphicItems collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Application

expression An expression that returns a GraphicItems object.

Return Value

Application


GraphicItems.Count Property (Visio)

 Copy code hover
[image]

GraphicItems.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of GraphicItem objects in the GraphicItems collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Count

expression An expression that returns a GraphicItems object.

Return Value

Long


GraphicItems.DataGraphic Property (Visio)

 Copy code hover
[image]

GraphicItems.DataGraphic Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Master object of type visTypeDataGraphic that contains the GraphicItems collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataGraphic

expression An expression that returns a GraphicItems object.

Return Value

Master


GraphicItems.Document Property (Visio)

 Copy code hover
[image]

GraphicItems.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that contains the Master object of type visTypeDataGraphic that contains the GraphicItems collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Document

expression An expression that returns a GraphicItems object.

Return Value

Document


GraphicItems.Item Property (Visio)

 Copy code hover
[image]

GraphicItems.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns the GraphicItem object at the specified index position in the GraphicItems collection. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Item(Index)

expression A variable that represents a GraphicItems object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index of the object to retrieve.

Return Value

GraphicItem

Remarks

Item is the default property of the GraphicItems collection.

The GraphicItems collection is indexed starting with 1.

When you retrieve objects from a collection, you can omit Item from the expression because it is the default property of all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objectReturned = expression(Index)


GraphicItems.ItemFromID Property (Visio)

 Copy code hover
[image]

GraphicItems.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns a GraphicItem object from the GraphicItems collection by using the unique ID of the object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ItemFromID(ObjectID)

expression A variable that represents a GraphicItems object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectID | Required | Long | The unique ID of the GraphicItem object to retrieve.

Return Value

GraphicItem

Remarks

You can get the ID of a GraphicItem object by getting the value of the GraphicItem.ID property.


GraphicItems.ObjectType Property (Visio)

 Copy code hover
[image]

GraphicItems.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeGraphicItems, the type of a GraphicItems object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .ObjectType

expression An expression that returns a GraphicItems object.

Return Value

VisObjectTypes

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


GraphicItems.Stat Property (Visio)

 Copy code hover
[image]

GraphicItems.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .Stat

expression A variable that represents a GraphicItems object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


GraphicItems Methods (Visio)

 Copy code hover
[image]

GraphicItems Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddCopy | Adds a copy of a GraphicItem object to the GraphicItems collection of a Master object of type visTypeDataGraphic.


GraphicItems.AddCopy Method (Visio)

 Copy code hover
[image]

GraphicItems.AddCopy Method (Visio)
Send feedback

Published: July 16, 2012

Adds a copy of a GraphicItem object to the GraphicItems collection of a Master object of type visTypeDataGraphic.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .AddCopy(GraphicItem)

expression An expression that returns a GraphicItems object.

Parameters

Name | Required/Optional | Data Type | Description
GraphicItem | Required | [IVGRAPHICITEM] | The GraphicItem object to copy.

Return Value

GraphicItem

Remarks

The GraphicItem object you want to add must already exist in the GraphicItems collection of another Master object of type visTypeDataGraphic.

After you use the Master.Open to open a copy of a Master object of type visTypeDataGraphic for editing, you must use the Master.Close method to commit any changes you made to the master while it was open. Closing a copy of a data-graphic master also reapplies the data graphic to all shapes to which it was previously applied.

Note Note

For more information about why it is necessary to edit a copy of a master instead of the master itself, see Master.Open.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AddCopy method to add a copy of an existing data-graphic item to the GraphicItems collection of a Master object.

The macro uses the Masters.AddEx method to add a new Master object of type visTypeDataGraphic to the Masters collection of the active document. Then, it uses the Master.Open method to get a copy of the new data graphic master to edit.

Next, the method gets a copy of an existing data-graphic item that is the first item in the GraphicItems collection of an existing master. Finally, it uses the AddCopy method to add the copy of the existing data-graphic item to the GraphicItems collection of the copy of the new master, and then closes the master copy.

The macro assumes that you know the name of the existing data-graphic master ("old_master_name") that contains one or more graphic items you want to add to the new master. You can determine the name of an existing data graphic master by moving your mouse over the master in the Data Graphics task pane in the Visio user interface.

VBA Copy code Copy code
Public Sub AddCopy_Example()

    Dim vsoMaster As Visio.Master
    Dim vsoMasterCopy As Visio.Master
    Dim vsoMaster_Old As Visio.Master
    Dim vsoGraphicItem As GraphicItem
    Dim vsoGraphicItem_Old As Visio.GraphicItem

    Set vsoMaster = Visio.ActiveDocument.Masters.AddEx(visTypeDataGraphic)
    Set vsoMasterCopy = vsoMaster.Open
    Set vsoMaster_Old = ActiveDocument.Masters("old_master_name")
    Set vsoGraphicItem_Old = vsoMaster_Old.GraphicItems(1)
    Set vsoGraphicItem = vsoMasterCopy.GraphicItems.AddCopy(vsoGraphicItem_Old)
    vsoMasterCopy.Close

End Sub


Hyperlink Object (Visio)

 Copy code hover
[image]

Hyperlink Object (Visio)
Send feedback

Published: July 16, 2012

Completely encapsulates the properties and behavior of a hyperlink. A shape can have one or more hyperlinks that navigate to any named location, such as another page, a local document, or a URL. A Hyperlink object enables you to access and manipulate the shape's Hyperlink row.

Version Information

Version Added: Visio 5.0

Remarks

The default property of a Hyperlink object is Description.

To add a Hyperlink object to a shape, use the AddHyperlink method.

To navigate to a named hyperlink location, use the Follow method.


Hyperlink Members (Visio)

 Copy code hover
[image]

Hyperlink Members (Visio)
Send feedback

Published: July 16, 2012

Completely encapsulates the properties and behavior of a hyperlink. A shape can have one or more hyperlinks that navigate to any named location, such as another page, a local document, or a URL. A Hyperlink object enables you to access and manipulate the shape's Hyperlink row.

Methods

Name | Description
AddToFavorites | Adds a shortcut for a hyperlink address in the presently registered Favorites folder.
Copy | Copies a hyperlink to the Clipboard.
CreateURL | Returns a fully qualified and optionally canonicalized representation of the hyperlink's absolute address.
Delete | Deletes an object or selection.
Follow | Causes Microsoft Visio to navigate to a hyperlink.

Properties

Name | Description
Address | Gets or sets the address for a shape's Hyperlink object, the address to which the hyperlink navigates. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Description | Gets or sets the description of a hyperlink. Read/write.
ExtraInfo | Returns or sets extra URL request information used to resolve the hyperlink's URL. Read/write.
Frame | Gets or sets the name of an HTML frame in the shape's Hyperlink object. Read/write.
IsDefaultLink | Determines the default Hyperlink object for a shape. Read/write.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Hyperlink object. Read/write.
NewWindow | Determines whether Microsoft Visio opens a window in a new location when it follows a hyperlink to open a Web page or another Visio document. Read/write.
ObjectType | Returns an object's type. Read-only.
Row | Returns the row index of a hyperlink. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.
SubAddress | Gets or sets the subaddress in a shape's Hyperlink object. Read/write.


Hyperlink Properties (Visio)

 Copy code hover
[image]

Hyperlink Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Address | Gets or sets the address for a shape's Hyperlink object, the address to which the hyperlink navigates. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Description | Gets or sets the description of a hyperlink. Read/write.
ExtraInfo | Returns or sets extra URL request information used to resolve the hyperlink's URL. Read/write.
Frame | Gets or sets the name of an HTML frame in the shape's Hyperlink object. Read/write.
IsDefaultLink | Determines the default Hyperlink object for a shape. Read/write.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Hyperlink object. Read/write.
NewWindow | Determines whether Microsoft Visio opens a window in a new location when it follows a hyperlink to open a Web page or another Visio document. Read/write.
ObjectType | Returns an object's type. Read-only.
Row | Returns the row index of a hyperlink. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.
SubAddress | Gets or sets the subaddress in a shape's Hyperlink object. Read/write.


Hyperlink.Address Property (Visio)

 Copy code hover
[image]

Hyperlink.Address Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the address for a shape's Hyperlink object, the address to which the hyperlink navigates. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .Address

expression A variable that represents a Hyperlink object.

Return Value

String

Remarks

Setting the Address property for a Hyperlink object is equivalent to entering information in the Address box in the Hyperlinks dialog box (Insert menu), or setting the result of the Address cell in the shape's Hyperlink.name row in the ShapeSheet window.

The Address property value can be a DOS, UNC, or URL path, for example, "driveletter":\"foldername"\"drawingname", \\"servername"\"foldername"\"drawingname", or http://address, respectively.

If the Address property is relative, for example, "..\"drawingname"", it is composed against the HyperlinkBase property, if supplied, or the hyperlink's document path. If the document is not saved, the hyperlink is undefined.

If the Address property is empty, you can assume the address points to a page in the document that contains the page. In this case, the SubAddress property contains the name of the drawing page to which the hyperlink navigates.

Example

This Microsoft Visual Basic for Applications (VBA) macro sets the Address property of a Hyperlink object. Before running this example, replace address with a valid Internet or intranet address.

VBA Copy code Copy code

Public Sub Address_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoHyperlink As Visio.Hyperlink

 'Create a new shape to receive the hyperlink
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 Set vsoHyperlink = vsoShape.AddHyperlink

 vsoHyperlink.Description = "Web site"
 vsoHyperlink.Address = "http://address/"

End Sub


Hyperlink.Application Property (Visio)

 Copy code hover
[image]

Hyperlink.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Hyperlink object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Hyperlink.Description Property (Visio)

 Copy code hover
[image]

Hyperlink.Description Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the description of a hyperlink. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Description

expression A variable that represents a Hyperlink object.

Return Value

String

Remarks

Setting a hyperlink's Description property is equivalent to entering information in the optional Description box in the Hyperlinks dialog box (click Hyperlink on the Insert tab). It is also equivalent to setting the result of the Description cell of the shape's Hyperlink row.


Hyperlink.ExtraInfo Property (Visio)

 Copy code hover
[image]

Hyperlink.ExtraInfo Property (Visio)
Send feedback

Published: July 16, 2012

Returns or sets extra URL request information used to resolve the hyperlink's URL. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .ExtraInfo

expression A variable that represents a Hyperlink object.

Return Value

String

Remarks

Setting the ExtraInfo property of a shape's Hyperlink object is optional, and is equivalent to setting the value of the ExtraInfo cell in the shape's Hyperlink.name row.

You might, for example, set the Hyperlink object's ExtraInfo property to the coordinates of an image map, the contents of a form, or a file name.

If the ExtraInfo property you provide contains reserved characters other than spaces, you must input the escape character "%" and the character's hexidecimal equivalent. For example:

For "NAME=John Smith", set the ExtraInfo property to "NAME=John Smith," because the extra information contains spaces, but no reserved characters.

For "PATH=driveletter:\foldename", set the ExtraInfo property to "PATH=driveletter%3A%5Cfoldername", because of the reserved characters.


Hyperlink.Frame Property (Visio)

 Copy code hover
[image]

Hyperlink.Frame Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of an HTML frame in the shape's Hyperlink object. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .Frame

expression A variable that represents a Hyperlink object.

Return Value

String

Remarks

Setting the Frame property of a shape's Hyperlink object is optional and only applies when a Microsoft Visio instance is open in a browser, for example, Microsoft Internet Explorer 3.0 or later.

Setting the Frame property is equivalent to setting the result of the Frame cell in the shape's Hyperlink.name row.


Hyperlink.IsDefaultLink Property (Visio)

 Copy code hover
[image]

Hyperlink.IsDefaultLink Property (Visio)
Send feedback

Published: July 16, 2012

Determines the default Hyperlink object for a shape. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .IsDefaultLink

expression A variable that represents a Hyperlink object.

Return Value

Integer

Remarks

When you set the value of the IsDefaultLink property to True for a Hyperlink object, the value for all other Hyperlink objects is automatically set to False. When you set the value of this property to False for a Hyperlink object, the other Hyperlink objects aren't affected.


Hyperlink.Name Property (Visio)

 Copy code hover
[image]

Hyperlink.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a Hyperlink object.

Return Value

String

Remarks

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Hyperlink.NameU Property (Visio)

 Copy code hover
[image]

Hyperlink.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of a Hyperlink object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .NameU

expression A variable that represents a Hyperlink object.

Return Value

String

Remarks

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Hyperlink.NewWindow Property (Visio)

 Copy code hover
[image]

Hyperlink.NewWindow Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio opens a window in a new location when it follows a hyperlink to open a Web page or another Visio document. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .NewWindow

expression A variable that represents a Hyperlink object.

Return Value

Integer

Remarks

Setting the NewWindow property of a Hyperlink object is equivalent to setting the NewWindow cell in the shape's Hyperlink.name row.

When NewWindow is set to False (0) and the hyperlink's target is a Web page or a document that will open in a browser, the browser will be in the same position and of the same size as the Visio window. If NewWindow is True (non-zero), a browser window will appear at another location (unless the Visio document is maximized).

When the hyperlink's target is a Visio document, the value of NewWindow determines whether the linked document will open in a window on top of the existing document window, or in another location.

Example

The following example draws a rectangle shape, adds a Hyperlink object to the shape, sets its Address and NewWindow properties, and then uses the Follow method to navigate the hyperlink. To better observe the effect this property has, before running this macro, size and position the Visio document window so that it is not in the fully maximized position.

VBA Copy code Copy code

Public Sub NewWindow_Example()

 Dim vsoHyperlink As Visio.Hyperlink

 Set vsoHyperlink = ActivePage.DrawRectangle(0,0,5,5).AddHyperlink

 vsoHyperlink.Address = "http://www.microsoft.com/"
 vsoHyperlink.NewWindow = True
 vsoHyperlink.Follow

End Sub


Hyperlink.ObjectType Property (Visio)

 Copy code hover
[image]

Hyperlink.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Hyperlink object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Hyperlink.Row Property (Visio)

 Copy code hover
[image]

Hyperlink.Row Property (Visio)
Send feedback

Published: July 16, 2012

Returns the row index of a hyperlink. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Row

expression A variable that represents a Hyperlink object.

Return Value

Integer


Hyperlink.Shape Property (Visio)

 Copy code hover
[image]

Hyperlink.Shape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Shape

expression A variable that represents a Hyperlink object.

Return Value

Shape

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Shape property to get the Shape objects that own a Cell and a Characters object.

VBA Copy code Copy code

Public Sub Shape_Example()

 Dim vsoRectangle As Visio.Shape
 Dim vsoOval As Visio.Shape
 Dim vsoShapeFromCell As Visio.Shape
 Dim vsoShapeFromCharacters As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim vsoCharacters As Visio.Characters

 'Create 2 different shapes and add different text to each shape.
 Set vsoRectangle = ActivePage.DrawRectangle(2, 3, 5, 4)
 Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
 vsoRectangle.Text = "Rectangle Shape"
 vsoOval.Text = "Oval Shape"

 'Get a Cell object from the first shape.
 Set vsoCell = vsoRectangle.Cells("Width")

 'Get a Characters object from the second shape.
 Set vsoCharacters = vsoOval.Characters

 'Use the Shape property to get the Shape object.
 Set vsoShapeFromCell = vsoCell.Shape
 Set vsoShapeFromCharacters = vsoCharacters.Shape

 'Use each shape's text to verify the proper Shape
 'object was returned.
 Debug.Print vsoShapeFromCell.Text
 Debug.Print vsoShapeFromCharacters.Text

End Sub


Hyperlink.Stat Property (Visio)

 Copy code hover
[image]

Hyperlink.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Hyperlink object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Hyperlink.SubAddress Property (Visio)

 Copy code hover
[image]

Hyperlink.SubAddress Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the subaddress in a shape's Hyperlink object. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .SubAddress

expression A variable that represents a Hyperlink object.

Return Value

String

Remarks

Setting the SubAddress property of a shape's Hyperlink object is optional unless the Address property is blank. In this case the SubAddress must contain the name of the drawing page.

Setting a hyperlink's SubAddress property is equivalent to entering information in the Sub-address box in the Hyperlinks dialog box (on the Insert tab, click Hyperlink). This is also equivalent to setting the result of the SubAddress cell in the shape's Hyperlink.name row in the ShapeSheet window.

The SubAddress property for a Hyperlink object specifies a sublocation within the hyperlink's address. For Microsoft Visio files, this can be a page name. For Microsoft Excel, this can be a worksheet or a range within a worksheet. For HTML pages, this can be a subanchor.

The hyperlink address for which a subaddress is being supplied must support subaddress linking.

Example

The following example shows how to use the SubAddress property to set the subaddress of a hyperlink. Before running this macro, replace drive\ folder\subfolder with a valid path on your computer, replace address with a valid Internet or intranet address, replace subaddress with a valid subaddress for the Internet or intranet address, replace drawing.vsd with a valid file on your computer, and replace anchor with a valid page and shape in the file.

VBA Copy code Copy code

Sub SubAddress_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoHyperlink As Visio.Hyperlink

 'Draw a rectangle shape on the active page.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Add a hyperlink to the shape.
 Set vsoHyperlink = vsoShape.AddHyperlink

 'Allow relative hyperlink addresses.
 ActiveDocument.HyperlinkBase = "drive:\folder\subfolder"

 'Return a relative address.
 vsoHyperlink.Address = "..\drawing.vsd"

 'Return a relative subaddress.
 vsoHyperlink.SubAddress = "anchor"

 'Print the resulting URLs to the Debug window
 'to show how the relative path is derived
 'from the base path and the difference
 'between canonical and noncanonical forms.
 Debug.Print vsoHyperlink.CreateURL(False)
 Debug.Print vsoHyperlink.CreateURL(True)

 'Return an absolute address.
 vsoHyperlink.Address = "http://address"

 'Return an absolute subaddress.
 vsoHyperlink.SubAddress = "../subaddress"

 'Print the resulting URL to the Debug window
 Debug.Print vsoHyperlink.CreateURL(False)

End Sub


Hyperlink Methods (Visio)

 Copy code hover
[image]

Hyperlink Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddToFavorites | Adds a shortcut for a hyperlink address in the presently registered Favorites folder.
Copy | Copies a hyperlink to the Clipboard.
CreateURL | Returns a fully qualified and optionally canonicalized representation of the hyperlink's absolute address.
Delete | Deletes an object or selection.
Follow | Causes Microsoft Visio to navigate to a hyperlink.


Hyperlink.AddToFavorites Method (Visio)

 Copy code hover
[image]

Hyperlink.AddToFavorites Method (Visio)
Send feedback

Published: July 16, 2012

Adds a shortcut for a hyperlink address in the presently registered Favorites folder.

Version Information

Version Added: Visio 5.0

Syntax

expression .AddToFavorites(FavoritesTitle)

expression A variable that represents a Hyperlink object.

Parameters

Name | Required/Optional | Data Type | Description
FavoritesTitle | Optional | Variant | The title to assign to the new shortcut.

Return Value

Nothing

Remarks

If a string is not supplied, the AddToFavorites method uses the hyperlink's Description property as the new favorite's title. If the Description property is empty, the shortcut is given a generic title, such as Favorite1.

The optional favoritesTitle argument can specify the full path for the favorites file, for example, "C:\Users\username\Favorites\My Favorite.URL", or a path relative to the Favorites folder.

From Microsoft Visual Basic or Microsoft Visual Basic for Applications (VBA), a call to the AddToFavorites method can take either of these two forms:

VBA Copy code Copy code
object.AddToFavorites "SomeString"
object.AddToFavorites

From C/C++, if a string is supplied, pass a Variant of type VT_BSTR. The application assigns the string as the title of the shortcut. If a string is not supplied, pass a Variant of type VT_EMPTY, or of type VT_ERROR and HRESULT DISP_E_PARAMNOTFOUND.

Example

The following macro shows how to add a hyperlink to a shape and assign a description and address to the hyperlink. Then it shows four ways to use the AddToFavorites method to add the hyperlink to the Favorites folder.

Before running this macro, replace address with a valid Internet or intranet address, and replace path with a valid path and folder name, including the drive letter, if necessary, on your computer.

VBA Copy code Copy code

Sub AddToFavorites_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoHyperlink As Visio.Hyperlink

 'Create a new shape to add the hyperlink to.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 Set vsoHyperlink = vsoShape.AddHyperlink

 'Assign a description and an address to the hyperlink.
 vsoHyperlink.Description = "Web site"
 vsoHyperlink.Address = "http://address"

 'Use the default name for the new favorite link.
 vsoHyperlink.AddToFavorites

 'Specify a different name for the new favorite link.
 'You don't need to specify the URL extension.
 vsoHyperlink.AddToFavorites "New Favorite Name"

 'Specify a different path to the favorite.
 vsoHyperlink.AddToFavorites "path\favoriteName"

 'Set a hyperlink base to allow relative hyperlinks.
 ThisDocument.HyperlinkBase = "path"

 'Specify a relative path to the Favorites folder.
 'The URL extension is added automatically.
 vsoHyperlink.AddToFavorites ".\favoriteName"

End Sub


Hyperlink.Copy Method (Visio)

 Copy code hover
[image]

Hyperlink.Copy Method (Visio)
Send feedback

Published: July 16, 2012

Copies a hyperlink to the Clipboard.

Version Information

Version Added: Visio 2.0

Syntax

expression .Copy

expression A variable that represents a Hyperlink object.

Return Value

Nothing

Remarks

To make a copy without using the Clipboard, use the Duplicate method.


Hyperlink.CreateURL Method (Visio)

 Copy code hover
[image]

Hyperlink.CreateURL Method (Visio)
Send feedback

Published: July 16, 2012

Returns a fully qualified and optionally canonicalized representation of the hyperlink's absolute address.

Version Information

Version Added: Visio 5.0

Syntax

expression .CreateURL(CanonicalForm)

expression A variable that represents a Hyperlink object.

Parameters

Name | Required/Optional | Data Type | Description
CanonicalForm | Required | Integer | True (non-zero) if canonical form; otherwise, False (0).

Return Value

String

Remarks

The CreateURL method of the Hyperlink object can be used to resolve relative URLs against a hyperlink's base address.

When you use the canonical form, the CreateURL method applies URL canonicalization rules to the hyperlink. Only spaces are URL-encoded during canonicalization. Port 80 is assumed for HTTP URLs and is removed during canonicalization. For example, the URL "http://www.microsoft.com:80/" is returned as "http://www.microsoft.com/", whereas http://www.microsoft.com:1000/" is unchanged.

Example

Here are some examples of results of the CreateURL method:

VBA Copy code Copy code
Address = "http://www.microsoft.com/"
CreateURL(False) returns "http://www.microsoft.com/"

Address = "C:\My Documents\Spreadsheet.XLS"
CreateURL(False) returns "file://C:\My Documents\Spreadsheet.XLS"
CreateURL(True) returns "file://C:\My%20Documents\Spreadsheet.XLS"

Relative path example:

VBA Copy code Copy code
Assume : Document.HyperlinkBase = "http://www.microsoft.com/widgets/"
Address = "../file.htm"
CreateURL(False) returns "http://www.microsoft.com/file.htm"

The following example shows how to use the CreateURL method to resolve relative URLs against the base address of a hyperlink. Before running this macro, replace drive\folder\subfolder with a valid file path on your computer, replace address with a valid Internet or intranet address, and replace drawing.vsd with a valid file on your computer.

VBA Copy code Copy code

Sub CreateURL_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoHyperlink As Visio.Hyperlink

 'Draw a rectangle shape on the active page
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Add a hyperlink to a shape
 Set vsoHyperlink = vsoShape.AddHyperlink

 'Allow relative hyperlink addresses
 ActiveDocument.HyperlinkBase = "drive:\folder\subfolder"

 'Return a relative address
 vsoHyperlink.Address = "..\drawing.vsd"

 'Print the resulting URLs to the Debug window
 'to show how the relative path is derived
 'from the base path and the difference
 'between canonical and non-canonical forms
 Debug.Print vsoHyperlink.CreateURL(False)
 Debug.Print vsoHyperlink.CreateURL(True)

 'Return an absolute address
 vsoHyperlink.Address = "http://address"

 'Print the resulting URL to the Debug window
 Debug.Print vsoHyperlink.CreateURL(False)

End Sub


Hyperlink.Delete Method (Visio)

 Copy code hover
[image]

Hyperlink.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object or selection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a Hyperlink object.

Return Value

Nothing


Hyperlink.Follow Method (Visio)

 Copy code hover
[image]

Hyperlink.Follow Method (Visio)
Send feedback

Published: July 16, 2012

Causes Microsoft Visio to navigate to a hyperlink.

Version Information

Version Added: Visio 5.0

Syntax

expression .Follow

expression A variable that represents a Hyperlink object.

Return Value

Nothing

Example

The following example draws a rectangle shape, adds a Hyperlink object to the shape, sets its Address and NewWindow properties, and then uses the Follow method to navigate the hyperlink.

Before running this code, replace address with a valid Internet or intranet address.

VBA Copy code Copy code

Public Sub Follow_Example()

 Dim vsoHyperlink As Visio.Hyperlink

 Set vsoHyperlink = ActivePage.DrawRectangle(0,0,5,5).AddHyperlink

 vsoHyperlink.Address = "http://address/"
 vsoHyperlink.NewWindow = False
 vsoHyperlink.Follow

End Sub


Hyperlinks Object (Visio)

 Copy code hover
[image]

Hyperlinks Object (Visio)
Send feedback

Published: July 16, 2012

Includes Hyperlink objects. A Hyperlinks collection enables you to access and manipulate a shape's Hyperlinks section.

Version Information

Version Added: Visio 2000

Remarks

To retrieve a Hyperlinks collection, use the Hyperlinks property of a Shape object.

The default property of a Hyperlinks collection is Item.


Hyperlinks Members (Visio)

 Copy code hover
[image]

Hyperlinks Members (Visio)
Send feedback

Published: July 16, 2012

Includes Hyperlink objects. A Hyperlinks collection enables you to access and manipulate a shape's Hyperlinks section.

Methods

Name | Description
Add | Adds a new object to a collection.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.


Hyperlinks Properties (Visio)

 Copy code hover
[image]

Hyperlinks Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.


Hyperlinks.Application Property (Visio)

 Copy code hover
[image]

Hyperlinks.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Hyperlinks object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Hyperlinks.Count Property (Visio)

 Copy code hover
[image]

Hyperlinks.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Hyperlinks object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Hyperlinks.Item Property (Visio)

 Copy code hover
[image]

Hyperlinks.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameOrIndex)

expression A variable that represents a Hyperlinks collection.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

Hyperlink

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.


Hyperlinks.ItemU Property (Visio)

 Copy code hover
[image]

Hyperlinks.ItemU Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ItemU(NameOrIndex)

expression A variable that represents a Hyperlinks object.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the universal name, unique ID, or index of the object to retrieve.

Return Value

Hyperlink

Remarks

You can retrieve an object in an Addons, Hyperlinks, Layers, Masters, MasterShortcuts, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

If you retrieve a Shape object by name, the ItemU property searches all shapes in the Shapes collection's containing page or containing master, in addition to the collection's containing shape. Therefore, the Shape object returned by the ItemU property can be a shape that is not in the Shapes collection.

You can also pass the unique ID string of a Master or Shape object to the ItemU property. For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

If such a string is passed to the ItemU property of a Shapes collection, all the shapes contained in the collection are searched. Shapes within the group shapes in the containing shape are not searched.

To search all shapes in the collection, plus the shapes inside groups and the containing shape of the collection, prefix the unique ID string with an asterisk (*). For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")
Note Note

  • In Visio 2000 only, vsoShapes.ItemU("{guid}") examined the Shapes collection's containing shape and all descendants, and vsoShapes.ItemU("*{guid}") examined all shapes in the Shapes collection's containing page or containing master.

  • Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

    As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

Example

This Microsoft Visual Basic macro shows how to use the ItemU property of the Pages collection to get the Shapes collection. Then it uses the ItemU property of the Shapes collection to print the universal names of all shapes on Page-1 in the Immediate window.

To run this macro, make sure the active document has shapes on Page-1.

VBA Copy code Copy code
Public Sub ItemU_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.ItemU(1).Shapes

    Debug.Print "Shapes in Document: "; ActiveDocument.Name
    Debug.Print "          on  Page: "; ActiveDocument.Pages.ItemU(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then

        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.ItemU(intCounter).Name
        Next intCounter

    Else

        Debug.Print " No Shapes On Page"

    End If

End Sub


Hyperlinks.ObjectType Property (Visio)

 Copy code hover
[image]

Hyperlinks.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Hyperlinks object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Hyperlinks.Shape Property (Visio)

 Copy code hover
[image]

Hyperlinks.Shape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Shape

expression A variable that represents a Hyperlinks object.

Return Value

Shape

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Shape property to get the Shape objects that own a Cell and a Characters object.

VBA Copy code Copy code

Public Sub Shape_Example()

 Dim vsoRectangle As Visio.Shape
 Dim vsoOval As Visio.Shape
 Dim vsoShapeFromCell As Visio.Shape
 Dim vsoShapeFromCharacters As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim vsoCharacters As Visio.Characters

 'Create 2 different shapes and add different text to each shape.
 Set vsoRectangle = ActivePage.DrawRectangle(2, 3, 5, 4)
 Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
 vsoRectangle.Text = "Rectangle Shape"
 vsoOval.Text = "Oval Shape"

 'Get a Cell object from the first shape.
 Set vsoCell = vsoRectangle.Cells("Width")

 'Get a Characters object from the second shape.
 Set vsoCharacters = vsoOval.Characters

 'Use the Shape property to get the Shape object.
 Set vsoShapeFromCell = vsoCell.Shape
 Set vsoShapeFromCharacters = vsoCharacters.Shape

 'Use each shape's text to verify the proper Shape
 'object was returned.
 Debug.Print vsoShapeFromCell.Text
 Debug.Print vsoShapeFromCharacters.Text

End Sub


Hyperlinks.Stat Property (Visio)

 Copy code hover
[image]

Hyperlinks.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Hyperlinks object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Hyperlinks Methods (Visio)

 Copy code hover
[image]

Hyperlinks Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.


Hyperlinks.Add Method (Visio)

 Copy code hover
[image]

Hyperlinks.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents a Hyperlinks object.

Return Value

Hyperlink

Remarks

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.


InvisibleApp Object (Visio)

 Copy code hover
[image]

InvisibleApp Object (Visio)
Send feedback

Published: July 16, 2012

Represents an invisible instance of Microsoft Visio. The properties of the InvisibleApp object are identical to those of the Application object.

Version Information

Version Added: Visio 2000

Remarks

You can use the InvisibleApp object when you want to take advantage of Automation in Visio without end-user interaction or knowledge.

An external program typically creates or retrieves an Application or InvisibleApp object before it can retrieve other Visio objects from that instance. Use the Microsoft Visual Basic CreateObject function or the New keyword to run a new instance. Set the value of the InvisibleApp object's Visible property to True to show it.

Note Note

You cannot use the Visual Basic GetObject function to retrieve an InvisibleApp object for an instance of Visio that is already running. Attempts to do so will fail.

Use the Documents, Windows, and Addons properties of an InvisibleApp object to retrieve the Documents, Windows, and Addons collections of the instance respectively.

Use the ActiveDocument, ActivePage, or ActiveWindow property to retrieve the currently active Document, Page, or Window object.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

ActiveDocument is the default property of an InvisibleApp object.

Note Note

Code in the Microsoft Visual Basic for Applications (VBA) project of a Visio document can use the Visio global object instead of a Visio Invisible App object to retrieve other objects.


InvisibleApp Members (Visio)

 Copy code hover
[image]

InvisibleApp Members (Visio)
Send feedback

Published: July 16, 2012

Represents an invisible instance of Microsoft Visio. The properties of the InvisibleApp object are identical to those of the Application object.

Events

Name | Description
AfterModal | Occurs after the Microsoft Visio instance leaves a modal state.
AfterRemoveHiddenInformation | Occurs when hidden information is removed from the document.
AfterReplaceShapes | Occurs after a shape-replacement operation.
AfterResume | Occurs when the operating system resumes normal operation after having been suspended.
AfterResumeEvents | Occurs after firing of events is resumed.
AppActivated | Occurs after a Microsoft Visio instance becomes active.
AppDeactivated | Occurs after a Microsoft Visio instance becomes inactive.
AppObjActivated | Occurs after a Microsoft Visio instance becomes active.
AppObjDeactivated | Occurs after a Microsoft Visio instance becomes inactive.
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
BeforeDocumentClose | Occurs before a document is closed.
BeforeDocumentSave | Occurs before a document is saved.
BeforeDocumentSaveAs | Occurs just before a document is saved by using the Save As command.
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforeModal | Occurs before a Microsoft Visio instance enters a modal state.
BeforePageDelete | Occurs before a page is deleted.
BeforeQuit | Occurs before a Microsoft Visio instance terminates.
BeforeReplaceShapes | Occurs just before a shape-replacement operation.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
BeforeStyleDelete | Occurs before a style is deleted.
BeforeSuspend | Occurs before the operating system enters a suspended state.
BeforeSuspendEvents | Occurs before firing of events is suspended.
BeforeWindowClosed | Occurs before a window is closed.
BeforeWindowPageTurn | Occurs before a window is about to show a different page.
BeforeWindowSelDelete | Occurs before the shapes in the selection of a window are deleted.
CalloutRelationshipAdded | Occurs when a new callout relationship is added to the application.
CalloutRelationshipDeleted | Occurs when a callout relationship is deleted from the application.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ContainerRelationshipAdded | Occurs when a new container relationship is added to the document.
ContainerRelationshipDeleted | Occurs when a container relationship is deleted from the document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
DataRecordsetAdded | Occurs when a DataRecordset object is added to a DataRecordsets collection.
DataRecordsetChanged | Occurs when a data recordset changes as a result of being refreshed.
DesignModeEntered | Occurs before a document enters design mode.
DocumentChanged | Occurs after certain properties of a document are changed.
DocumentCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.
DocumentCreated | Occurs after a document is created.
DocumentOpened | Occurs after a document is opened.
DocumentSaved | Occurs after a document is saved.
DocumentSavedAs | Occurs after a document is saved by using the Save As command.
EnterScope | Queued when an internal command begins, or when an Automation client opens a scope by using the BeginUndoScope method.
ExitScope | Queued when an internal command ends, or when an automation client exits a scope by using the EndUndoScope method.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
KeyDown | Occurs when a keyboard key is pressed.
KeyPress | Occurs when a keyboard key is pressed.
KeyUp | Occurs when a keyboard key is released.
MarkerEvent | Caused by calling the QueueMarkerEvent method.
MasterAdded | Occurs after a new master is added to a document.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
MouseDown | Occurs when a mouse button is clicked.
MouseMove | Occurs when the mouse is moved.
MouseUp | Occurs when a mouse button is released.
MustFlushScopeBeginning | Occurs before the Microsoft Visio instance is forced to flush its event queue.
MustFlushScopeEnded | Occurs after the Microsoft Visio instance is forced to flush its event queue.
NoEventsPending | Occurs after the Microsoft Visio instance flushes its event queue.
OnKeystrokeMessageForAddon | Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.
PageAdded | Occurs after a new page is added to a document.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelDocumentClose | Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelQuit | Occurs before the application terminates in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelReplaceShapes | Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSuspend | Occurs before the operating system enters a suspended state. If any event handler returns True, the Microsoft Visio instance will deny the operating system's request.
QueryCancelSuspendEvents | Occurs before the application suspends events in response to a client code. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelWindowClose | Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QuitCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelQuit event.
ReplaceShapesCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.
RuleSetValidated | Occurs when a rule set is validated.
RunModeEntered | Occurs after a document enters run mode.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionChanged | Occurs after a set of shapes selected in a window changes.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
StyleAdded | Occurs after a new style is added to a document.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.
SuspendCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSuspend event.
SuspendEventsCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSuspendEvents event. .
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.
ViewChanged | Occurs when the zoom level or scroll position of a drawing window changes.
VisioIsIdle | Occurs after the application empties its message queue.
WindowActivated | Occurs after the active window changes in a Microsoft Visio instance.
WindowChanged | Occurs when the size or position of a window changes.
WindowCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.
WindowOpened | Occurs after a window is opened.
WindowTurnedToPage | Occurs after a window shows a different page.

Methods

Name | Description
AddUndoUnit | Adds an object that supports the IOleUndoUnit or IVBUndoUnit interface to the Microsoft Visio undo queue.
BeginUndoScope | Starts a transaction with a unique scope ID for an instance of Microsoft Visio.
ClearCustomMenus | Restores the built-in Microsoft Visio user interface.
ClearCustomToolbars | Restores the built-in Microsoft Visio user interface.
ConvertResult | Converts a string or number into an equivalent number in different measurement units.
DoCmd | Performs the command that has the indicated command ID.
EndUndoScope | Ends or cancels a transaction that has a unique scope.
EnumDirectories | Returns an array naming the folders Microsoft Visio would search, given a list of paths.
FormatResult | Formats a string or number into a string according to a format picture. Uses specified units for scaling and formatting.
FormatResultEx | Formats a string or number into a string according to a format picture, using specified units for scaling and formatting. Optionally, for date or time strings, sets the language and calendar type of the string.
GetBuiltInStencilFile | Returns the file path to the specified built-in, hidden stencil used to populate certain galleries in the Microsoft Visio user interface.
GetCustomStencilFile | Returns the path to the specified custom stencil used to populate certain galleries in the Microsoft Visio user interface.
GetPreviewEnabled | Returns a value that indicates whether preview is enabled for the specified gallery in the Microsoft Visio user interface.
InvokeHelp | Performs operations that involve the Microsoft Visio Help system.
OnComponentEnterState | Informs a Microsoft Visio instance that client code is causing the instance to enter or exit a particular state.
PurgeUndo | Empties the Microsoft Visio queue of undo actions.
QueueMarkerEvent | Queues a MarkerEvent event that fires after all other queued events.
Quit | Closes the indicated instance of Microsoft Visio.
Redo | Reverses the most recent undo unit.
RegisterRibbonX | Registers the IRibbonExtensibility interface that is implemented by the specified add-on to populate the custom user interface (UI).
RenameCurrentScope | Renames the top-level open undo scope.
SetCustomMenus | Replaces the current built-in or custom menus of an application or document.
SetCustomToolbars | Replaces the current built-in or custom toolbars of an application or document.
SetPreviewEnabled | Turns preview on or off for a gallery in the Microsoft Visio user interface.
Undo | Reverses the most recent undo unit, if the undo unit can be reversed.
UnregisterRibbonX | Unregisters a previouly registered IRibbonExtensiblity interface that a Microsoft Visio add-in implements.

Properties

Name | Description
Active | Indicates whether the instance of Microsoft Visio represented by the Application object is the active application on the Microsoft Windows desktop—the application that has the highlighted title bar. Read-only.
ActiveDocument | Returns the active Document object, which is the document shown in the active window. Read-only.
ActivePage | Returns the active Page object. Read-only.
ActivePrinter | Specifies the printer that all Microsoft Visio documents print to. Read/write.
ActiveWindow | Returns the active Window object. Read-only.
AddonPaths | Gets or sets the paths where Microsoft Visio looks for third-party or user add-ons. Read/write.
Addons | Returns the Addons collection of an Application or InvisibleApp object. Read-only.
AlertResponse | Determines whether Microsoft Visio shows alerts and modal dialog boxes to the user. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Assistance | Gets a reference to the Microsoft Office (MSO) IAssistance object, which provides a means for developers to create a customized help experience for users within Microsoft Office. Read-only.
AutoLayout | Allows you to temporarily disable automatic layout functionality in Microsoft Visio and then re-enable it after you are finished with an action. Read/write.
AutoRecoverInterval | Represents the time interval (in minutes) for how often you want to save copies of open documents that have unsaved changes in case of a power failure or an application error. Read/write.
AvailablePrinters | Returns a list of installed printers. Read-only.
Build | Returns the build number of the running instance. Read-only.
BuiltInMenus | Returns a UIObject object that represents a copy of the built-in Microsoft Visio menus and accelerators. Read-only.
BuiltInToolbars | Returns a UIObject object that represents a copy of the built-in Microsoft Visio toolbars. Read-only.
COMAddIns | Returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently registered in Microsoft Visio. Read-only.
CommandBars | Returns a reference to the CommandBars collection that represents the command bars in the container application. Read-only.
CommandLine | Determines how Microsoft Visio was started. Read-only.
ConnectorToolDataObject | Returns an IDataObject interface representing the active Connector tool used in the Microsoft Visio user interface. Read-only.
CurrentEdition | Returns an enumerated value that represents the edition of the current instance of Microsoft Visio. Read-only.
CurrentScope | Determines the ID of the scope that causes an event to fire. Read-only.
CustomMenus | Gets a UIObject object that represents the current custom menus and accelerators of an InvisibleApp object. Read-only.
CustomMenusFile | Gets or sets the name of the file that defines custom menus and accelerators for an InvisibleApp object. Read/write.
CustomToolbars | Gets a UIObject object that represents the current custom toolbars and status bars of an InvisibleApp object. Read-only.
CustomToolbarsFile | Returns or sets the name of the file that defines custom toolbars and status bars for an InvisibleApp object. Read/write.
DataFeaturesEnabled | Gets whether the data features in Microsoft Visio are enabled for the current instance of Visio. Read-only.
DefaultAngleUnits | Determines the default unit of measure for quantities that represent angles. Read/write.
DefaultDurationUnits | Determines the default unit of measure for quantities that represent durations. Read/write.
DefaultRectangleDataObject | Returns an IDataObject interface that represents the Rectangle tool used in the Microsoft Visio user interface. Read-only.
DefaultTextUnits | Determines the default unit of measure for quantities that represent text metrics. Read/write.
DefaultZoomBehavior | Determines the zoom behavior for all new Microsoft Visio documents and drawing windows. Read/write.
DeferRecalc | Determines whether the application recalculates cell formulas during a series of actions. Read/write.
DeferRelationshipRecalc | Determines whether Microsoft Visio defers recalculating shape sizes and relationships when a member of a relationship pair is moved or resized. Read/write.
DialogFont | Returns information about the fonts that Microsoft Visio uses in its dialog boxes. Read-only.
Documents | Returns the Documents collection for a Microsoft Visio instance. Read-only.
DrawingPaths | Gets or sets the paths where Microsoft Visio looks for drawings. Read/write.
EventInfo | Gets additional information associated with an event, if any exists. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
EventsEnabled | Determines whether a Microsoft Visio instance fires events. Read/write.
FullBuild | Returns the full build number of the running instance. Read-only.
HelpPaths | Gets or sets the paths where Microsoft Visio looks for Help files. Read/write.
InhibitSelectChange | Determines whether shapes added to the drawing page by Automation are selected. Read/write.
InstanceHandle32 | Gets the instance handle of the Application object for a 32-bit version of Microsoft Visio. Read-only.
InstanceHandle64 | Gets the instance handle of the InvisibleApp object for a 64-bit version of Microsoft Visio. Read-only.
IsInScope | Determines whether a call to an event handler is between an EnterScope event and an ExitScope event for a scope. Read-only.
IsUndoingOrRedoing | Determines whether the current event handler is being called as a result of an Undo or Redo action in the application. Read-only.
IsVisio32 | Returns True if the current instance of Microsoft Visio is 32-bit. Returns False if the current instance is 64-bit. Read-only.
Language | Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.
LanguageHelp | Represents the language ID of the Help in the version of the Microsoft Visio instance represented by the parent object. Read-only.
LanguageSettings | Returns a reference to the Microsoft Office (MSO) LanguageSettings interface. Read-only.
LiveDynamics | Controls whether Microsoft Visio recalculates shape properties during drag operations on every mouse move or only after the mouse button is released. Read/write.
MyShapesPath | Gets or sets where Microsoft Visio looks for the My Shapes folder on the user's hard disk. Read/write.
Name | Specifies the name of an object. Read-only.
ObjectType | Returns an object's type. Read-only.
OnDataChangeDelay | Gets or sets how long the Microsoft Visio instance waits before advising a container application that a Visio document being shown by the container has changed and should be redisplayed. Read/write.
Path | Returns the drive and folder path of the Microsoft Visio application. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
ProcessID | Returns the unique identity of the current Microsoft Visio process. Read-only.
PromptForSummary | Determines whether Microsoft Visio prompts for document properties when it saves a document. Read/write.
SaveAsWebObject | Returns a reference to the IDispatch interface of a VisSaveAsWeb object. Read-only.
ScreenUpdating | Determines whether the screen is updated (redrawn) during a series of actions. Read/write.
Settings | Returns an ApplicationSettings object, which you can use to set Microsoft Visio application properties. Read-only.
ShowChanges | Determines whether the screen is updated (redrawn) during a series of actions. Read/write.
ShowProgress | Determines whether a progress indicator is shown while performing certain operations. Read/write.
ShowStatusBar | Determines whether the status bar is shown. Read/write.
ShowToolbar | Determines whether toolbars and menu bars are visible. Read/write.
StartupPaths | Gets or sets the paths where Microsoft Visio looks for third-party and user add-ons to run when the application is started. Read/write.
Stat | Returns status information for an object. Read-only.
StencilPaths | Gets or sets the paths where Microsoft Visio looks for stencils. Read/write.
TemplatePaths | Gets or sets the paths where Microsoft Visio looks for templates. Read/write.
TraceFlags | Gets or sets events logged during a Microsoft Visio instance. Read/write.
TypelibMajorVersion | Returns the major version number of the Microsoft Visio type library. Read-only.
TypelibMinorVersion | Returns the minor version number of the Microsoft Visio type library. Read-only.
UndoEnabled | Determines whether undo information is maintained in memory. Read/write.
UserName | Gets or sets the user name of an Application object. Read/write.
VBAEnabled | Specifies whether Microsoft Visual Basic for Applications (VBA) is enabled in the application. Read-only.
Vbe | Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Visio documents. Read-only.
Version | Returns the version of a running Microsoft Visio instance. Read-only.
Visible | Determines whether an object is visible. Read/write.
Window | Returns the window associated with the current instance of Microsoft Visio. Read-only.
WindowHandle32 | Returns the 32-bit handle of a Microsoft Visio window. Read-only.
Windows | Returns the Windows collection for a Microsoft Visio instance or window. Read-only.


InvisibleApp Properties (Visio)

 Copy code hover
[image]

InvisibleApp Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Active | Indicates whether the instance of Microsoft Visio represented by the Application object is the active application on the Microsoft Windows desktop—the application that has the highlighted title bar. Read-only.
ActiveDocument | Returns the active Document object, which is the document shown in the active window. Read-only.
ActivePage | Returns the active Page object. Read-only.
ActivePrinter | Specifies the printer that all Microsoft Visio documents print to. Read/write.
ActiveWindow | Returns the active Window object. Read-only.
AddonPaths | Gets or sets the paths where Microsoft Visio looks for third-party or user add-ons. Read/write.
Addons | Returns the Addons collection of an Application or InvisibleApp object. Read-only.
AlertResponse | Determines whether Microsoft Visio shows alerts and modal dialog boxes to the user. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Assistance | Gets a reference to the Microsoft Office (MSO) IAssistance object, which provides a means for developers to create a customized help experience for users within Microsoft Office. Read-only.
AutoLayout | Allows you to temporarily disable automatic layout functionality in Microsoft Visio and then re-enable it after you are finished with an action. Read/write.
AutoRecoverInterval | Represents the time interval (in minutes) for how often you want to save copies of open documents that have unsaved changes in case of a power failure or an application error. Read/write.
AvailablePrinters | Returns a list of installed printers. Read-only.
Build | Returns the build number of the running instance. Read-only.
BuiltInMenus | Returns a UIObject object that represents a copy of the built-in Microsoft Visio menus and accelerators. Read-only.
BuiltInToolbars | Returns a UIObject object that represents a copy of the built-in Microsoft Visio toolbars. Read-only.
COMAddIns | Returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently registered in Microsoft Visio. Read-only.
CommandBars | Returns a reference to the CommandBars collection that represents the command bars in the container application. Read-only.
CommandLine | Determines how Microsoft Visio was started. Read-only.
ConnectorToolDataObject | Returns an IDataObject interface representing the active Connector tool used in the Microsoft Visio user interface. Read-only.
CurrentEdition | Returns an enumerated value that represents the edition of the current instance of Microsoft Visio. Read-only.
CurrentScope | Determines the ID of the scope that causes an event to fire. Read-only.
CustomMenus | Gets a UIObject object that represents the current custom menus and accelerators of an InvisibleApp object. Read-only.
CustomMenusFile | Gets or sets the name of the file that defines custom menus and accelerators for an InvisibleApp object. Read/write.
CustomToolbars | Gets a UIObject object that represents the current custom toolbars and status bars of an InvisibleApp object. Read-only.
CustomToolbarsFile | Returns or sets the name of the file that defines custom toolbars and status bars for an InvisibleApp object. Read/write.
DataFeaturesEnabled | Gets whether the data features in Microsoft Visio are enabled for the current instance of Visio. Read-only.
DefaultAngleUnits | Determines the default unit of measure for quantities that represent angles. Read/write.
DefaultDurationUnits | Determines the default unit of measure for quantities that represent durations. Read/write.
DefaultRectangleDataObject | Returns an IDataObject interface that represents the Rectangle tool used in the Microsoft Visio user interface. Read-only.
DefaultTextUnits | Determines the default unit of measure for quantities that represent text metrics. Read/write.
DefaultZoomBehavior | Determines the zoom behavior for all new Microsoft Visio documents and drawing windows. Read/write.
DeferRecalc | Determines whether the application recalculates cell formulas during a series of actions. Read/write.
DeferRelationshipRecalc | Determines whether Microsoft Visio defers recalculating shape sizes and relationships when a member of a relationship pair is moved or resized. Read/write.
DialogFont | Returns information about the fonts that Microsoft Visio uses in its dialog boxes. Read-only.
Documents | Returns the Documents collection for a Microsoft Visio instance. Read-only.
DrawingPaths | Gets or sets the paths where Microsoft Visio looks for drawings. Read/write.
EventInfo | Gets additional information associated with an event, if any exists. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
EventsEnabled | Determines whether a Microsoft Visio instance fires events. Read/write.
FullBuild | Returns the full build number of the running instance. Read-only.
HelpPaths | Gets or sets the paths where Microsoft Visio looks for Help files. Read/write.
InhibitSelectChange | Determines whether shapes added to the drawing page by Automation are selected. Read/write.
InstanceHandle32 | Gets the instance handle of the Application object for a 32-bit version of Microsoft Visio. Read-only.
InstanceHandle64 | Gets the instance handle of the InvisibleApp object for a 64-bit version of Microsoft Visio. Read-only.
IsInScope | Determines whether a call to an event handler is between an EnterScope event and an ExitScope event for a scope. Read-only.
IsUndoingOrRedoing | Determines whether the current event handler is being called as a result of an Undo or Redo action in the application. Read-only.
IsVisio32 | Returns True if the current instance of Microsoft Visio is 32-bit. Returns False if the current instance is 64-bit. Read-only.
Language | Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.
LanguageHelp | Represents the language ID of the Help in the version of the Microsoft Visio instance represented by the parent object. Read-only.
LanguageSettings | Returns a reference to the Microsoft Office (MSO) LanguageSettings interface. Read-only.
LiveDynamics | Controls whether Microsoft Visio recalculates shape properties during drag operations on every mouse move or only after the mouse button is released. Read/write.
MyShapesPath | Gets or sets where Microsoft Visio looks for the My Shapes folder on the user's hard disk. Read/write.
Name | Specifies the name of an object. Read-only.
ObjectType | Returns an object's type. Read-only.
OnDataChangeDelay | Gets or sets how long the Microsoft Visio instance waits before advising a container application that a Visio document being shown by the container has changed and should be redisplayed. Read/write.
Path | Returns the drive and folder path of the Microsoft Visio application. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
ProcessID | Returns the unique identity of the current Microsoft Visio process. Read-only.
PromptForSummary | Determines whether Microsoft Visio prompts for document properties when it saves a document. Read/write.
SaveAsWebObject | Returns a reference to the IDispatch interface of a VisSaveAsWeb object. Read-only.
ScreenUpdating | Determines whether the screen is updated (redrawn) during a series of actions. Read/write.
Settings | Returns an ApplicationSettings object, which you can use to set Microsoft Visio application properties. Read-only.
ShowChanges | Determines whether the screen is updated (redrawn) during a series of actions. Read/write.
ShowProgress | Determines whether a progress indicator is shown while performing certain operations. Read/write.
ShowStatusBar | Determines whether the status bar is shown. Read/write.
ShowToolbar | Determines whether toolbars and menu bars are visible. Read/write.
StartupPaths | Gets or sets the paths where Microsoft Visio looks for third-party and user add-ons to run when the application is started. Read/write.
Stat | Returns status information for an object. Read-only.
StencilPaths | Gets or sets the paths where Microsoft Visio looks for stencils. Read/write.
TemplatePaths | Gets or sets the paths where Microsoft Visio looks for templates. Read/write.
TraceFlags | Gets or sets events logged during a Microsoft Visio instance. Read/write.
TypelibMajorVersion | Returns the major version number of the Microsoft Visio type library. Read-only.
TypelibMinorVersion | Returns the minor version number of the Microsoft Visio type library. Read-only.
UndoEnabled | Determines whether undo information is maintained in memory. Read/write.
UserName | Gets or sets the user name of an Application object. Read/write.
VBAEnabled | Specifies whether Microsoft Visual Basic for Applications (VBA) is enabled in the application. Read-only.
Vbe | Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Visio documents. Read-only.
Version | Returns the version of a running Microsoft Visio instance. Read-only.
Visible | Determines whether an object is visible. Read/write.
Window | Returns the window associated with the current instance of Microsoft Visio. Read-only.
WindowHandle32 | Returns the 32-bit handle of a Microsoft Visio window. Read-only.
Windows | Returns the Windows collection for a Microsoft Visio instance or window. Read-only.


InvisibleApp.Active Property (Visio)

 Copy code hover
[image]

InvisibleApp.Active Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether the instance of Microsoft Visio represented by the Application object is the active application on the Microsoft Windows desktop—the application that has the highlighted title bar. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .Active

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

The active application on the Windows desktop is distinct from the active Visio instance, which is returned by a call to the OLE GetActiveObject method (GetObject method in Microsoft Visual Basic). The GetObject method retrieves the instance of Visio that was most recently activated, which may or may not be the active application on the desktop at that moment. Of all instances of Visio that are currently running, only one is the active Visio instance.

For example, suppose you start one instance of Visio and one of another application, such as Microsoft Excel.

  • If the instance of Visio is the active application on your desktop, GetObject(, "visio.application") retrieves that instance, and its Active property is True.

  • If you activate the instance of Microsoft Excel, GetObject(, "visio.application") retrieves the same instance of Visio, but its Active property is False.

If an Application object's Active property is True, you can assume that the corresponding instance of Visio is the active instance of Visio unless the InPlace property is also True. If an instance of Visio is activated for in-place editing in a container application, that instance may not necessarily report itself as the active instance of Visio.

Example

The following Visual Basic program shows how to get the active instance of Visio.

VBA Copy code Copy code

Public Sub Active_Example()

 Dim vsoApplication1 As Visio.Application
 Dim vsoApplication2 As Visio.Application

 'Create two new instances of Visio.
 Set vsoApplication1 = CreateObject("visio.application")
 Set vsoApplication2 = CreateObject("visio.application")

 'Use the Active property to determine whether
 'the instance of Visio is active. 'Result = False. Prints "0" in the Immediate window
 Debug.Print vsoApplication1.Active

 'Result = True. Prints "-1" in the Immediate window.
 Debug.Print vsoApplication2.Active

End Sub


InvisibleApp.ActiveDocument Property (Visio)

 Copy code hover
[image]

InvisibleApp.ActiveDocument Property (Visio)
Send feedback

Published: July 16, 2012

Returns the active Document object, which is the document shown in the active window. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ActiveDocument

expression A variable that represents an InvisibleApp object.

Return Value

Document

Remarks

When no documents are open, there is no active document and the ActiveDocument property returns the value Nothing and does not raise an exception.

If your code is in the Microsoft Visual Basic project of a Visio document, the ActiveDocument property often, but not necessarily, returns a reference to the ThisDocument object, a class module in the Visual Basic project of every Microsoft Visio document. If the ThisDocument object is shown in the active window, the ActiveDocument object and the ThisDocument object refer to the same document. When the ThisDocument object is referenced from code in a project, it returns a reference to the project's Document object.

Whether you use the ActiveDocument object or the ThisDocument object depends on the purpose of your code.

You can compare the result returned by the ActiveDocument property with the value Nothing to determine if a document is active. If the value of the Application.Documents.Count property is greater than zero, at least one document is open and active.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows two safe ways to get an active document (if one exists). In each case, it prints the name of the active document in the Immediate window. The code gets the active document without qualification from the Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document.

VBA Copy code Copy code

Public Sub ActiveDocument_Example()

 Dim vsoDocument As Document

 'First method
 If Documents.Count > 0 Then
 Set vsoDocument = ActiveDocument
 Debug.Print vsoDocument.Name
 Else
 Debug.Print "No active document."
 End If

 'Second method
 If Not(ActiveDocument Is Nothing) Then
 Set vsoDocument = ActiveDocument
 Debug.Print vsoDocument.Name
 Else
 Debug.Print "No active document."
 End If

End Sub


InvisibleApp.ActivePage Property (Visio)

 Copy code hover
[image]

InvisibleApp.ActivePage Property (Visio)
Send feedback

Published: July 16, 2012

Returns the active Page object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ActivePage(lpdispRet)

expression A variable that represents an InvisibleApp object.

Return Value

Page

Remarks

The ActivePage property returns a Page object only when the active window displays a drawing page; otherwise, it returns Nothing. To verify that a page is active, use the Is operator to compare the ActivePage property with Nothing.

It is possible to get the active window without qualification from the Microsoft Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document. For example, you can use this code:

VBA Copy code Copy code
Set vsoPage = ActivePage

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the active page without qualification from the Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document.

VBA Copy code Copy code

Public Sub ActivePage_Example()

 Dim vsoPage As Page

 'Find out if a page exists, and if it does, get the page.
 If Not(ActivePage Is Nothing) Then
 Set vsoPage = ActivePage
 Debug.Print vsoPage.Name
 Else
 Debug.Print "No active page."
 End If

End Sub


InvisibleApp.ActivePrinter Property (Visio)

 Copy code hover
[image]

InvisibleApp.ActivePrinter Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the printer that all Microsoft Visio documents print to. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .ActivePrinter

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

The ActivePrinter property is initially set to the default printer.


InvisibleApp.ActiveWindow Property (Visio)

 Copy code hover
[image]

InvisibleApp.ActiveWindow Property (Visio)
Send feedback

Published: July 16, 2012

Returns the active Window object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ActiveWindow)

expression A variable that represents an InvisibleApp object.

Return Value

Window

Remarks

The active window can be one of the following window types: Drawing, Stencil, ShapeSheet, Edit Icon, or a Drawing or Stencil window created by an add-on. The application's active window can only be an MDI frame window—it cannot be one of the floating, docked, or anchored windows. For a complete list of window types, see the Type property.

If a window in an instance of Microsoft Visio is not active, the ActiveWindow property returns Nothing.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to get the active window without qualification from the Visio global object, which is automatically available to VBA code that is part of the VBA project of a Visio document.

VBA Copy code Copy code

Public Sub ActiveWindow_Example()

 Dim vsoWindow As Visio.Window

 'Get the active window.
 Set vsoWindow = ActiveWindow

 'To verify that we got the active window, print its caption.
 Debug.Print vsoWindow.Caption

End Sub


InvisibleApp.AddonPaths Property (Visio)

 Copy code hover
[image]

InvisibleApp.AddonPaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for third-party or user add-ons. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddonPaths

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

The AddonPaths property is set to an empty string ("") by default.

To indicate more than one folder in the path where you want Visio to look for third-party or user add-ons, use semicolons to separate individual items in the path string.

The string passed to and received from the AddonPaths property is the same string shown in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\AddonsPath subkey.

When Visio looks for third-party and user add-ons, it looks in all paths named in the AddonPaths property, as well as at the paths of any add-ons installed at setup, and all the subfolders of those paths. If you pass the AddonPaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Starting with Microsoft Office Visio 2003, instead of specifying file paths to your Visio add-ons, you can publish your add-ons by using a Microsoft Windows Installer package. By doing so, you can take advantage of Microsoft Office features such as language switching, installation on demand, and repair. For more information about using a Windows Installer package to publish your add-ons, search for "Microsoft Windows Installer" on MSDN.

Note Note

Modifying the registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).


InvisibleApp.Addons Property (Visio)

 Copy code hover
[image]

InvisibleApp.Addons Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Addons collection of an Application or InvisibleApp object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Addons

expression A variable that represents an InvisibleApp object.

Return Value

Addons

Remarks

The Addons collection includes an Addon object for each add-on in the folders specified by the AddonPaths property and for each add-on that is added dynamically to the collection by other add-ons.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the Addons collection and add an add-on to it.

Before running this macro, replace path\filename with a valid path and file name for an add-on in your Visio project.

VBA Copy code Copy code

Public Sub Addons_Example()

 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Add an add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add("path\filename")

End Sub


InvisibleApp.AlertResponse Property (Visio)

 Copy code hover
[image]

InvisibleApp.AlertResponse Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio shows alerts and modal dialog boxes to the user. Read/write.

Version Information

Version Added: Visio 4.1

Syntax

expression .AlertResponse(lpi2Ret)

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

Certain operations, such as closing a document that has unsaved modifications, cause Visio to display an alert or modal dialog box requesting the user to supply a response such as OK, Yes, No, or Cancel. To prevent Visio from displaying an alert or modal dialog box when a program performs such an action, set the AlertResponse property to a default value for the response. In this case, Visio does not display the alert or modal dialog box; instead, Visio behaves as if the user responded to the alert or modal dialog box with the value of the AlertResponse property.

If the AlertResponse property is 0 (its default value), alerts and modal dialog boxes are displayed.

The values you supply for the AlertResponse property correspond to the standard Windows constants IDOK, IDCANCEL, and so forth.

Constant | Value
IDOK | 1
IDCANCEL | 2
IDABORT | 3
IDRETRY | 4
IDIGNORE | 5
IDYES | 6
IDNO | 7


InvisibleApp.Application Property (Visio)

 Copy code hover
[image]

InvisibleApp.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents an InvisibleApp object.

Return Value

Application


InvisibleApp.Assistance Property (Visio)

 Copy code hover
[image]

InvisibleApp.Assistance Property (Visio)
Send feedback

Published: July 16, 2012

Gets a reference to the Microsoft Office (MSO) IAssistance object, which provides a means for developers to create a customized help experience for users within Microsoft Office. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .Assistance

expression An expression that returns a InvisibleApp object.

Return Value

Object

Remarks

The IAssistance object exposes methods that allow developers to display Help topics in the Office Help Viewer or to display Help topics that ship with Microsoft Office in the Visio Help window.


InvisibleApp.AutoLayout Property (Visio)

 Copy code hover
[image]

InvisibleApp.AutoLayout Property (Visio)
Send feedback

Published: July 16, 2012

Allows you to temporarily disable automatic layout functionality in Microsoft Visio and then re-enable it after you are finished with an action. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .AutoLayout

expression A variable that represents an InvisibleApp object.

Return Value

Boolean

Remarks

Using the AutoLayout property helps to improve the performance of add-ons that execute many operations in connected drawings that use Visio automatic layout functionality.


InvisibleApp.AutoRecoverInterval Property (Visio)

 Copy code hover
[image]

InvisibleApp.AutoRecoverInterval Property (Visio)
Send feedback

Published: July 16, 2012

Represents the time interval (in minutes) for how often you want to save copies of open documents that have unsaved changes in case of a power failure or an application error. Read/write.

Version Information

Version Added: Visio 2000 SR-1

Syntax

expression .AutoRecoverInterval

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

Must be an integer value from zero (0) to 120, representing the interval in minutes. The default is 0. If the value of the AutoRecoverInterval property is less than or equal to 0, no automatic recovery copies are created.

If the value of the AutoRecoverInterval property is greater than 0, automatic recovery is enabled for all documents in the Microsoft Visio instance. To disable automatic recovery for a particular document, set its AutoRecover property to False.

Example

The following Microsoft Visual Basic for Applications (VBA) macros show how to set the AutoRecoverInterval property and how to use it to disable automatic recovery.

VBA Copy code Copy code

Public Sub AutoRecoverInterval_Example()

    'Save automatic recovery copies of unsaved files
    'every 10 minutes.
    Application.AutoRecoverInterval = 10

End Sub

Public Sub DisableAutoRecover_Example()

    'Tell Visio not to save automatic recovery copies of unsaved files.
    Application.AutoRecoverInterval = 0

End Sub


InvisibleApp.AvailablePrinters Property (Visio)

 Copy code hover
[image]

InvisibleApp.AvailablePrinters Property (Visio)
Send feedback

Published: July 16, 2012

Returns a list of installed printers. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .AvailablePrinters

expression A variable that represents an InvisibleApp object.

Return Value

String()

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AvailablePrinters property to get a list of available printers.

VBA Copy code Copy code
Public Sub AvailablePrinters_example()

 Dim aStrPrinters() As String
 Dim strPrinter As Variant

 aStrPrinters = Application.AvailablePrinters

 For Each strPrinter In aStrPrinters

 Debug.Print strPrinter

 Next

End Sub


InvisibleApp.Build Property (Visio)

 Copy code hover
[image]

InvisibleApp.Build Property (Visio)
Send feedback

Published: July 16, 2012

Returns the build number of the running instance. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .Build

expression A variable that represents an InvisibleApp object.

Return Value

Long

Remarks

The format of the build number is described in the following table.

Bits | Description
0 - 15 | Internal build number

The build number of the running instance is written to the BuildNumberCreated property when a new document is created, and to the BuildNumberEdited property when a document is edited.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Build property to get the build number of the running instance of Visio.

VBA Copy code Copy code

Public Sub Build_Example()

 Debug.Print Application.Build

End Sub


InvisibleApp.BuiltInMenus Property (Visio)

 Copy code hover
[image]

InvisibleApp.BuiltInMenus Property (Visio)
Send feedback

Published: July 16, 2012

Returns a UIObject object that represents a copy of the built-in Microsoft Visio menus and accelerators. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .BuiltInMenus

expression A variable that represents an InvisibleApp object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You can use the BuiltInMenus property to obtain a UIObject object and modify its menus and accelerators. You can then use the SetCustomMenus method of an Application or Document object to add your customized menus and accelerators to the built-in Visio user interface.

You can also use the SaveToFile method of the UIObject object to store its menus in a file and reload them as custom menus by setting the CustomMenusFile property of an Application or Document object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the BuiltInMenus property. It adds a menu and menu item to the Add-ins tab and sets the menu and menu item's Caption properties.

To restore the built-in user interface in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub BuiltInMenus_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a new menu before the Window menu.
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "MyNewMenu"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the Caption property for the new menu item.
 vsoMenuItem.Caption = "&MyNewMenuItem"

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


InvisibleApp.BuiltInToolbars Property (Visio)

 Copy code hover
[image]

InvisibleApp.BuiltInToolbars Property (Visio)
Send feedback

Published: July 16, 2012

Returns a UIObject object that represents a copy of the built-in Microsoft Visio toolbars. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .BuiltInToolbars(fIgnored)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
fIgnored | Required | Integer | Required for backward compatibility, but ignored. It is suggested that you pass zero (0).

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You can use the BuiltInToolbars property to obtain a UIObject object and modify its toolbars. You can then use the SetCustomToolbars method of an Application or Document object to substitute your customized toolbars for the built-in Visio toolbars.

You can also use the SaveToFile method of the UIObject object to store its toolbars in a file and reload them as custom toolbars by setting the CustomToolbarsFile property of an Application or Document object.

Prior to Visio 5.0, the argument for this property was (fWhichToolbars), which designated the type of toolbar to get (MSOffice or LotusSS). Beginning with Visio 5.0, the application no longer supports different types of toolbars and the current argument, (fIgnored), is ignored.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the BuiltInToolbars property to get a copy of the built-in Visio toolbars, add a toolbar button, set the button icon, and replace the built-in toolbar set with the custom set.

Before running this macro, replace (path\filename) in the code below with the full path to and file name of an icon file (.ico) on your computer.

To restore the built in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub BuiltInToolbars_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar sets.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON

 'Set the caption for the new toolbar button.
 vsoToolbarItem.Caption = "MyButton"

 'Set the icon for the new toolbar button.
 vsoToolbarItem.IconFileName "(path\filename)"

 'Tell Visio to actually use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


InvisibleApp.COMAddIns Property (Visio)

 Copy code hover
[image]

InvisibleApp.COMAddIns Property (Visio)
Send feedback

Published: July 16, 2012

Returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently registered in Microsoft Visio. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .COMAddIns

expression A variable that represents an InvisibleApp object.

Return Value

COMAddIns

Remarks

The COM add-ins that are currently registered are listed in the COM Add-Ins dialog box (click the File tab, click Options, click Add-Ins, and then click Go).

To get information about the object returned by the COMAddIns property:

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click Office.

  4. Under Classes, examine the class named COMAddIns.

Example

This macro shows how to use the COMAddIns property to list the COM add-ins registered with Visio.

VBA Copy code Copy code

Public Sub COMAddIns_Example()

    Dim vsoCOMAddIns As COMAddIns
    Dim vsoCOMAddIn As COMAddIn

    'Get the set of COM add-ins.
    Set vsoCOMAddIns = Application.COMAddIns

    'List each COM add-in in the Immediate window.
    For Each vsoCOMAddIn In vsoCOMAddIns
        Debug.Print vsoCOMAddIn.Description
    Next

End Sub


InvisibleApp.CommandBars Property (Visio)

 Copy code hover
[image]

InvisibleApp.CommandBars Property (Visio)
Send feedback

Published: July 16, 2012

Returns a reference to the CommandBars collection that represents the command bars in the container application. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .CommandBars

expression A variable that represents an InvisibleApp object.

Return Value

CommandBars

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Beginning with Microsoft Visio 2002, a program can manipulate menus and toolbars in the Visio user interface by manipulating the CommandBars collection returned by the CommandBars property. The CommandBars collection has an interface identical to the CommandBars collection exposed by the suite of Microsoft Office applications such as Microsoft Word and Microsoft Excel.

Alternatively, since Visio version 4.0, Visio has exposed application and document properties that return a UIObject object that provides similar functionality to CommandBars. Consequently, programs can use either the CommandBars collection or UIObject objects to manipulate the Visio menus and toolbars.

To get information about the object returned by the CommandBars property:

  1. On the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click Office.

  4. If you do not see the Office type library in the Project/Library list, on the Tools menu, click References, select the Microsoft Office 14.0 Object Library check box, and then click OK.

  5. Under Classes, examine the class named CommandBars.

Note Note

Each CommandBarControl object in a CommandBars collection has an OnAction property, and each CommandBar object in a CommandBars collection has a Context property. The values of these properties are determined by the container application. In Microsoft Visio:

  • The OnAction property is a String value that is interpreted either as a COM add-in, as a Microsoft Visual Basic for Applications (VBA) macro, as VBA code, or as a Visio add-on name.

  • The Context property determines in which menu context a command bar appears. The menu context number is a String value (for example visUIObjSetDrawing or "2"), which is followed by an asterisk if the command bar is visible by default (for example, visUIObjSetShapeSheet & "*" or "4*"). Valid menu contexts are visUIObjSetDrawing (2), visUIObjSetStencil (3), visUIObjSetShapeSheet (4), visUIObjSetIcon(5), or visUIObjSetPrintPreview (7). Attempting to set the Context property to any other value will fail.

For more information about using the OnAction and Context properties in Visio, see Developing Microsoft Visio Solutions on MSDN, the Microsoft Developer Network.

Example

This macro shows how to use the CommandBars property to list the command bars.

VBA Copy code Copy code

Public Sub CommandBars_Example()

 Dim vsoCommandBars As CommandBars
 Dim vsoCommandBar As CommandBar

 'Get the set of CommandBars
 'for the application.
 Set vsoCommandBars = Application.CommandBars

 'List each CommandBar in the Immediate window.
 For Each vsoCommandBar In vsoCommandBars
 Debug.Print vsoCommandBar.Name
 Next

End Sub


InvisibleApp.CommandLine Property (Visio)

 Copy code hover
[image]

InvisibleApp.CommandLine Property (Visio)
Send feedback

Published: July 16, 2012

Determines how Microsoft Visio was started. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .CommandLine

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

When you double-click a drawing, template, or stencil icon to start the application, the name of the file appears in the string returned by the CommandLine property. When you use a CreateObject call to start the application, "/Automation" appears in the string. When you double-click a Visio embedded object in an OLE container application, "/Embedding" appears in the string.

The following table includes other command line switches you can use to start the application.

Command line switch | Description
/nonew | The New tab is not shown on startup.
/nologo | The startup screen is not shown on startup.
/p filename | The Print dialog box is shown, so that you can quickly print a file.
filename | Opens a Visio file. Either the file has to be in the Drawings file path in the File Locations dialog box (click the File tab, click Options, click Advanced, and then, under General, click File Locations), or you must name an absolute path.
/1, /2, /3,.../9 | Opens one of the last-opened files.
/noreg | Prevents Visio from registering itself.
/u | Unregisters Visio.
/r | Registers Visio.
/s | Silently registers Visio.
/pt filename,[printername, drivername, portname] | Directs the file to print on a particular printer. (Added in Visio version 5.0c.)
::ODMA | Visio uses ODMA to open a file.


InvisibleApp.ConnectorToolDataObject Property (Visio)

 Copy code hover
[image]

InvisibleApp.ConnectorToolDataObject Property (Visio)
Send feedback

Published: July 16, 2012

Returns an IDataObject interface representing the active Connector tool used in the Microsoft Visio user interface. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ConnectorToolDataObject

expression A variable that represents an InvisibleApp object.

Return Value

IDataObject

Remarks

By default, ConnectorToolDataObject returns the built-in Visio Connector tool. If a master from a stencil is the active connector, ConnectorToolDataObject returns a data object for that master. If Visio fails to retrieve the internal IDataObject, it raises an exception.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ConnectorToolDataObject property to connect two shapes. It drops two masters on the page and connects them with a Dynamic Connector shape, using dynamic glue. Before running this macro, open the Basic Shapes stencil, if it is not already open.

VBA Copy code Copy code
Public Sub ConnectorToolDataObject_Example()

 Dim vsoSquareShape As Visio.Shape
 Dim vsoCircleShape As Visio.Shape
 Dim vsoConnectorShape As Visio.Shape

 Dim vsoCell1 As Visio.Cell
 Dim vsoCell2 As Visio.Cell
 Dim vsoCell3 As Visio.Cell
 Dim vsoCell4 As Visio.Cell

 Set vsoSquareShape = ActiveWindow.Page.Drop(Documents("BASIC_U.VSS").Masters.ItemU("Square"), 4, 9)
 Set vsoCircleShape = ActiveWindow.Page.Drop(Documents("BASIC_U.VSS").Masters.ItemU("Circle"), 4#, 6)
 Set vsoConnectorShape = Application.ActiveWindow.Page.Drop(Application.ConnectorToolDataObject, 2, 2)

 Set vsoCell1 = ActivePage.Shapes(3).Cells("BeginX")
 Set vsoCell2 = ActivePage.Shapes(1).CellsSRC(7, 0, 0)
 vsoCell1.GlueTo vsoCell2

 Set vsoCell3 = ActivePage.Shapes(3).Cells("EndX")
 Set vsoCell4 = ActivePage.Shapes(2).CellsSRC(7, 1, 0)
 vsoCell3.GlueTo vsoCell4

End Sub


InvisibleApp.CurrentEdition Property (Visio)

 Copy code hover
[image]

InvisibleApp.CurrentEdition Property (Visio)
Send feedback

Published: July 16, 2012

Returns an enumerated value that represents the edition of the current instance of Microsoft Visio. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .CurrentEdition

expression An expression that returns an InvisibleApp object.

Return Value

VisEdition

Remarks

The CurrentEdition property returns a constant from the VisEdition enumeration.


InvisibleApp.CurrentScope Property (Visio)

 Copy code hover
[image]

InvisibleApp.CurrentScope Property (Visio)
Send feedback

Published: July 16, 2012

Determines the ID of the scope that causes an event to fire. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .CurrentScope

expression A variable that represents an InvisibleApp object.

Return Value

Long

Remarks

Returns visScopeIDInvalid (-1) if a scope isn't open. The scope ID could be an internal Microsoft Visio scope ID that corresponds to a Visio command or an external scope ID passed to an Automation client by the BeginUndoScope method.

The recipients of an event consider a scope open if the EnterScope event has fired but the ExitScope event has not fired.

To determine if the event queue firing is related to a particular scope internal to the application or one opened and closed by an Automation client, use the IsInScope property.

Example

This example shows how to use the CurrentScope property to determine the ID of the current scope.

VBA Copy code Copy code
Private WithEvents vsoApplication As Visio.Application
Private lngScopeID As Long

Public Sub ScopeActions()

 Dim vsoShape As Visio.Shape

 'Set the module level application variable to
 'trap Application level events.
 Set vsoApplication = Application

 'Begin a scope, set the module level variable.
 lngScopeID = Application.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell (which would trigger a cell changed event).
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 Application.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering current scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal strDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting current scope " & nScopeID
 Else
 Debug.Print "ExitScope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


InvisibleApp.CustomMenus Property (Visio)

 Copy code hover
[image]

InvisibleApp.CustomMenus Property (Visio)
Send feedback

Published: July 16, 2012

Gets a UIObject object that represents the current custom menus and accelerators of an InvisibleApp object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomMenus

expression A variable that represents an InvisibleApp object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If Microsoft Visio menus and accelerators have not been customized, either programmatically, by a Visio solution, or in the user interface, the CustomMenus property returns Nothing.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the currently active user interface (UI) for your document without replacing the application-level custom UI. You must write additional code to add your custom UI items.

VBA Copy code Copy code

Sub CustomMenus_Example()

 Dim vsoUIObject As Visio.UIObject

 'Check whether there are custom menus bound to the document.
 If ThisDocument.CustomMenus Is Nothing Then

 'If not, check whether there are custom menus bound to the application.
 If Visio.Application.CustomMenus Is Nothing Then

 'If not, use the Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus
 MsgBox "Using Built-In Menus", 0

 Else

 'If there are existing Visio application-level custom menus, use them.
 Set vsoUIObject = Visio.Application.CustomMenus
 MsgBox "Using Custom Menus", 0

 End If

 Else

 'Use the existing custom menus.
 Set vsoUIObject = ThisDocument.CustomMenus
 MsgBox "Using Custom Menus", 0

 End If

End Sub


InvisibleApp.CustomMenusFile Property (Visio)

 Copy code hover
[image]

InvisibleApp.CustomMenusFile Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of the file that defines custom menus and accelerators for an InvisibleApp object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomMenusFile

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the object is not using custom menus, the CustomMenusFile property returns Nothing.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the currently active UI for your document without replacing the application-level custom UI. It also saves any existing custom menus to a file and specifies that the current document use those menus. You must write additional code to add your custom UI items.

Note Note

This macro uses the VBA keyword Kill to delete a file on disk. Use this keyword carefully, because you cannot undo a Kill command once it has been run, and you will not get a prior warning message.

VBA Copy code Copy code

Sub CustomMenusFile_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim strPath As String

 'Check whether there are custom menus bound to the document.
 If ThisDocument.CustomMenus Is Nothing Then

 'If not, check whether there are custom menus bound to the application.
 If Visio.Application.CustomMenus Is Nothing Then

 'If not, use the Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus
 MsgBox "Using Built-In Menus", 0

 Else

 'If there are existing Visio custom menus, use them.
 Set vsoUIObject = Visio.Application.CustomMenus

 'Save these custom menus to a file.
 strPath = Visio.Application.Path & "\CustomUI.vsu"
 vsoUIObject.SaveToFile (strPath)

 'Set the document to use the existing custom UI.
 ThisDocument.CustomMenusFile = strPath

 'Get this document's UIObject object.
 Set vsoUIObject = ThisDocument.CustomMenus

 'Delete the newly created temp file.
 Kill Visio.Application.Path & "\CustomUI.vsu"
 ThisDocument.ClearCustomMenus
 MsgBox "Using Custom Menus", 0

 End If

 Else

 'Use the existing custom menus.
 Set vsoUIObject = ThisDocument.CustomMenus

 End If

End Sub


InvisibleApp.CustomToolbars Property (Visio)

 Copy code hover
[image]

InvisibleApp.CustomToolbars Property (Visio)
Send feedback

Published: July 16, 2012

Gets a UIObject object that represents the current custom toolbars and status bars of an InvisibleApp object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomToolbars

expression A variable that represents an InvisibleApp object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If Microsoft Visio toolbars and status bars have not been customized, either programmatically, by a Visio solution, or in the user interface, the CustomToolbars property returns Nothing.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the currently active user interface (UI) for your document without replacing the application-level custom UI. You must write additional code to add your custom UI items.

VBA Copy code Copy code
Sub CustomToolbars_Example()

 Dim vsoUIObject As Visio.UIObject

 'Check whether there are custom toolbars bound to the document.
 If ThisDocument.CustomToolbars Is Nothing Then

 'If not, check whether there are custom toolbars bound to the application.
 If Visio.Application.CustomToolbars Is Nothing Then

 'If not, use the Visio built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)
 MsgBox "Using Built-In Toolbars", 0

 Else

 'If there are existing Visio application-level custom toolbars, use them.
 Set vsoUIObject = Visio.Application.CustomToolbars
 MsgBox "Using Custom Toolbars", 0

 End If

 Else

 'Use the existing custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars
 MsgBox "Using Custom Toolbars", 0

 End If

End Sub


InvisibleApp.CustomToolbarsFile Property (Visio)

 Copy code hover
[image]

InvisibleApp.CustomToolbarsFile Property (Visio)
Send feedback

Published: July 16, 2012

Returns or sets the name of the file that defines custom toolbars and status bars for an InvisibleApp object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CustomToolbarsFile

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the object is not using custom toolbars, the CustomToolbarsFile property returns Nothing.


InvisibleApp.DataFeaturesEnabled Property (Visio)

 Copy code hover
[image]

InvisibleApp.DataFeaturesEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Gets whether the data features in Microsoft Visio are enabled for the current instance of Visio. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .DataFeaturesEnabled

expression An expression that returns a InvisibleApp object.

Return Value

Boolean

Remarks

Whether the data features are enabled depends on the licensing of the installed version of Visio.


InvisibleApp.DefaultAngleUnits Property (Visio)

 Copy code hover
[image]

InvisibleApp.DefaultAngleUnits Property (Visio)
Send feedback

Published: July 16, 2012

Determines the default unit of measure for quantities that represent angles. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .DefaultAngleUnits

expression A variable that represents an InvisibleApp object.

Return Value

Variant

Remarks

The DefaultAngleUnits property corresponds to the value shown in the Angle box under Display on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).

The return value contains one of the values of VisUnitCodes, which are declared in the Microsoft Visio type library.

You can specify the value of the DefaultAngleUnits property as an integer (a member of VisUnitCodes) or a string value such as "degrees". If the string is invalid or the unit code is inappropriate (non-angular), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Cell formulas that contain a specific unit of measure are displayed in those units regardless of the default angle units setting. Many cell formulas, however, use implicit unit syntax and are displayed in default units.

A program can create a cell whose formula is displayed in default units by setting the cell's Formula property to a string in implicit unit syntax. For example, if the formula for the angle of a shape is "=90[deg,A]" , the result is displayed as "90 deg." if the DefaultAngleUnits property is visDegrees, and "1.5708 rad." if the DefaultAngleUnits property is visRadians.

Alternatively, a program can use the following statement to set the cell's result to default angle units:

VBA Copy code Copy code
vsoCell.Result(visAngleUnits) = 90

In this case, the result is 90 degrees if the DefaultAngleUnits property is visDegrees, and 90 radians if the DefaultAngleUnits property is visRadians.

For details about implicit units of measure, see About Units of Measure.


InvisibleApp.DefaultDurationUnits Property (Visio)

 Copy code hover
[image]

InvisibleApp.DefaultDurationUnits Property (Visio)
Send feedback

Published: July 16, 2012

Determines the default unit of measure for quantities that represent durations. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .DefaultDurationUnits

expression A variable that represents an InvisibleApp object.

Return Value

Variant

Remarks

The DefaultDurationUnits property corresponds to the value shown in the Duration box under Display on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).

The return value contains one of the values of VisUnitCodes, which are declared in the Microsoft Visio type library.

You can specify DefaultDurationUnits as an integer (a member of VisUnitCodes) or a string value such as "minutes". If the string is invalid or the unit code is inappropriate (non-duration), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Cell formulas that contain a specific unit of measure are displayed in those units regardless of the default duration units setting. Many cell formulas, however, use implicit unit syntax and are displayed in default units.

A program can create a cell whose formula displays in default units by setting the cell's Formula property to a string in implicit unit syntax. For example, if a formula specifying duration is "=10[em,E]" , the result displays as "0.0069 ed" if the DefaultDurationUnits property is visElapsedDay, and "600.0000 es" if the DefaultDurationUnits property is visElapsedSec.

Alternatively, a program can use the following statement to set the cell's result to default duration units:

VBA Copy code Copy code
vsoCell.Result(visDurationUnits) = 60

In this case, the result is 60 minutes if the DefaultDurationUnits property is visElapsedMin and 60 seconds if the DefaultDurationUnits property is visElapsedSec.

For details about implicit units of measure, see About Units of Measure.


InvisibleApp.DefaultRectangleDataObject Property (Visio)

 Copy code hover
[image]

InvisibleApp.DefaultRectangleDataObject Property (Visio)
Send feedback

Published: July 16, 2012

Returns an IDataObject interface that represents the Rectangle tool used in the Microsoft Visio user interface. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .DefaultRectangleDataObject

expression An expression that returns a InvisibleApp object.

Return Value

IDataObject

Remarks

By using the DefaultRectangleDataObject property to get an IDataObject interface, you can create a new rectangle shape linked to data—a result similar to that you would get by dragging a data recordset row onto the page. This property is useful in situations where no master is selected in a docked stencil.


InvisibleApp.DefaultTextUnits Property (Visio)

 Copy code hover
[image]

InvisibleApp.DefaultTextUnits Property (Visio)
Send feedback

Published: July 16, 2012

Determines the default unit of measure for quantities that represent text metrics. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .DefaultTextUnits

expression A variable that represents an InvisibleApp object.

Return Value

Variant

Remarks

The DefaultTextUnits property corresponds to the value shown in the Text box under Display on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).

The return value contains one of the values of VisUnitCodes, which are declared in the Microsoft Visio type library.

You can specify the value of DefaultTextUnits as an integer (a member of VisUnitCodes) or a string value such as "pt". If the string is invalid or the unit code is inappropriate (non-textual), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.

Cell formulas that contain a specific unit of measure are displayed in those units regardless of the default text units setting. Many cell formulas, however, use implicit unit syntax and are displayed in default units.

A program can create a cell whose formula is displayed in default units by setting the cell's Formula property to a string in implicit unit syntax. For example, the formula "=8[pt,T]" is displayed as "8 pt" if the DefaultTextUnits property is visPoints and "0.6272" if the DefaultTextUnits property is visCiceros.

Alternatively, a program can use the following statement to set the cell's result to default text units:

VBA Copy code Copy code
vsoCell.Result(visTextUnits) = 12

In this case, the text is 12 points if the DefaultTextUnits property is visPoints and 12 ciceros if the DefaultTextUnits property is visCiceros.

For details about implicit units of measure, see About Units of Measure.


InvisibleApp.DefaultZoomBehavior Property (Visio)

 Copy code hover
[image]

InvisibleApp.DefaultZoomBehavior Property (Visio)
Send feedback

Published: July 16, 2012

Determines the zoom behavior for all new Microsoft Visio documents and drawing windows. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .DefaultZoomBehavior

expression A variable that represents an InvisibleApp object.

Return Value

VisZoomBehavior

Remarks

To set zoom behavior for an existing document, or for a particular window, use the ZoomBehavior property of the document and window, respectively.

The following constants declared by the Visio type library in VisZoomBehavior are valid values for the DefaultZoomBehavior property.

Constant | Value | Description
visZoomNone | 0 | Undefined zoom behavior; use the zoom behavior of the document or application
visZoomInPlaceContainer | 1 | The container performs the zoom. This is the default.
visZoomVisio | 2 | Visio performs the zoom.
visZoomVisioExact | 4 | Visio zooms when open in place; Visio does not adjust the zoom level

Note Note

The default behavior (visZoomInPlaceContainer) is different from the behavior used in Microsoft Visio 2002, but is the same as that in earlier versions of Visio. To replicate the behavior seen in Microsoft Visio 2002, set this value to visZoomVisio.

If this value is set to the default, visZoomInPlaceContainer, Visio uses the container's IOleCommandTarget interface to perform the zoom and forces a fit-to-window zoom within the in-place window. If the container does not support IOleCommandTarget, no zooming occurs.


InvisibleApp.DeferRecalc Property (Visio)

 Copy code hover
[image]

InvisibleApp.DeferRecalc Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the application recalculates cell formulas during a series of actions. Read/write.

Version Information

Version Added: Visio 4.1

Syntax

expression .DeferRecalc

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

Use the DeferRecalc property to improve performance during a series of actions. For example, you can defer formula recalculation while changing the formulas or values of several cells. When the series of actions is complete, you must always set the DeferRecalc property back to the value it had before you changed it. See the following examples.

If you release objects or send a large number of commands to Visio while recalculation is deferred, Visio may at times need to process its queue of pending recalculations. Because of this, use care in setting formulas inside a scope where you want recalculation deferred. Ideally, you should only set formulas when recalculation is turned off.

For example, consider the following Microsoft Visual Basic for Applications (VBA) sequence:

VBA Copy code Copy code
Dim blsDeferCalcOriginalValue As Boolean
blsDeferCalcOriginalValue = Application.DeferRecalc
Application.DeferRecalc = True
vsoShape.Cells("height").ResultIU = 12
vsoShape.Cells("width").ResultIU = 14
Application.DeferRecalc = blsDeferCalcOriginalValue

Because VBA makes and releases a temporary Cell object in the preceding code, Visio will process its queue at that point.

In the following sequence, Visio will not process the recalculation queue until the application turns recalculation on again (or the user performs some operation).

VBA Copy code Copy code
Dim blsDeferCalcOriginalValue As Boolean
blsDeferCalcOriginalValue = Application.DeferRecalc
Application.DeferRecalc = True
Set vsoCell1 = vsoShape.Cells("Height")
Set vsoCell2 = vsoShape.Cells("Width")
vsoCell1.ResultIU = 12
vsoCell2.ResultIU = 14
Application.DeferRecalc = blsDeferCalcOriginalValue


InvisibleApp.DeferRelationshipRecalc Property (Visio)

 Copy code hover
[image]

InvisibleApp.DeferRelationshipRecalc Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio defers recalculating shape sizes and relationships when a member of a relationship pair is moved or resized. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .DeferRelationshipRecalc

expression A variable that represents an InvisibleApp object.

Return Value

Boolean

Remarks

For example, if you resize a shape that is a member of a container in a structured diagram, Visio will not adjust the size of the container if DeferRelationshipRecalc is True. When you set DeferRelationshipRecalc to False, Visio recalculates the container size and adjusts it accordingly. (In each case, the container's ResizeAsNeeded property must be set to visContainerAutoResizeExpandContract.)

Setting DeferRelationshipRecalc to False causes Visio to immediately process all deferred actions.


InvisibleApp.DialogFont Property (Visio)

 Copy code hover
[image]

InvisibleApp.DialogFont Property (Visio)
Send feedback

Published: July 16, 2012

Returns information about the fonts that Microsoft Visio uses in its dialog boxes. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .DialogFont

expression A variable that represents an InvisibleApp object.

Return Value

IFontDisp

Remarks

You can use this property to display your dialog boxes in the same font as the Visio dialog boxes.

COM (Component Object Model) provides a standard implementation of a font object with the IFontDisp interface on top of the underlying system font support. The IFontDisp interface exposes a font object's properties and is implemented in the stdole type library as a StdFont object that can be created within Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic projects in Visio.

To get information about the StdFont object that supports the IFontDisp interface

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click stdole.

  4. Under Classes, examine the class named StdFont.

For details about the IFontDisp interface, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.

Example

The following sample code shows how to get a reference to a StdFont object that conveys information about the application fonts, and how to print that information to the Immediate window.

VBA Copy code Copy code

Sub DialogFont_Example()

Dim objStdFont As StdFont
Set objStdFont = Application.DialogFont

 With objStdFont

 Debug.Print .Bold
 Debug.Print .CharSet
 Debug.Print .Italic
 Debug.Print .Name
 Debug.Print .Size
 Debug.Print .Strikethrough
 Debug.Print .Underline
 Debug.Print .Weight

 End With

End Sub


InvisibleApp.Documents Property (Visio)

 Copy code hover
[image]

InvisibleApp.Documents Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Documents collection for a Microsoft Visio instance. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Documents

expression A variable that represents an InvisibleApp object.

Return Value

Documents

Remarks

You can iterate through a Documents collection by using the Count property to retrieve the number of documents in the collection. You can use the Item property to retrieve individual elements from a collection.


InvisibleApp.DrawingPaths Property (Visio)

 Copy code hover
[image]

InvisibleApp.DrawingPaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for drawings. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .DrawingPaths

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

The DrawingPaths property is set to an empty string ("") by default.

The string passed to and received from the DrawingPaths property is the same string shown in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\DrawingsPath subkey.

Visio looks for drawings in all paths named in the DrawingPaths property and all the subfolders of those paths. If you pass the DrawingPaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Setting the DrawingPaths property replaces existing values for DrawingPaths in the File Locations dialog box. To retain existing values, get the existing string and then append the new file path to that string, as shown in the following code:

VBA Copy code Copy code
Application.DrawingPaths = Application.DrawingPaths & ";" & "newpath".
Note Note

Modifying the registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).


InvisibleApp.EventInfo Property (Visio)

 Copy code hover
[image]

InvisibleApp.EventInfo Property (Visio)
Send feedback

Published: July 16, 2012

Gets additional information associated with an event, if any exists. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventInfo(eventSeqNum)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
eventSeqNum | Required | Long | visEvtIDMostRecent (0) for information about the most recently fired event, or the sequence number of the event to examine.

Return Value

String

Remarks

When Microsoft Visio fires an event, there are a small number of events for which additional information is available. These events are BeforeDocumentSaveAs, DocumentSavedAs, EnterScope, ExitScope, MarkerEvent, ShapesDeleted, and ShapeChanged. Use the application's EventInfo property to obtain this information, when available.

The EventInfo property returns the following:

  • A string whose contents are specific to the event in question, if the event does record extra information.

  • An empty string if an event does not record extra information.

  • An error if Microsoft Visio no longer has information for the specified event.

For details about the contents of the EventInfo property for an event, see the specific event topic.

If an event target queries the EventInfo property immediately after being triggered, the most recent event and the event whose sequence number was passed to the target are the same. However, if the target is an add-on implemented by an executable (.exe) file, this may not be the case, because the executable file and Visio are separate tasks that aren't modal with respect to each other.

Note Note

Event handlers that use the Microsoft Visual Basic for Applications (VBA) WithEvents keyword have access to only the most recent event and must use visEvtIDMostRecent.

To ensure that the information returned by the EventInfo property is associated with the same event that triggered the add-on, the executable file can pass <sequence number> as an argument to the EventInfo property. You can obtain the sequence number of an event in the following ways:

  • If the Action property of the Event object returns visActCodeRunAddon, the command line string passed to the add-on contains a substring of the form "/eventid=<sequence number>".

    Note Note

    Even though the substring is labeled "/eventid," don't confuse the <sequence number> passed in the command line string with the ID property of the firing Event object, which identifies the Event object in its EventList collection. The number being passed is actually the firing sequence number.

  • If the Action property of the Event object returns visActCodeAdvise, the sequence number is passed as an argument to the VisEventProc procedure implemented by the target object.


InvisibleApp.EventList Property (Visio)

 Copy code hover
[image]

InvisibleApp.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents an InvisibleApp object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


InvisibleApp.EventsEnabled Property (Visio)

 Copy code hover
[image]

InvisibleApp.EventsEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a Microsoft Visio instance fires events. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .EventsEnabled

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

If the EventsEnabled property is False, Visio does not fire events, run add-ons, or execute strings that contain arbitrary Visual Basic for Applications (VBA) code when evaluating RUNADDON operands in cell formulas.

By default, the EventsEnabled property is True when an instance of Visio starts.

You may want to disable event firing if you have written code to handle events such as DocumentOpened or DocumentCreated that does not work properly, or to prevent the incorporation of a virus into a document. Events will not fire until the EventsEnabled property is set to True.

Example

These VBA macros show how to use the EventsEnabled property to suspend and resume event processing.

VBA Copy code Copy code

Public Sub SuspendEventProcessing_Example()

 'Suspend event processing.
 Application.EventsEnabled = False
 End Sub

Public Sub EventsEnabled_Example()

 'Resume event processing.
 Application.EventsEnabled = True

End Sub


InvisibleApp.FullBuild Property (Visio)

 Copy code hover
[image]

InvisibleApp.FullBuild Property (Visio)
Send feedback

Published: July 16, 2012

Returns the full build number of the running instance. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .FullBuild

expression A variable that represents an InvisibleApp object.

Return Value

Long

Remarks

The format of the build number is described in the following table.

Bits | Description
0 - 15 | Internal build number
16 - 20 | Internal revision number
21 - 25 | Minor version number
26 - 30 | Major version number (Microsoft Visio 2013 = 15)
31 | Reserved

In addition, for Visio 2013, to obtain the correct full build number, it is necessary to add 1000 to the internal revision number part of the full build number returned by the FullBuild property, as shown in the following macro.

The build number of the running instance is written to the FullBuildNumberCreated property when a new document is created, and to the FullBuildNumberEdited property when a document is edited.

Example

The following Microsoft Visual Basic procedures show how to use the FullBuild property to get the full build number of the current instance of Visio. Once the full build number has been obtained, the ParseFullBuildProperty procedure parses the number and prints the results in the Immediate window.

VBA Copy code Copy code
Public Sub FullBuild_Example()

 Dim lngFullBuild as Long
 lngFullBuild = Application.FullBuild
 ParseFullBuildProperty (lngFullBuild)

End Sub
VBA Copy code Copy code
Public Sub ParseFullBuildProperty(ByRef lngFullBuild As Long)

 Dim lngMajor As Long
 Dim lngMinor As Long
 Dim lngRevision As Long
 Dim lngBuild As Long
 Dim lngNumber As Long

 lngNumber = lngFullBuild

 ' Low 16 bits:
 lngBuild = lngNumber Mod 65536
 lngNumber = lngNumber / 65536

 'Next 5 bits:
 lngRevision = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Next 5 bits:
 lngMinor = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Next 5 bits:
 lngMajor = lngNumber Mod 32
 lngNumber = lngNumber / 32

 'Remaining 1 bit unused and 0 as of Visio 2010
 Debug.Print "lngFullBuild (full version specification): " & lngMajor & "." _
 & lngMinor & "." & lngBuild & "." & lngRevision + 1000
 Debug.Assert(0 = lngNumber)

End Sub


InvisibleApp.HelpPaths Property (Visio)

 Copy code hover
[image]

InvisibleApp.HelpPaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for Help files. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .HelpPaths

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

The HelpPaths property is set to an empty string ("") by default.

The string passed to and received from the HelpPaths property is the same string shown in the File Paths dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\HelpPath subkey.

When the application looks for Help files, it looks in all paths named in the HelpPaths property and all the subfolders of those paths. If you pass the HelpPaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Setting the HelpPaths property replaces existing values for HelpPaths in the File Paths dialog box. To retain existing values, get the existing string and then append the new file path to that string, as shown in the following code:

VBA Copy code Copy code
Application.HelpPaths = Application.HelpPaths & ";" & "newpath".
Note Note

Modifying the registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get and set the HelpPaths property of the Application object. Before running this macro, replace fullpath(s) with the path or paths to the location or locations where you want Visio to look for Help files.

VBA Copy code Copy code

Public Sub GetHelpPaths_Example()

    Dim strCurrentPath As String

    'Retrieve the current path to Visio Help files.
    strCurrentPath = Application.HelpPaths
    MsgBox ("The current path for Microsoft Visio Help files is " + strCurrentPath)

End Sub

Public Sub SetHelpPaths_Example()

    Dim strNewPath As String

    'Store the new path.
    strNewPath = "fullpath(s)"

    'Set the new path in the Application object.
    Application.HelpPaths = strNewPath

End Sub


InvisibleApp.InhibitSelectChange Property (Visio)

 Copy code hover
[image]

InvisibleApp.InhibitSelectChange Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether shapes added to the drawing page by Automation are selected. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .InhibitSelectChange

expression A variable that represents an InvisibleApp object.

Return Value

Boolean

Remarks

Use the InhibitSelectChange property to control shape selection and increase performance when dropping a series of shapes in the drawing window programmatically. When the InhibitSelectChange property is True, Microsoft Visio does not select any shapes after they are dropped. Your solution, however, can select shapes.

Additionally, Visio attempts to preserve currently selected shapes whenever possible, unless shapes are deselected by the solution.

If a program neglects to turn the InhibitSelectChange property off (False) after turning it on, the Visio instance will turn it back off when the user performs an operation.


InvisibleApp.InstanceHandle32 Property (Visio)

 Copy code hover
[image]

InvisibleApp.InstanceHandle32 Property (Visio)
Send feedback

Published: July 16, 2012

Gets the instance handle of the Application object for a 32-bit version of Microsoft Visio. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .InstanceHandle32

expression A variable that represents an InvisibleApp object.

Return Value

Long

Remarks

Calls to the InstanceHandle property are directed to the InstanceHandle32 property.


InvisibleApp.InstanceHandle64 Property (Visio)

 Copy code hover
[image]

InvisibleApp.InstanceHandle64 Property (Visio)
Send feedback

Published: July 16, 2012

Gets the instance handle of the InvisibleApp object for a 64-bit version of Microsoft Visio. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .InstanceHandle64

expression An expression that returns an InvisibleApp object.

Return Value

Int64


InvisibleApp.IsInScope Property (Visio)

 Copy code hover
[image]

InvisibleApp.IsInScope Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a call to an event handler is between an EnterScope event and an ExitScope event for a scope. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .IsInScope(nCmdID)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
nCmdID | Required | Long | The scope ID.

Return Value

Boolean

Remarks

Constants representing scope IDs are prefixed with visCmd and are declared by the Visio type library. You can also use an ID returned by the BeginUndoScope method.

You could use this property in a CellChanged event handler to determine whether a cell change was the result of a particular operation.

Example

This example shows how to use the IsInScope property to determine whether a call to a procedure that handles the CellChanged event is in a particular scope—that is, whether the call occurs between the EnterScope and ExitScope events for that scope.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application
Private lngScopeID As Long

Public Sub IsInScope_Example()

 Dim vsoShape As Visio.Shape

 'Set the module-level application variable to
 'trap application-level events.
 Set vsoApplication = Application

 'Begin a scope.
 lngScopeID = Application.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell (to trigger the CellChanged event).
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 Application.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering my scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting my scope " & nScopeID
 Else
 Debug.Print "ExitScope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


InvisibleApp.IsUndoingOrRedoing Property (Visio)

 Copy code hover
[image]

InvisibleApp.IsUndoingOrRedoing Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the current event handler is being called as a result of an Undo or Redo action in the application. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .IsUndoingOrRedoing

expression A variable that represents an InvisibleApp object.

Return Value

Boolean

Remarks

The IsUndoingOrRedoing property returns True when the application is firing events related to an Undo or Redo action that the user has initiated in the user interface, or that an Automation client has initiated by calling the Undo or Redo method of an Application object.

When the application calls an event handler, the event has a "cause." If that cause is a user action or another event handler, it is legitimate to perform undoable actions during the course of handling that event. However, if the cause of the event firing is an Undo or Redo action, the event handler should not perform undoable actions. Doing so eliminates the ability to redo an action.

You will typically only perform undoable actions inside an event handler when this property is False. You can perform undoable actions when the flag is True, but the redo queue is destroyed.

Example

This example adds a shape to a drawing and then checks whether the shape has been added as a result of an Undo or Redo action.

VBA Copy code Copy code

Public Sub IsUndoingOrRedoing_Example()

Dim vsoShape As Visio.Shape

 'Draw a shape to trigger the ShapeAdded event
 Set vsoShape = ActivePage.DrawRectangle(1,2,2,1)

End Sub
VBA Copy code Copy code

Sub Document_ShapeAdded(ByVal Shape As IVShape)

 If Not Application.IsUndoingOrRedoing Then

 Debug.Print "Shape was added by new action."

 End If

End Sub


InvisibleApp.IsVisio32 Property (Visio)

 Copy code hover
[image]

InvisibleApp.IsVisio32 Property (Visio)
Send feedback

Published: July 16, 2012

Returns True if the current instance of Microsoft Visio is 32-bit. Returns False if the current instance is 64-bit. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .IsVisio32

expression An expression that returns a InvisibleApp object.

Return Value

Integer


InvisibleApp.Language Property (Visio)

 Copy code hover
[image]

InvisibleApp.Language Property (Visio)
Send feedback

Published: July 16, 2012

Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .Language(lpi4Ret)

expression A variable that represents an InvisibleApp object.

Return Value

Long

Remarks

The Language property returns the language ID recorded in the object's VERSIONINFO resource. The IDs returned are the standard IDs used by Microsoft Windows to encode different language versions. For example, the Language property returns &H0409 for the U.S. English version of Visio. For details, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


InvisibleApp.LanguageHelp Property (Visio)

 Copy code hover
[image]

InvisibleApp.LanguageHelp Property (Visio)
Send feedback

Published: July 16, 2012

Represents the language ID of the Help in the version of the Microsoft Visio instance represented by the parent object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .LanguageHelp(lpi4Ret)

expression A variable that represents an InvisibleApp object.

Return Value

Long

Remarks

The LanguageHelp property returns the language ID of the Help recorded in the object's VERSIONINFO resource. The IDs returned are the standard IDs used by Microsoft Windows to encode different language versions. For example, the LanguageHelp property returns &H0409 for the U.S. English version of Visio. For details, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN.


InvisibleApp.LanguageSettings Property (Visio)

 Copy code hover
[image]

InvisibleApp.LanguageSettings Property (Visio)
Send feedback

Published: July 16, 2012

Returns a reference to the Microsoft Office (MSO) LanguageSettings interface. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .LanguageSettings

expression A variable that represents an InvisibleApp object.

Return Value

Object

Remarks

After you use the LanguageSettings property to get a reference to the MSO LanguageSettings interface, you can use methods of that interface to get the locale identifier (LCID) for the language used when Office was installed, the user interface (UI) language, and the language for Help, as well as the current setting for the preferred language for editing in the UI.

However, you cannot use the LanguageSettings interface to change language settings: you can change language settings only in the Microsoft Office Language Settings 2007 dialog box. (Click Start, point to All Programs, point to Microsoft Office, point to Microsoft Office Tools, and then click Microsoft Office 2007 Language Settings.


InvisibleApp.LiveDynamics Property (Visio)

 Copy code hover
[image]

InvisibleApp.LiveDynamics Property (Visio)
Send feedback

Published: July 16, 2012

Controls whether Microsoft Visio recalculates shape properties during drag operations on every mouse move or only after the mouse button is released. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .LiveDynamics

expression A variable that represents an InvisibleApp object.

Return Value

Boolean

Remarks

The LiveDynamics property tracks actions, such as resizing and rotating shapes, and is effective when shapes are glued or related to each other. When the value of the LiveDynamics property is True, more events such as CellChanged occur. Solutions that respond to such events may operate more quickly if the LiveDynamics property is set to False.


InvisibleApp.MyShapesPath Property (Visio)

 Copy code hover
[image]

InvisibleApp.MyShapesPath Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets where Microsoft Visio looks for the My Shapes folder on the user's hard disk. Read/write.

Version Information

Version Added: Visio 2007

Syntax

expression .MyShapesPath

expression An expression that returns an InvisibleApp object.

Return Value

String

Remarks

The setting of the MyShapesPath property corresponds to the value of the My Shapes text box in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.)


InvisibleApp.Name Property (Visio)

 Copy code hover
[image]

InvisibleApp.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents an InvisibleApp object.

Return Value

String


InvisibleApp.ObjectType Property (Visio)

 Copy code hover
[image]

InvisibleApp.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


InvisibleApp.OnDataChangeDelay Property (Visio)

 Copy code hover
[image]

InvisibleApp.OnDataChangeDelay Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets how long the Microsoft Visio instance waits before advising a container application that a Visio document being shown by the container has changed and should be redisplayed. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .OnDataChangeDelay

expression An expression that returns a InvisibleApp object.

Return Value

Long

Remarks

The OnDataChangeDelay property affects only instances of Visio that are run from within an OLE container document.

  • Setting the value of the OnDataChangeDelay property to zero (0) causes Visio to send immediate advises to the container as data changes in open Visio documents.

  • Setting the value of the OnDataChangeDelay property to -1 causes Visio to use the interval specified in the OLEUpdateDelay entry in the registry. If the registry doesn't contain this setting, Visio defaults to using a value of 10,000 (milliseconds).

  • Setting the OnDataChangeDelay property to any value other than -1 or 0 overrides the registry setting and sets the delay between advises to the value of OnDataChangeDelay. If the OnDataChangeDelay property is not set or set to 1 and the OLEUpdateDelay setting is 0, Visio never sends advises to the container.

Note Note

If you experience decreased performance when you add or move shapes that are contained in a Visio drawing that is hosted in the Visio Drawing Control, you can install a hot fix and then use the OnDataChangeDelay property to overcome this problem. For more information, see the Microsoft Knowledge Base article 839079.


InvisibleApp.Path Property (Visio)

 Copy code hover
[image]

InvisibleApp.Path Property (Visio)
Send feedback

Published: July 16, 2012

Returns the drive and folder path of the Microsoft Visio application. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Path

expression A variable that represents an InvisibleApp object.

Return Value

String


InvisibleApp.PersistsEvents Property (Visio)

 Copy code hover
[image]

InvisibleApp.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


InvisibleApp.ProcessID Property (Visio)

 Copy code hover
[image]

InvisibleApp.ProcessID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the unique identity of the current Microsoft Visio process. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ProcessID

expression A variable that represents an InvisibleApp object.

Return Value

Long

Remarks

The ProcessID property returns a value unique to the indicated instance. The application doesn't reuse the value until 4294967296 (2^32) more threads have been created on the current workstation.

Important note Important

The value returned by ProcessID is not the same as the Windows Process ID of the current Visio instance.

Example

This Microsoft Visual Basic for Applications (VBA) program shows how to use the ProcessID property to determine the unique identity of the current Microsoft Visio process.

VBA Copy code Copy code
Sub ProcessID_Example ()

    Dim vsoApplication As Visio.Application

    'Get the current instance of Microsoft Office Visio.
    Set vsoApplication = Visio.Application

    'Prints the unique ID of the current Visio process.
    Debug.Print "Visio Process identifier: "; vsoApplication.ProcessID

End Sub


InvisibleApp.PromptForSummary Property (Visio)

 Copy code hover
[image]

InvisibleApp.PromptForSummary Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio prompts for document properties when it saves a document. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .PromptForSummary

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

This property corresponds to the Prompt for document properties on first save check box on the Save tab in the Visio Options dialog box (click the File tab and then click Options).

Example

This Microsoft Visual Basic for Applications (VBA) macro switches the PromptForSummary property of the Visio Application object.

VBA Copy code Copy code

Public Sub PromptForSummary_Example()

    Application.PromptForSummary = Not Application.PromptForSummary

End Sub


InvisibleApp.SaveAsWebObject Property (Visio)

 Copy code hover
[image]

InvisibleApp.SaveAsWebObject Property (Visio)
Send feedback

Published: July 16, 2012

Returns a reference to the IDispatch interface of a VisSaveAsWeb object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .SaveAsWebObject

expression A variable that represents an InvisibleApp object.

Return Value

Object

Remarks

Once you have a reference to the VisSaveAsWeb object, you can use the objects, methods, and properties of the Save as Web Page API to publish Microsoft Visio documents to the Web. For more information about the Save as Web Page API, search for "Save as Web Page API" on MSDN.

To be able to work with the Save as Web Page API, you must get a reference to the Microsoft Visio 14.0 Save As Web Type Library in your Microsoft Visual Basic or Microsoft Visual Basic for Applications (VBA) project. To get this reference in VBA, use the following procedure:

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the Tools menu, click References.

  3. In the Available References list, select Microsoft Visio 14.0 Save As Web Type Library and click OK.

Example

This VBA macro shows how to use the SaveAsWebObject property to get a VisSaveAsWeb object. It also shows how to get a VisWebPageSettings object, configure Web-page settings, and create a Web page to display the active Visio document. The macro gets a Visio Application object and passes it to the SaveAsWeb procedure, which gets the VisSaveAsWeb object, configures the settings, and creates the Web page.

Before running this macro, get a reference to the Microsoft Visio 14.0 Save As Web Type Library as described above, and replace path\filename in the code with the full path to and name of the .htm file you want to create on your computer to display the Web page.

VBA Copy code Copy code

Public Sub SaveAsWebObject_Example

 Dim vsoApplication as Visio.Application
 Call SaveAsWeb(vsoApplication)

End Sub

Public Sub SaveAsWeb (vsoApplication as Visio.Application)

 Dim objSaveAsWeb As IVisSaveAsWeb
 Dim objWebPageSettings As IVisWebPageSettings

 ' Get a VisSaveAsWeb object that
 ' represents a new Web page project
 Set objSaveAsWeb = Application.SaveAsWebObject

 ' Get a VisWebPageSettings object
 Set objWebPageSettings = objSaveAsWeb.WebPageSettings

 ' Configure Web-page settings
 objWebPageSettings.StartPage = 1
 objWebPageSettings.EndPage = 2
 objWebPageSettings.LongFileNames = True
 objWebPageSettings.TargetPath = "path\filename"

 ' Now create the pages; because we did not identify
 ' a particular document, the active document is saved
 objSaveAsWeb.CreatePages

End Sub


InvisibleApp.ScreenUpdating Property (Visio)

 Copy code hover
[image]

InvisibleApp.ScreenUpdating Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the screen is updated (redrawn) during a series of actions. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .ScreenUpdating

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

Use the ScreenUpdating property to increase performance during a series of actions. For example, you can turn off screen updating while a series of shapes are created so that the screen is not redrawn after each shape appears. Then you can turn screen updating on to update the screen.

If you send a large number of commands to a Microsoft Visio instance while screen updating is turned off, the Visio instance may redisplay the screen occasionally to flush its buffers.

If a program neglects to turn screen updating on after turning it off, the Visio instance turns screen updating back on when a user performs an operation.

Note Note

The ShowChanges and ScreenUpdating properties are similar in that they are both designed to increase performance during a series of actions, but they work differently. Setting the ShowChanges property also sets the ScreenUpdating property, but setting the ScreenUpdating property does not set the ShowChanges property. For a comparison of these two properties, see the ShowChanges property.

Example

This Microsoft Visual Basic code snippet shows how to use the ScreenUpdating property.

VBA Copy code Copy code
'Turn off screen updating to improve performance during
'the series of actions that follow.
 Visio.Application.ScreenUpdating = False

'Drop several shapes.
'Set the shapes' text.
'Connect the shapes.
'Format the connectors.

'Turn screen updating on again when the actions are complete.
Visio.Application.ScreenUpdating = True


InvisibleApp.Settings Property (Visio)

 Copy code hover
[image]

InvisibleApp.Settings Property (Visio)
Send feedback

Published: July 16, 2012

Returns an ApplicationSettings object, which you can use to set Microsoft Visio application properties. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Settings

expression A variable that represents an InvisibleApp object.

Return Value

ApplicationSettings

Remarks

Use the Settings property of the Application object to get an ApplicationSettings object that you can then use to set various application properties corresponding to those in the Options dialog box (click the File tab, and then click Options) and the Snap & Glue dialog box (on the View tab, click the Visual Aids arrow).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Settings property to get an ApplicationSettings object. It also shows how to use the RecentFilesListSize property to get the number of entries in the list of recently used files in Visio.

VBA Copy code Copy code
Public Sub Settings_Example()

    Dim vsoApplicationSettings As Visio.ApplicationSettings
    Dim lngListSize As Long

    Set vsoApplicationSettings = Visio.Application.Settings
    lngListSize = vsoApplicationSettings.RecentFilesListSize

    Debug.Print lngListSize

End Sub


InvisibleApp.ShowChanges Property (Visio)

 Copy code hover
[image]

InvisibleApp.ShowChanges Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the screen is updated (redrawn) during a series of actions. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .ShowChanges

expression A variable that represents an InvisibleApp object.

Return Value

Boolean

Remarks

Use the ShowChanges property to increase performance during a series of actions. For example, you can set the ShowChanges property to False while a series of shapes are created so that the screen is not redrawn after each shape appears. Then you can set it to True to update the screen.

If a program neglects to turn the ShowChanges property on after turning it off, the Microsoft Visio instance will turn it back on when the user performs an operation.

The ShowChanges property is similar to the ScreenUpdating property, which was implemented in Visio 3.0. In most cases using the ShowChanges property is preferable to using the ScreenUpdating property. Setting the ShowChanges property automatically sets the ScreenUpdating property; however, setting the ScreenUpdating property does not set the ShowChanges property.

  • When ShowChanges is False, the Visio instance will not refresh the screen (repaint drawing windows) as documents change or when they become obscured by other windows. All shapes in drawing and stencil windows are deselected and the Visio instance will not allow programs to change the selections of windows.

  • When only ScreenUpdating is False, the Visio instance will occasionally refresh the screen as documents change. ScreenUpdating does not cause deselects to occur or restrict selection changes.

The Visio instance will usually run faster when both the ShowChanges and ScreenUpdating properties are False than when only the ScreenUpdating property is False. When both the ShowChanges and ScreenUpdating properties are False, the Visio views will not react to document changes until the ShowChanges property becomes True. This can cause noticeable delays after a program has completed a sequence of many operations. To cause some changes to occur as they happen, set ScreenUpdating to True immediately after setting ShowChanges to False. This can shorten the delay that occurs after ShowChanges becomes True, but will probably lengthen the time to complete the overall sequence of actions.


InvisibleApp.ShowProgress Property (Visio)

 Copy code hover
[image]

InvisibleApp.ShowProgress Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a progress indicator is shown while performing certain operations. Read/write.

Version Information

Version Added: Visio 4.1

Syntax

expression .ShowProgress

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

If you want to perform an operation, such as printing, that typically displays a progress indicator but you don't want the progress indicator to appear, set the ShowProgress property to False (0). By default, the ShowProgress property is True (non-zero).

In most cases you should restore the setting to its prior value when you've completed the operation.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ShowProgress property of the Application object. It switches the display of the progress indicator on and off and displays the state of the property in the Immediate window.

VBA Copy code Copy code

Sub ShowProgress_Example()

 'Create a variable to hold the current state
 'of the progress indicator.
 Dim intProgress As Integer

 'Display the current state of the progress indicator.
 Debug.Print "Initial state: " & Application.ShowProgress

 'Get the state of the progress indicator.
 intProgress = Application.ShowProgress

 'Turn off the progress indicator.
 Application.ShowProgress = False

 'Display the status again.
 Debug.Print "Changed state: " & Application.ShowProgress

 'Now restore the progress indicator to its original state.
 Application.ShowProgress = intProgress

 'Display the status again.
 Debug.Print "Restored state: " & Application.ShowProgress

End Sub


InvisibleApp.ShowStatusBar Property (Visio)

 Copy code hover
[image]

InvisibleApp.ShowStatusBar Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the status bar is shown. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .ShowStatusBar

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

The ShowStatusBar property persists each time you run the application. The ShowToolbar property is valid for a Microsoft Visio instance only.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to hide and show the status bar.

VBA Copy code Copy code

Public Sub ShowStatusBar_Example()

 'Switch the status bar on or off.
 Application.ShowStatusBar = Not Application.ShowStatusBar

End Sub


InvisibleApp.ShowToolbar Property (Visio)

 Copy code hover
[image]

InvisibleApp.ShowToolbar Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether toolbars and menu bars are visible. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .ShowToolbar

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The ShowToolbar property is valid for a Microsoft Visio instance only. The ShowStatusBar property persists each time you run Visio.


InvisibleApp.StartupPaths Property (Visio)

 Copy code hover
[image]

InvisibleApp.StartupPaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for third-party and user add-ons to run when the application is started. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .StartupPaths

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

The StartupPaths property is set to an empty string ("") by default.

The string passed to and received from the StartupPaths property is the same string shown in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\StartupPath subkey.

When the application looks for third-party and user startup add-on files, it looks in all paths named in the StartupPaths property, as well as at the paths of any startup add-ons installed at setup, and all the subfolders of those paths. If you pass the StartupPaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Setting the StartupPaths property replaces existing values for StartupPaths in the File Locations dialog box. To retain existing values, get the existing string and then append the new file path to that string, as shown in the following code:

VBA Copy code Copy code
Application.StartupPaths = Application.StartupPaths & ";" & "newpath".
Caution note Caution

Modifying the Microsoft Windows registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the StartupPaths property to add a path to the Start-up paths list.

VBA Copy code Copy code
Public Sub StartupPaths_Example()

    Dim strMessage As String
    Dim strNewPath As String
    Dim strStartupPath As String
    Dim strTitle As String

    'Get the path we want to add.
    strStartupPath = Application.StartupPaths
    strTitle = "StartupPaths"
    strMessage = "The current content of the Visio Start-up paths box is:"
    strMessage = strMessage & vbCrLf & strStartupPath
    MsgBox strMessage, vbInformation + vbOKOnly, strTitle
    strMessage = "Type in an additional path for Visio to look for add-ons. "

    strNewPath = InputBox$(strMessage, strTitle)

    'Make sure the folder exists and that it's not
    'already in the Start-up paths box.
    strMessage = ""

    If strNewPath = ""  Then
        strMessage = "You did not enter a path."
    ElseIf InStr(strStartupPath, strNewPath)  Then
        strMessage = "The path you specified is already in the Start-up paths box."
    ElseIf Len(Dir$(strNewPath, vbDirectory)) = 0 And _
                Len(Dir$(Application.Path & strNewPath, _
                vbDirectory)) = 0 Then
        strMessage = "The folder you typed does not exist (or is empty)."
    Else
        Application.StartupPaths = strStartupPath & ";" & strNewPath
        strMessage = "We just added " & strNewPath & _
                " to the startup paths."
    End If

    If strMessage <> ""  Then
        MsgBox strMessage, vbExclamation + vbOKOnly, strTitle
    End If

End Sub


InvisibleApp.Stat Property (Visio)

 Copy code hover
[image]

InvisibleApp.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


InvisibleApp.StencilPaths Property (Visio)

 Copy code hover
[image]

InvisibleApp.StencilPaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for stencils. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .StencilPaths

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

The StencilPaths property is set to an empty string ("") by default.

The string passed to and received from the StencilPaths property is the same string shown in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\StencilPath subkey.

When Visio looks for stencils, it looks in all paths named in the StencilPaths property and all the subfolders of those paths. If you pass the StencilPaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Setting the StencilPaths property replaces existing values for Stencils in the File Locations dialog box. To retain existing values, get the existing string and then append the new file path to that string, as shown in the following code:

VBA Copy code Copy code
Application.StencilPaths = Application.StencilPaths & ";" & "newpath".
Caution note Caution

Modifying the registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to us the StencilPaths property to add a path to the stencils.

VBA Copy code Copy code

Public Sub ShowStencilPaths_Example()

    Dim strMessage As String
    Dim strNewPath As String
    Dim strStencilPath As String
    Dim strTitle As String

    'Get the path we want to add.
    strStencilPath = Application.StencilPaths
    strTitle = "StencilPaths"
    strMessage = "The current content of the Visio Stencils box is:"
    strMessage = strMessage & vbCrLf & strStencilPath
    MsgBox strMessage, vbInformation + vbOKOnly, strTitle
    strMessage = "Type in an additional path for Visio to look for stencils. "
    strNewPath = InputBox$(strMessage, strTitle)

    'Make sure the folder exists and that it's not
    'already in the stencil paths.
    strMessage = ""
    If strNewPath = ""  Then
        strMessage = "You did not enter a path."
        ElseIf InStr(strStencilPath, strNewPath)  Then
            strMessage = "The path you specified is already in the stencil paths."
        ElseIf Len(Dir$(strNewPath, vbDirectory)) = 0 And _
                Len(Dir$(Application.Path & strNewPath, _
                vbDirectory)) = 0 Then
            strMessage = "The folder you typed does not exist (or is blank)."
        Else
            Application.StencilPaths = strStencilPath & ";" & strNewPath
            strMessage = "We just added " & strNewPath & _
                " to the stencil paths."
        End If

    If strMessage <> ""  Then
        MsgBox strMessage, vbExclamation + vbOKOnly, strTitle
    End If

End Sub


InvisibleApp.TemplatePaths Property (Visio)

 Copy code hover
[image]

InvisibleApp.TemplatePaths Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the paths where Microsoft Visio looks for templates. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TemplatePaths

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

The TemplatePaths property is set to an empty string ("") by default.

The string passed to and received from the TemplatePaths property is the same string shown in the File Locations dialog box. (Click the File tab, click Options, click Advanced, and then, under General, click File Locations.) This string is stored in the HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Visio\Application\TemplatePath subkey.

When Visio looks for templates, it looks in all paths named in the TemplatePaths property and all the subfolders of those paths. If you pass the TemplatePaths property to the EnumDirectories method, it returns a complete list of fully qualified paths in the folders passed in.

Setting the TemplatePaths property replaces existing values for Templates in the File Locations dialog box. To retain existing values, get the existing string and then append the new file path to that string, as shown in the following code:

VBA Copy code Copy code
Application.TemplatePaths = Application.TemplatePaths & ";" & "newpath".
Caution note Caution

Modifying the registry in any manner, whether in the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the TemplatePaths property to add a path to the Templates paths box.

VBA Copy code Copy code

Public Sub TemplatePaths_Example()

    Dim strMessage As String
    Dim strNewPath As String
    Dim strTemplatePath As String
    Dim strTitle As String

    'Get the path we want to add.
    strTemplatePath = Application.TemplatePaths
    strTitle = "TemplatePaths"
    strMessage = "The current content of the Visio Templates path box is:"
    strMessage = strMessage & vbCrLf & strTemplatePath
    MsgBox strMessage, vbInformation + vbOKOnly, strTitle
    strMessage = "Type in an additional path for Visio to look for templates. "
    strNewPath = InputBox$(strMessage, strTitle)

    'Make sure the folder exists and that it's not
    'already in the Templates path box.
    strMessage = ""
    If strNewPath = ""  Then
        strMessage = "You did not enter a path."
        ElseIf InStr(strTemplatePath, strNewPath)  Then
            strMessage = "The path you specified is already in the Templates path box."
        ElseIf Len(Dir$(strNewPath, vbDirectory)) = 0 And _
                Len(Dir$(Application.Path & strNewPath, _
                vbDirectory)) = 0 Then
            strMessage = "The folder you typed does not exist (or is blank)."
        Else
            Application.TemplatePaths = strTemplatePath & ";" & strNewPath
            strMessage = "We just added " & strNewPath & _
                " to the Templates path box."
    End If

    If strMessage <> ""  Then
        MsgBox strMessage, vbExclamation + vbOKOnly, strTitle
    End If

End Sub


InvisibleApp.TraceFlags Property (Visio)

 Copy code hover
[image]

InvisibleApp.TraceFlags Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets events logged during a Microsoft Visio instance. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .TraceFlags

expression A variable that represents an InvisibleApp object.

Return Value

Long

Remarks

The value of the TraceFlags property can be a combination of the following values.

Constant | Value | Description
visTraceEvents | &H1 | Event occurrences
visTraceAdvises | &H2 | Outgoing advise calls
visTraceAddonInvokes | &H4 | Add-on invocations
visTraceCallsToVBA | &H8 | VBA invocations

Setting the visTraceEvents flag causes Visio to log most events as they happen and display them in the Immediate window. In most cases this occurs even if no external agent is listening or responding to the event. In a few cases, Visio knows there is no listener for an event and does not log those events. Visio also does not log idle events or advises. In addition, some events are specializations of other events and aren't recorded. For example, the SelectionAdded event is manufactured from distinct ShapeAdded events, so the Immediate window records the ShapeAdded events but not the SelectionAdded events.

Here is a string Visio might log when visTraceEvents is set:

VBA Copy code Copy code
-event: 0x8040 /doc=1 /page=1 /shape=Sheet.1

The number after -event: is the code of the event that occurred. In this case 0x8040 is the code for the ShapeAdded event. The text following the event code differs from event to event.

Setting the visTraceAdvises flag writes a line to the Immediate window just before Visio calls an event handler procedure and another line just after the event handler returns. This includes event procedures in Microsoft Visual Basic for Applications (VBA) projects, for example, procedures in ThisDocument. Here is an example of what you might see:

VBA Copy code Copy code
>advise seq=4 event=0x8040 sink=0x40097598
<advise seq=4

These strings indicate the call to and return from an event handler. The sequence number also indicates this event was the fourth one fired by Visio. The code of the event is 0x8040 and the address of the interface Visio called is 0x40097598.

Setting the visTraceAddonInvokes flag records when Visio invokes an EXE or VSL add-on, and when Visio regains control. Here is an example:

VBA Copy code Copy code
>invokeAO: SHOWARGS.EXE
<invokeAO: completed

Setting the visTraceAddonInvokes flag also traces attempts to invoke add-ons that are not present. For example, if a cell's formula is =RunAddon("xxx") and there is no add-on named "xxx", the message "InvokeAO: Failed to map 'xxx' to known Add-on" is logged.

Setting the visTraceCallToVBA flag writes a line to the Immediate window just before it makes a call to VBA other than a call to an event procedure (use visTraceAdvises to log calls to VBA event procedures) and another line just after VBA returns control to Visio. This flag traces macro invocations, calls to VBA procedures resulting from evaluation of cells that make use of RunAddon or CallThis operands, and calls resulting from selection of custom menu or toolbar items. Here is an example:

VBA Copy code Copy code
>invokeVBA: Module1.MyMacro
<invokeVBA: completed

A message doesn't appear in the Immediate window unless a document that has a VBA project is open. Visio queues a small number of messages to log when such a document opens. However, messages are lost if no document with a project is available for lengthy periods. Messages are also lost if VBA resets or if there are undismissed breakpoints.

Code in VBA projects can intersperse its messages with those logged by Visio by using standard Debug.Print statements. Code in non-VBA projects can log messages to the Immediate window by using Document.VBProject.ExecuteLine("Debug.Print ""somestring""").

The TraceFlags property is recorded in the TraceFlags entry of the Application section of the registry.

Example

This VBA macro shows how to use the TraceFlags property to log events, advises, add-on invocations, and Visual Basic invocations in the Immediate window.

VBA Copy code Copy code

Public Sub TraceFlags_Example()

 Application.TraceFlags = visTraceEvents + visTraceAdvises + _
 visTraceAddonInvokes + visTraceCallsToVBA

End Sub


InvisibleApp.TypelibMajorVersion Property (Visio)

 Copy code hover
[image]

InvisibleApp.TypelibMajorVersion Property (Visio)
Send feedback

Published: July 16, 2012

Returns the major version number of the Microsoft Visio type library. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .TypelibMajorVersion

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

The major and/or minor version number of the Visio type library will increase whenever the Visio type library is extended. A program can use the TypelibMajorVersion and TypelibMinorVersion properties to guarantee that the Visio version it is working with provides support for the features it is using.

Small changes to the Visio type library do not affect the Application object's Version property.


InvisibleApp.TypelibMinorVersion Property (Visio)

 Copy code hover
[image]

InvisibleApp.TypelibMinorVersion Property (Visio)
Send feedback

Published: July 16, 2012

Returns the minor version number of the Microsoft Visio type library. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .TypelibMinorVersion(lpi2Ret)

expression A variable that represents an InvisibleApp object.

Return Value

Integer

Remarks

The major and/or minor version number of the Visio type library will increase whenever the Visio type library is extended. A program can use the TypelibMajorVersion and TypelibMinorVersion properties to guarantee that the Visio version it is working with provides support for the features it is using.

Small changes to the Visio type library do not affect the Application object's Version property.


InvisibleApp.UndoEnabled Property (Visio)

 Copy code hover
[image]

InvisibleApp.UndoEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether undo information is maintained in memory. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .UndoEnabled

expression A variable that represents an InvisibleApp object.

Return Value

Boolean

Remarks

When Microsoft Visio starts, the value of the UndoEnabled property is True. Setting the value of the UndoEnabled property to False discontinues the collection of undo information in memory and clears the existing undo information.

You should attempt to maintain the property at its current value across the complete operation that you perform. In other words, use code structured like this:

VBA Copy code Copy code
blsPrevious = Application.UndoEnabled
Application.UndoEnabled = False

'Large operation here
Application.UndoEnabled = blsPrevious

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the UndoEnabled method to disable and then re-enable undo behavior in Visio.

VBA Copy code Copy code
Public Sub UndoEnabled_Example()

 'Disable undo
 Application.UndoEnabled = False

 'Draw three shapes.
 ActivePage.DrawRectangle 1, 2, 2, 1
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Enable undo.
 Application.UndoEnabled = True

End Sub


InvisibleApp.UserName Property (Visio)

 Copy code hover
[image]

InvisibleApp.UserName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the user name of an Application object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .UserName

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

Setting the UserName property is equivalent to entering a name in the Name box on the General tab in the Visio Options dialog box (click the BackstageButton tab, and then click Options).


InvisibleApp.VBAEnabled Property (Visio)

 Copy code hover
[image]

InvisibleApp.VBAEnabled Property (Visio)
Send feedback

Published: July 16, 2012

Specifies whether Microsoft Visual Basic for Applications (VBA) is enabled in the application. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .VBAEnabled

expression A variable that represents an InvisibleApp object.

Return Value

Boolean

Remarks

If a document that contains a VBA project is opened with VBA enabled, and then VBA becomes disabled while the document is open:

  • Microsoft Visio no longer executes macros in that document, but the macro names still appear in the Macros dialog box (press Alt+F8).

  • Visio continues firing events to the project.

If a document that contains a VBA project is opened with VBA disabled, and then VBA becomes enabled while the document is open:

  • Visio does not fire events to the project, even though VBA has become enabled.

  • Macros remain disabled.

The VBAEnabled property is set to True if the Trust access to the VBA project object model check box is selected under Developer Macro Settings on the Macro Settings page of the Trust Center (click the BackstageButton tab, click Options, click Trust Center, and then click Trust Center Settings). If it is not selected, the property reports False.

Example

You may have a document that requires VBA to be enabled to run properly, for example, code in a document's DocumentOpened event handler. The following code can be run from an add-on to verify whether VBA is enabled in the application before a document that depends on VBA is opened.

Before running this procedure, supply a valid document file name for the variable filename.

VBA Copy code Copy code
Public Sub VBAEnabled_Example()

 Dim vsoDocument As Visio.Document
 Dim blsStatus As Boolean

 blsStatus = Application.VBAEnabled
 If Not blsStatus Then

 MsgBox "For this process to continue, VBA must be enabled." & _
 " Please enable VBA and start over."

 Else

 Set vsoDocument = Documents.Open("filename")

 End if

End Sub


InvisibleApp.Vbe Property (Visio)

 Copy code hover
[image]

InvisibleApp.Vbe Property (Visio)
Send feedback

Published: July 16, 2012

Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Visio documents. Read-only.

Version Information

Version Added: Visio 4.5

Syntax

expression .Vbe

expression A variable that represents an InvisibleApp object.

Return Value

Object

Remarks

To get information about the object returned by the Vbe property, follow these steps:

To get information about the object returned by the Vbe property

  1. In the Code group on the Developer tab, click Visual Basic.

  2. In the Visual Basic Editor, on the Tools menu, click References.

  3. In the References dialog box, click Microsoft Visual Basic for Applications Extensibility 5.3, and then click OK.

  4. On the View menu, click Object Browser.

  5. In the Project/Library list, select the VBIDE type library.

  6. In the Classes list, examine the class named VBE.

Beginning with Visio 2002, the Vbe property raises an exception if you are running in a security-enhanced environment and your system administrator has blocked access to the VBA object model. There is no user interface or programmatic way to turn this on—the system administrator must turn on (or off) access by setting a Group Policy. This helps protect against viruses that spread by accessing the Visual Basic projects in commonly used templates and injecting the virus code into them.

Example

This VBA macro shows how to use the Vbe property to determine how many VBA projects are open in an instance of Visio.

Before running this code, make sure the Trust access to the VBA project object model check box is selected under Developer Macro Settings on the Macro Settings page of the Trust Center dialog box (click the File tab, click Options, click Trust Center, and then click Trust Center Settings).

VBA Copy code Copy code

Public Sub Vbe_Example()

     Dim vbideVBE As VBIDE.VBE

     Set vbideVBE = Visio.Application.Vbe
     Debug.Print vbideVBE.VBProjects.Count

End Sub


InvisibleApp.Version Property (Visio)

 Copy code hover
[image]

InvisibleApp.Version Property (Visio)
Send feedback

Published: July 16, 2012

Returns the version of a running Microsoft Visio instance. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Version

expression A variable that represents an InvisibleApp object.

Return Value

String

Remarks

Use the Version property of the InvisibleApp object to verify the version of a particular Visio instance. This information is helpful if your program requires a particular version. Both the major and minor version numbers are returned. The string returned by Microsoft Visio 2013 is 15.0.


InvisibleApp.Visible Property (Visio)

 Copy code hover
[image]

InvisibleApp.Visible Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is visible. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Visible

expression A variable that represents an InvisibleApp object.

Return Value

Boolean


InvisibleApp.Window Property (Visio)

 Copy code hover
[image]

InvisibleApp.Window Property (Visio)
Send feedback

Published: July 16, 2012

Returns the window associated with the current instance of Microsoft Visio. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Window

expression A variable that represents an InvisibleApp object.

Return Value

Window

Example

The following macro shows how to use the Window property to print the caption of the window associated with the current instance of Visio in the Immediate window.

VBA Copy code Copy code

Public Sub Window_Example()

 Debug.Print Application.Window.Caption

End Sub


InvisibleApp.WindowHandle32 Property (Visio)

 Copy code hover
[image]

InvisibleApp.WindowHandle32 Property (Visio)
Send feedback

Published: July 16, 2012

Returns the 32-bit handle of a Microsoft Visio window. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .WindowHandle32

expression A variable that represents an InvisibleApp object.

Return Value

Long

Remarks

The WindowHandle32 property of an Application object returns one of the following:

  • The HWND for the main Visio (frame) window (most common).

  • The HWND for the container application's main frame window if Visio is running in-place and active.

  • The HWND for the window returned by the GetActiveWindow() function if either frame window is disabled (for example, if a modal dialog box is running). For details about the GetActiveWindow function, see the Microsoft Platform SDK on the Microsoft Developer Network (MSDN) Web site.

Use the WindowHandle32 property of the Window object to obtain the HWND for a window in the Windows collection of a Visio instance.

You can use the obtained HWND in Windows API calls.

Note Note

Calls to the WindowHandle property (now hidden) are directed to the WindowHandle32 property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the 32-bit handle of a window.

VBA Copy code Copy code

Public Sub WindowHandle32_Example()

 Dim vsoWindow As Visio.Window
 Dim lngWindowHandle32 As Long

 'Get the active window.
 Set vsoWindow = ActiveWindow

 'Get the 32-bit handle of the active window.
 lngWindowHandle32 = vsoWindow.WindowHandle32

 'Verify that you got the handle.
 Debug.Print "The active window handle is"; lngWindowHandle32

End Sub


InvisibleApp.Windows Property (Visio)

 Copy code hover
[image]

InvisibleApp.Windows Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Windows collection for a Microsoft Visio instance or window. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Windows(lpdispRet)

expression A variable that represents an InvisibleApp object.

Return Value

Windows

Example

This Microsoft Visual Basic macro gets the Windows collection of the Application object and prints the ID of each window in the collection in the Immediate window.

VBA Copy code Copy code
Public Sub Windows_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoWindows As Visio.Windows
 Dim intCounter As Integer

 'Get the Windows collection.
 Set vsoApplication = Application
 Set vsoWindows = vsoApplication.Windows

 For intCounter = 1 To vsoWindows.Count
 Debug.Print vsoWindows.Item(intCounter).ID
 Next intCounter

End Sub


InvisibleApp Methods (Visio)

 Copy code hover
[image]

InvisibleApp Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddUndoUnit | Adds an object that supports the IOleUndoUnit or IVBUndoUnit interface to the Microsoft Visio undo queue.
BeginUndoScope | Starts a transaction with a unique scope ID for an instance of Microsoft Visio.
ClearCustomMenus | Restores the built-in Microsoft Visio user interface.
ClearCustomToolbars | Restores the built-in Microsoft Visio user interface.
ConvertResult | Converts a string or number into an equivalent number in different measurement units.
DoCmd | Performs the command that has the indicated command ID.
EndUndoScope | Ends or cancels a transaction that has a unique scope.
EnumDirectories | Returns an array naming the folders Microsoft Visio would search, given a list of paths.
FormatResult | Formats a string or number into a string according to a format picture. Uses specified units for scaling and formatting.
FormatResultEx | Formats a string or number into a string according to a format picture, using specified units for scaling and formatting. Optionally, for date or time strings, sets the language and calendar type of the string.
GetBuiltInStencilFile | Returns the file path to the specified built-in, hidden stencil used to populate certain galleries in the Microsoft Visio user interface.
GetCustomStencilFile | Returns the path to the specified custom stencil used to populate certain galleries in the Microsoft Visio user interface.
GetPreviewEnabled | Returns a value that indicates whether preview is enabled for the specified gallery in the Microsoft Visio user interface.
InvokeHelp | Performs operations that involve the Microsoft Visio Help system.
OnComponentEnterState | Informs a Microsoft Visio instance that client code is causing the instance to enter or exit a particular state.
PurgeUndo | Empties the Microsoft Visio queue of undo actions.
QueueMarkerEvent | Queues a MarkerEvent event that fires after all other queued events.
Quit | Closes the indicated instance of Microsoft Visio.
Redo | Reverses the most recent undo unit.
RegisterRibbonX | Registers the IRibbonExtensibility interface that is implemented by the specified add-on to populate the custom user interface (UI).
RenameCurrentScope | Renames the top-level open undo scope.
SetCustomMenus | Replaces the current built-in or custom menus of an application or document.
SetCustomToolbars | Replaces the current built-in or custom toolbars of an application or document.
SetPreviewEnabled | Turns preview on or off for a gallery in the Microsoft Visio user interface.
Undo | Reverses the most recent undo unit, if the undo unit can be reversed.
UnregisterRibbonX | Unregisters a previouly registered IRibbonExtensiblity interface that a Microsoft Visio add-in implements.


InvisibleApp.AddUndoUnit Method (Visio)

 Copy code hover
[image]

InvisibleApp.AddUndoUnit Method (Visio)
Send feedback

Published: July 16, 2012

Adds an object that supports the IOleUndoUnit or IVBUndoUnit interface to the Microsoft Visio undo queue.

Version Information

Version Added: Visio 2000

Syntax

expression .AddUndoUnit(pUndoUnit)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
pUndoUnit | Required | [UNKNOWN] | A reference to an object that supports the IOleUndoUnit or IVBUndoUnit interface.

Return Value

clsVBUndoUnits

Remarks

For information about implementing the IOleUndoUnit interface on your object, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network. For information about implementing the IVBUndoUnit interface, see Developing Microsoft Visio Solutions on MSDN.

Example

The following procedure shows how to use the AddUndoUnit method to add an object to the Visio undo queue. When a shape is added to the active document, the procedure checks to see if it was added as a result of an undo or redo action, and if not, it adds an Undo unit.

This procedure is a member of class clsParticipateInUndo, which is defined in one of two related class modules in the Code Samples Library in the Visio SDK, and is not intended to be run independently. (The other class module defines class clsVBUndoUnits.) For more information on these class modules, see the Visio SDK on MSDN.

VBA Copy code Copy code

Private Sub mvsoDocument_ShapeAdded(ByVal vsoShape As IVShape)

 Dim VBUndoUnit As clsVBUndoUnits

 On Error GoTo mvsoDocument_ShapeAdded_Err

 If Not (mvsoApplication Is Nothing) Then

 If Not msvoApplication.IsUndoingOrRedoing Then

 'Increment the count of undoable actions.
 IncrementModuleVar
 Debug.Print "Original Do: GetModuleVar = " & GetModuleVar

 'Instantiate clsVBUndoUnit, a
 'class that implements Visio.IVBUndoUnit.
 Set VBUndoUnit = New clsVBUndoUnits

 'Pass the current instance of the class
 'of which this procedure is a member,
 'clsParticipateInUndo, to the Undo unit.
 VBUndoUnit.SetModelObject Me

 'Add an Undo unit.
 mvsoApplication.AddUndoUnit VBUndoUnit

 End If

 End If

Exit Sub

mvsoDocument_ShapeAdded_Err:

 MsgBox Err.Description

End Sub


InvisibleApp.BeginUndoScope Method (Visio)

 Copy code hover
[image]

InvisibleApp.BeginUndoScope Method (Visio)
Send feedback

Published: July 16, 2012

Starts a transaction with a unique scope ID for an instance of Microsoft Visio.

Version Information

Version Added: Visio 2000

Syntax

expression .BeginUndoScope(bstrUndoScopeName)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
bstrUndoScopeName | Required | String | The name of the scope; could appear in the Visio user interface.

Return Value

Long

Remarks

If you need to know whether events you receive are the result of a particular operation that you initiated, use the BeginUndoScope and EndUndoScope methods to wrap your operation. In your event handlers, use the IsInScope property to test whether the scope ID returned by the BeginUndoScope method is part of the current context. Make sure you clear the scope ID you stored from the BeginUndoScope property when you receive the ExitScope event with that ID.

You must balance calls to the BeginUndoScope method with calls to the EndUndoScope method. If you call the BeginUndoScope method, you should call the EndUndoScope method as soon as you are finished with the actions that constitute your scope. Also, while actions to multiple documents should be robust within a single scope, closing a document may have the side effect of clearing the undo information for the currently open scope as well as clearing the undo and redo stacks. If that happens, passing bCommit = False to EndUndoScope does not restore the undo information.

You can also use the BeginUndoScope and EndUndoScope methods to add an action defined by an add-on to the Visio undo stream. This is useful when you are operating from modeless scenarios where the initiating agent is part of an add-on's user interface or a modeless programmatic action.

Note Note

Most Visio actions are already wrapped in internal undo scopes, so add-ons running within the application do not need to call this method.

Example

This example shows how to use the BeginUndoScope method to start a transaction that has a unique scope ID for an instance of Visio.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application
Private lngScopeID As Long

Public Sub BeginUndoScope_Example()

 Dim vsoShape As Visio.Shape

 'Set the module-level application variable to
 'trap application-level events.
 Set vsoApplication = Application

 'Begin a scope and set the module-level scope ID variable.
 lngScopeID = Application.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell to trigger the CellChanged event.
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 Application.EndUndoScope lngScopeID, True

 End Sub

 Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering my scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting my scope " & nScopeID
 Else
 Debug.Print "Exit Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


InvisibleApp.ClearCustomMenus Method (Visio)

 Copy code hover
[image]

InvisibleApp.ClearCustomMenus Method (Visio)
Send feedback

Published: July 16, 2012

Restores the built-in Microsoft Visio user interface.

Version Information

Version Added: Visio 4.0

Syntax

expression .ClearCustomMenus

expression A variable that represents an InvisibleApp object.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Calling the ClearCustomMenus method on an object without custom menus has no effect.

Example

This example shows how to clear custom menus for the ThisDocument and Application objects and restore the built-in Visio menus.

VBA Copy code Copy code

Public Sub ClearCustomMenus_Example()

 'Tell Visio to use the built-in menus.
 ThisDocument.ClearCustomMenus
 Visio.Application.ClearCustomMenus

End Sub


InvisibleApp.ClearCustomToolbars Method (Visio)

 Copy code hover
[image]

InvisibleApp.ClearCustomToolbars Method (Visio)
Send feedback

Published: July 16, 2012

Restores the built-in Microsoft Visio user interface.

Version Information

Version Added: Visio 4.0

Syntax

expression .ClearCustomToolbars

expression A variable that represents an InvisibleApp object.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Calling the ClearCustomToolbars method on an object without custom toolbars has no effect.

Example

This example shows how to clear custom toolbars for the ThisDocument and Application objects and restore the built-in Microsoft Visio toolbars.

VBA Copy code Copy code

Public Sub ClearCustomToolbars_Example()

 'Tell Visio to use the built-in toolbars.
 ThisDocument.ClearCustomToolbars
 Visio.Application.ClearCustomToolbars

End Sub


InvisibleApp.ConvertResult Method (Visio)

 Copy code hover
[image]

InvisibleApp.ConvertResult Method (Visio)
Send feedback

Published: July 16, 2012

Converts a string or number into an equivalent number in different measurement units.

Version Information

Version Added: Visio 4.5

Syntax

expression .ConvertResult(StringOrNumber, UnitsIn, UnitsOut, lpr8Ret)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
StringOrNumber | Required | Variant | String or number to be converted; can be a string, floating point number, or integer.
UnitsIn | Required | Variant | Measurement units to attribute to StringOrNumber.
UnitsOut | Required | Variant | Measurement units to express the result in.

Return Value

Double

Remarks

If passed as a string, StringOrNumber might be the formula or prospective formula of a cell or the result or prospective result of a cell expressed as a string. The ConvertResult method evaluates the string and converts the result into the units designated by UnitsOut. The ConvertResult method returns an error if the string contains any cell references.

Possible values for StringOrNumber include:

1.7

3

"2.5"

"4.1 cm"

"12 ft - 17 in + (12 cm / SQRT(7))"

The UnitsIn and UnitsOut arguments can be strings such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Office Visio units such as centimeters, meters, miles, and so on. You can also use any of the units constants declared by the Visio type library in VisUnitCodes. A list of valid units is also listed in About Units of Measure.

If StringOrNumber is a floating point number or integer, UnitsIn declares what unit of measure the ConvertResult method should construe the number to be. Pass "" to indicate internal Visio units.

If StringOrNumber is a string, UnitsIn specifies how to interpret the evaluated result and is only used if the result is a scalar. For example, the expression "4 * 5 cm" evaluates to 20 cm, which is not a scalar, so UnitsIn is ignored. The expression "4 * 5" evaluates to 20 which is a scalar and is interpreted using the specified UnitsIn.

The UnitsOut argument specifies in what units the returned number should be expressed. If you want the results expressed in the same units as the evaluated expression, pass "NOCAST" or visNoCast.

Examples where string is specified:

Copy code Copy code

Debug.Print vsoApplication.ConvertResult("0.5 * 2", "ft", "ft") >>> 1.0
Debug.Print vsoApplication.ConvertResult("0.5 * 2", "ft", "in") >>> 12.0
Debug.Print vsoApplication.ConvertResult("1 cm", "ft", "in") >>> 0.39
Debug.Print vsoApplication.ConvertResult("1 cm", "ft", "NOCAST") >>> 1.0
Debug.Print vsoApplication.ConvertResult("1 cm", "ft", "") >>> 0.39
Debug.Print vsoApplication.ConvertResult("1 cm", "ft", "bozo") >>> exception: Bad measurement unit.

Examples where number is specified:

Copy code Copy code

Debug.Print vsoApplication.ConvertResult(1, "ft", "ft") >>> 1
Debug.Print vsoApplication.ConvertResult(1, "ft", "in") >>> 12
Debug.Print vsoApplication.ConvertResult(1.0, "in", "ft") >>> 8.33333333333333E-02
Debug.Print vsoApplication.ConvertResult(1.0, visFeet, "") >>> 12
Debug.Print vsoApplication.ConvertResult(1, "bozo", "in") >>> exception: Bad measurement unit.

Example

The following macro shows how to use the ConvertResult method to report the distance between two shapes in centimeters, feet, yards, and miles. To run this macro, you must have two shapes selected on your page.

VBA Copy code Copy code
Sub ConvertResult_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoWindow As Visio.Window
 Dim vsoSelection As Visio.Selection
 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape

 Dim dblPinX1 As Double
 Dim dblPinY1 As Double
 Dim dblPinX2 As Double
 Dim dblPinY2 As Double
 Dim dblPinX1in As Double
 Dim dblPinY1in As Double
 Dim dblPinX2in As Double
 Dim dblPinY2in As Double
 Dim lngCount As Long
 Dim dblDistance As Double
 Dim dblDistanceX As Double
 Dim dblDistanceY As Double
 Dim dblResult(4) As Double
 Dim strUnit As String
 Set vsoApplication = Visio.Application
 Set vsoWindow = vsoApplication.ActiveWindow

 'Drawing page must be active window
 If vsoWindow.Type = 1 Then
 Set vsoSelection = vsoWindow.Selection
 lngCount = vsoSelection.Count

 'Exactly two shapes should be selected
 If lngCount <> 2 Then
 MsgBox "A total of " & lngCount & " shapes are " _
 & "selected. Please select two shapes and try " _
 & "again", 0
 Else
 Set vsoShape1 = vsoSelection.Item(1)
 Set vsoShape2 = vsoSelection.Item(2)

 'Pass the Visio Automation constant for inches (visInches, which is defined as 65) to the Result method to force units to inches
 dblPinX1in = vsoShape1.Cells("PinX").Result(65)
 dblPinY1in = vsoShape1.Cells("PinY").Result(65)
 dblPinX2in = vsoShape2.Cells("PinX").Result(65)
 dblPinY2in = vsoShape2.Cells("PinY").Result(65)
 dblDistance = Sqr((dblPinX2in - dblPinX1in) ^ 2 + _
 (dblPinY2in - dblPinY1in) ^ 2)

 'Convert distances from inches to centimeters, feet, yards, and miles
 dblResult(1) = vsoApplication.ConvertResult(dblDistance, "in", "cm")
 dblResult(2) = vsoApplication.ConvertResult(dblDistance, "in", "ft")
 dblResult(3) = vsoApplication.ConvertResult(dblDistance, "in", "yd")
 dblResult(4) = vsoApplication.ConvertResult(dblDistance, "in", "mi")

 'Display results
 MsgBox dblResult(1) & " centimeters; " & dblResult(2) & " feet; " & _
 dblResult(3) & " ;yards; " & dblResult(4) & " miles ", 0

 End If

 Else
 MsgBox "The drawing page must be active.", 0

 End If

End Sub


InvisibleApp.DoCmd Method (Visio)

 Copy code hover
[image]

InvisibleApp.DoCmd Method (Visio)
Send feedback

Published: July 16, 2012

Performs the command that has the indicated command ID.

Version Information

Version Added: Visio 4.0

Syntax

expression .DoCmd(CommandID)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
CommandID | Required | Integer | The command to perform.

Return Value

nothing

Remarks

Constants for Microsoft Visio command IDs are declared by the Visio type library in VisUICmds and are prefixed with visCmd.

The DoCmd method works best with commands that display dialog boxes.

For a list of commands that can be used with the DoCmd method, see the topic DoCmd/DOCMD Commands in this Automation Reference.

Example

The following macro shows how to use constants with the DoCmd method. It opens a new document and displays the document stencil.

VBA Copy code Copy code

Public Sub DoCmd_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")

 Visio.Application.DoCmd (visCmdWindowShowMasterObjects)

End Sub


InvisibleApp.EndUndoScope Method (Visio)

 Copy code hover
[image]

InvisibleApp.EndUndoScope Method (Visio)
Send feedback

Published: July 16, 2012

Ends or cancels a transaction that has a unique scope.

Version Information

Version Added: Visio 2000

Syntax

expression .EndUndoScope(nScopeID, bCommit)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
nScopeID | Required | Long | The ID of the scope to close.
bCommit | Required | Boolean | flag indicating that the changes made during the scope should be accepted (True) or canceled (False).

Return Value

Nothing

Remarks

If you need to know whether events you receive are the result of a particular operation that you initiated, use the BeginUndoScope and EndUndoScope methods to wrap your operation. In your event handlers, use the IsInScope property to test whether the scope ID returned by the BeginUndoScope method is part of the current context. Make sure you clear the scope ID you stored from the BeginUndoScope property when you receive the ExitScope event with that ID.

You must balance calls to the BeginUndoScope method with calls to the EndUndoScope method. If you call the BeginUndoScope method, you should call the EndUndoScope method as soon as you are done with the actions that constitute your scope. Also, while actions to multiple documents should be robust within a single scope, closing a document may have the side effect of clearing the undo information for the currently open scope as well as clearing the undo and redo stacks. If that happens, passing bCommit = False to EndUndoScope does not restore the undo information.

You can also use the BeginUndoScope and EndUndoScope methods to add an action defined by an add-on to the Microsoft Visio undo stream. This is useful when you are operating from modeless scenarios where the initiating agent is part of an add-on's user interface or a modeless programmatic action.

Note Note

Most Visio actions are already wrapped in internal undo scopes, so add-ons running within the application do not need to call this method.

Example

This example shows how to use the EndUndoScope method to end a transaction that has a unique scope ID for an instance of Visio.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application
Private lngScopeID As Long

Public Sub EndUndoScope_Example()

 Dim vsoShape As Visio.Shape

 'Set the module-level application variable to
 'trap Application-level events.
 Set vsoApplication = Visio.Application

 'Begin a scope and set the module-level variable.
 lngScopeID = vsoApplication.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell to trigger a CellChanged event.
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 vsoApplication.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As
 String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering my scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting my scope " & nScopeID
 Else
 Debug.Print "Exit Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


InvisibleApp.EnumDirectories Method (Visio)

 Copy code hover
[image]

InvisibleApp.EnumDirectories Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array naming the folders Microsoft Visio would search, given a list of paths.

Version Information

Version Added: Visio 4.5

Syntax

expression .EnumDirectories(PathsString, NameArray())

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
PathsString | Required | String | A string of full or partial paths separated by semicolons.
NameArray() | Required | String | Out parameter. An array that receives the enumerated folder names.

Return Value

String()

Remarks

Several Visio properties such as AddonPaths and TemplatePaths accept and receive a string interpreted to be a list of path (folder) names separated by semicolons. When the application looks for items in the named paths, it looks in the folders and all their subfolders.

The purpose of the EnumDirectories method is to accept a string such as one that the AddonPaths property might produce and return a list of the folders that the application enumerates when processing such a string.

If the EnumDirectories method succeeds, NameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1. Each string is the fully qualified name of a folder that exists. The list names those folders designated in the path list that exist and all their subfolders.

The NameArray() paramter is an out parameter that is allocated by the EnumDirectories method, and ownership is passed back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. (Microsoft Visual Basic and Visual Basic for Applications automatically free the strings referenced by the array's entries.)

Example

The following example shows how to use the EnumDirectories method to print in the Immediate window a list of all the folders Visio searches for add-ons.

VBA Copy code Copy code

Public Sub EnumDirectories_Example()

 Dim strDirectoryNames() As String
 Dim intLowerBound As Integer
 Dim intUpperBound As Integer

 Application.EnumDirectories Application.AddonPaths, strDirectoryNames

 intLowerBound = LBound(strDirectoryNames)
 intUpperBound = UBound(strDirectoryNames)

 While intLowerBound <= intUpperBound
 Debug.Print strDirectoryNames(intLowerBound)
 intLowerBound = intLowerBound + 1
 Wend

End Sub


InvisibleApp.FormatResult Method (Visio)

 Copy code hover
[image]

InvisibleApp.FormatResult Method (Visio)
Send feedback

Published: July 16, 2012

Formats a string or number into a string according to a format picture. Uses specified units for scaling and formatting.

Version Information

Version Added: Visio 4.5

Syntax

expression .FormatResult(StringOrNumber, UnitsIn, UnitsOut, Format)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
StringOrNumber | Required | Variant | String or number to be formatted; can be passed as a string, floating point number, or integer.
UnitsIn | Required | Variant | Measurement units to attribute to StringOrNumber.
UnitsOut | Required | Variant | Measurement units to express the result in.
Format | Required | String | Picture of what the result string should look like.

Return Value

String

Remarks

If passed as a string, StringOrNumber might be the formula or prospective formula of a cell or the result or prospective result of a cell expressed as a string. The FormatResult method evaluates the string and formats the result. Because the string is being evaluated outside the context of being the formula of a particular cell, the FormatResult method returns an error if the string contains any cell references.

Possible values for StringOrNumber include:

1.7

3

"2.5"

"4.1 cm"

"12 ft - 17 in. + (12 cm / SQRT(7))"

The UnitsIn and UnitsOut arguments can be strings such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Office Visio units such as centimeters, meters, miles, and so on. You can also use any of the unit constants declared by the Visio type library in VisUnitCodes. A list of valid units is also included in About Units of Measure.

If StringOrNumber is a string, UnitsIn specifies how to interpret the evaluated result and is only used if the result is a scalar. For example, the expression "4 * 5 cm" evaluates to 20 cm, which is not a scalar, so UnitsIn is ignored. The expression "4 * 5" evaluates to 20, which is a scalar and is interpreted using the specified UnitsIn.

The UnitsOut argument specifies the units in which the returned string should be expressed. If you want the results expressed in the same units as the evaluated expression, pass "NOCAST" or visNoCast.

Format is a string that specifies a template or picture of the string produced by the FormatResult method. For details, see the FORMAT function. A few of the possibilities are:

# : Output a single digit, but not if it's a leading or trailing 0.

0 : Output a single digit, even if it is a leading or trailing 0.

. : Decimal placeholder.

, : Thousands separator.

"text" or 'text' : Output enclosed text as is.

\c : Output the character c.

Example

Where a string is specified

VBA Copy code Copy code
' Prints 1.00
Debug.Print Application.FormatResult("0.5 * 2", "ft", "ft", "#.00 u")

' Prints 12.00 in.
Debug.Print Application.FormatResult("0.5 * 2", "ft", "in", "#.00 u")

' Prints .39 in.
Debug.Print Application.FormatResult("1 cm", "ft", "in", "#.00 u")

' Prints 1.00 cm.
Debug.Print Application.FormatResult("1 cm", "ft", "NOCAST", "#.00 u")

' Prints 0.39
Debug.Print Application.FormatResult("1 cm", "ft", "", "0.00 u")

' Prints 1858.06 sq. cm.
Debug.Print Application.FormatResult("1 sq. ft. * 2", "in^2", "cm^2", "0.00 u")

' Throws an exception because of bad measurement unit ("bozo")
Debug.Print Application.FormatResult("1 cm", "ft", "bozo", "#.00 u")

Where a number is specified

VBA Copy code Copy code
' Prints 1.00
Debug.Print Application.FormatResult(1, "ft", "ft", "#.00 u")

' Prints 12.00 in.
Debug.Print Application.FormatResult(1, "ft", "in", "#.00 u")

' Prints .08 ft.
Debug.Print Application.FormatResult(1.0, "in", "ft", "#.00 u")

' Prints 12.00
Debug.Print Application.FormatResult(1.0, visFeet, "", "#.00 u")

' Throws an exception because of bad measurement unit ("bozo")
Debug.Print Application.FormatResult(1, "bozo", "in", "#.00 u")

The following macro shows how to use the FormatResult method to convert a value from centimeters to inches and display the result in a message box.

VBA Copy code Copy code

Public Sub FormatResult_Example()

 Dim strOldValue As String
 Dim strNewValue As String

 'Set old value.
 strOldValue = "1 cm"

 'Format value.
 strNewValue = Application.FormatResult _
 (strOldValue, "ft", "in", "#.00 u")

 'Display new value.
 MsgBox (strNewValue)

End Sub


InvisibleApp.FormatResultEx Method (Visio)

 Copy code hover
[image]

InvisibleApp.FormatResultEx Method (Visio)
Send feedback

Published: July 16, 2012

Formats a string or number into a string according to a format picture, using specified units for scaling and formatting. Optionally, for date or time strings, sets the language and calendar type of the string.

Version Information

Version Added: Visio 2003

Syntax

expression .FormatResultEx(StringOrNumber, UnitsIn, UnitsOut, Format, LangID, CalendarID, lpbstrRet)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
StringOrNumber | Required | Variant | String or number to be formatted; can be passed as a string, floating point number, or integer.
UnitsIn | Required | Variant | Measurement units to attribute to StringOrNumber.
UnitsOut | Required | Variant | Measurement units to express the result in.
Format | Required | String | Picture of what the result string should look like.
LangID | Optional | Long | The language to use for the result string.
CalendarID | Optional | Long | he calendar to use for the result string. The default value is the Western calendar, visCalWestern.

Return Value

String

Remarks

If passed as a string, StringOrNumber might be the formula or prospective formula of a cell or the result or prospective result of a cell expressed as a string. The FormatResultEx method evaluates the string and formats the result. Because the string is being evaluated outside the context of being the formula of a particular cell, the FormatResultEx method returns an error if the string contains any cell references.

Possible values for StringOrNumber include:

1.7

3

"2.5"

"4.1 cm"

"12 ft - 17 in + (12 cm / SQRT(7))"

When UnitsIn is visDate, you can pass a numeric value to the DATETIME function in StringOrNumber. The integer portion of the value you pass should represent the number of days since December 30, 1899, and the decimal portion should represent the fraction of a day since midnight. For example, 38135.50 represents noon on May 28th, 2004.

The UnitsIn and UnitsOut arguments can be strings such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Visio units such as centimeters, meters, miles, and so on. You can also use any of the unit constants declared by the Visio type library in VisUnitCodes. A list of valid units is also included in About Units of Measure.

If StringOrNumber is a string, UnitsIn specifies how to interpret the evaluated result and is only used if the result is a scalar. For example, the expression "4 * 5 cm" evaluates to 20 cm, which is not a scalar, so UnitsIn is ignored. The expression "4 * 5" evaluates to 20, which is a scalar and is interpreted using the specified UnitsIn.

The UnitsOut argument specifies the units in which the returned string should be expressed. If you want the results expressed in the same units as the evaluated expression, pass "NOCAST" or visNoCast.

Format is a string that specifies a template or picture of the string produced by the FormatResultEx method. For details, see the FORMAT function. A few of the possibilities are:

# : Output a single digit, but not if it is a leading or trailing 0.

0 : Output a single digit, even if it is a leading or trailing 0.

. : Decimal placeholder.

, : Thousands separator.

"text" or 'text' : Output enclosed text as is.

\c : Output the character c.

When UnitsIn is visDate, Format should be one of the custom Microsoft Visio expanded-form date/time formats, which are of the form "{{ date/time format picture }}". You can view these formats in the Custom Format box in the Data Format dialog box in Visio. (Select a shape, and then, on the Insert tab, click Field. In the Category list, click Date/Time, and then click Data Format.)

The LangID argument is optional. If you don't specify a value, Visio uses the current system language. If you pass a value, the LangID argument should be one of the standard IDs used by Microsoft Windows to encode different language versions. For example, 1033 is the language ID for English (United States). To see a list of possible language IDs, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN.

The CalendarID argument should be one of the following values, which are declared in VisCellVals in the Visio type library. The default value is the Western calendar, visCalWestern.

Constant | Value | Description
visCalWestern | 0 | Western
visCalArabicHijri | 1 | Arabic Hijiri
visCalHebrewLunar | 2 | Hebrew Lunar
visCalChineseTaiwan | 3 | Taiwan Calendar
visCalJapaneseEmperor | 4 | Japanese Emperor Reign
visCalThaiBuddhism | 5 | Thai Buddhist
visCalKoreanDanki | 6 | Korean Danki
visCalSakaEra | 7 | Saka Era
visCalTranslitEnglish | 8 | English transliterated
visCalTranslitFrench | 9 | French transliterated

Example

The following example shows how to use the FormatResultEx property to format a date in Greek and display it as shape text.

VBA Copy code Copy code
Public Sub FormatResultEx_Example

 Dim vsoShape As Visio.Shape
 Dim strDate As String

 Set vsoShape = ActivePage.DrawOval (3, 5, 5, 9)
 strDate = Application.FormatResultEx (37663.50, visDate, "", "{{dd MMMM yyyy}}", 1032, 0)

 vsoShape.Text = strDate

End Sub


InvisibleApp.GetBuiltInStencilFile Method (Visio)

 Copy code hover
[image]

InvisibleApp.GetBuiltInStencilFile Method (Visio)
Send feedback

Published: July 16, 2012

Returns the file path to the specified built-in, hidden stencil used to populate certain galleries in the Microsoft Visio user interface.

Version Information

Version Added: Visio 2010

Syntax

expression .GetBuiltInStencilFile(StencilType, MeasurementSystem)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
StencilType | Required | VisBuiltInStencilTypes | The stencil to retrieve. See Remarks for possible values.
MeasurementSystem | Required | VisMeasurementSystem | The measurement system for the stencil.

Return Value

String

Remarks

The StencilType parameter value must be one of the following VisBuiltInStencilTypes constants.

Constant | Value | Description
visBuiltInStencilBackgrounds | 0 | The hidden stencil that contains the shapes displayed in the Backgrounds gallery (Design tab).
visBuiltInStencilBorders | 1 | The hidden stencil that contains the shapes displayed in the Borders and Titles gallery (Design tab).
visBuiltInStencilContainers | 2 | The hidden stencil that contains the shapes displayed in the Container gallery (Insert tab).
visBuiltInStencilCallouts | 3 | The hidden stencil that contains the shapes displayed in the Callout gallery (Insert tab).
visBuiltInStencilLegends | 4 | The hidden stencil that contains the shapes displayed in the Insert Legend gallery (Data tab).


InvisibleApp.GetCustomStencilFile Method (Visio)

 Copy code hover
[image]

InvisibleApp.GetCustomStencilFile Method (Visio)
Send feedback

Published: July 16, 2012

Returns the path to the specified custom stencil used to populate certain galleries in the Microsoft Visio user interface.

Version Information

Version Added: Visio 2010

Syntax

expression .GetCustomStencilFile(StencilType)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
StencilType | Required | VisBuiltInStencilTypes | The stencil to retrieve. See Remarks for possible values.

Return Value

String

Remarks

The StencilType parameter value must be one of the following VisBuiltInStencilTypes constants.

Constant | Value | Description
visBuiltInStencilBackgrounds | 0 | The hidden stencil that contains the shapes displayed in the Backgrounds gallery (Design tab).
visBuiltInStencilBorders | 1 | The hidden stencil that contains the shapes displayed in the Borders and Titles gallery (Design tab).
visBuiltInStencilContainers | 2 | The hidden stencil that contains the shapes displayed in the Container gallery (Insert tab).
visBuiltInStencilCallouts | 3 | The hidden stencil that contains the shapes displayed in the Callout gallery (Insert tab).
visBuiltInStencilLegends | 4 | The hidden stencil that contains the shapes displayed in the Insert Legend gallery (Data tab).


InvisibleApp.GetPreviewEnabled Method (Visio)

 Copy code hover
[image]

InvisibleApp.GetPreviewEnabled Method (Visio)
Send feedback

Published: July 16, 2012

Returns a value that indicates whether preview is enabled for the specified gallery in the Microsoft Visio user interface.

Version Information

Version Added: Visio 2010

Syntax

expression .GetPreviewEnabled(GalleryName)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
GalleryName | Required | String | The name of the gallery for which you want to check the preview status. See Remarks.

Return Value

Boolean

Remarks

For the GalleryName parameter, you must pass the control ID for the specified gallery. You can find a list of control IDs for all Visio galleries by searching the MSDN library at http://msdn.microsoft.com/library.


InvisibleApp.InvokeHelp Method (Visio)

 Copy code hover
[image]

InvisibleApp.InvokeHelp Method (Visio)
Send feedback

Published: July 16, 2012

Performs operations that involve the Microsoft Visio Help system.

Version Information

Version Added: Visio 2002

Syntax

expression .InvokeHelp(bstrHelpFileName, Command, Data)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
bstrHelpFileName | Required | String | Specifies an HTML file, a URL, a compiled HTML file, or an optional window definition (preceded with a ">" character). If the command being used does not require a file or URL, this value may be "".
Command | Required | Long | The action to perform.
Data | Required | Long | Any data that is required based on the value of the command argument.

Return Value

Nothing

Remarks

Using the InvokeHelp method, you can create a custom Help system that is integrated with the Visio Help system. To enable your custom Help to appear in the same MSO Help window as Visio Help, do not specify a window definition in the bstrHelpFileName argument.

The arguments passed to the InvokeHelp method correspond to those described in the HTML Help API. For a list of command values, see the HTML Help API Reference on MSDN, the Microsoft Developer Network. Microsoft Visual Basic programmers can use the numeric equivalent of the C++ constants defined in the HTML Help API header files.

For example, use the following code to display the Visio Help window:

VBA Copy code Copy code
Application.InvokeHelp "Visio.chm", 15, 0

For more information about the HTML Help API, search for "HTML Help API overview" on MSDN.


InvisibleApp.OnComponentEnterState Method (Visio)

 Copy code hover
[image]

InvisibleApp.OnComponentEnterState Method (Visio)
Send feedback

Published: July 16, 2012

Informs a Microsoft Visio instance that client code is causing the instance to enter or exit a particular state.

Version Information

Version Added: Visio 2002

Syntax

expression .OnComponentEnterState(uStateID, bEnter)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
uStateID | Required | VisOnComponentEnterCodes | Describes the state being entered or exited along with flags that influence behavior while in the indicated state.
bEnter | Required | Boolean | True to indicate that a state is being entered; False to indicate that a state is being exited.

Return Value

nothing

Remarks

The uStateIDargument indicates the state being entered or exited. Code that calls this method should do so both when entering and exiting the state.

At present, the only state change supported by the OnComponentEnterState method is visComponentStateModal, indicating that the client is performing an action that causes Visio to enter or exit a modal state.

Most client code doesn't need to call the OnComponentEnterState method when causing Visio to enter or leave the state of being modal, for example, when showing modal dialog boxes. Typically, this method is used by client code that shows dialog boxes other than Microsoft Visual Basic for Applications (VBA) forms and requires behavior different from the Visio default behavior.

Following are constants and values for uStateID, which are declared by the Visio type library in VisOnComponentEnterCodes. Any of the following constants prefixed with visModal can be combined with visComponentStateModal to influence Visio behavior when transitioning to or from a modal state.

Constant | Value | Description
visComponentStateModal | 1 | The state being identified is a modal state.
visModalDeferEvents | &H10000 | Causes Visio to attempt to defer firing events while modal. By default, Visio defers firing events when displaying its own dialog boxes, but does not defer firing events when client code has caused a dialog box to appear.In the case of several nested modal scopes, if any scope is deferring events, all scopes within the outermost scope that is deferring events will defer events.This flag only has an effect when Visio is entering a modal scope. When exiting a modal scope, Visio behaves as it did when entering the scope.
visModalNoBeforeAfter | &H20000 | Prevents Visio from firing a BeforeModal event when entering a modal scope or an AfterModal event when leaving a modal scope.By default, Visio fires these events when displaying its own dialog boxes or displaying dialog boxes implemented by VBA, but does not fire these events when client code displays a dialog box.Calling the OnComponentEnterState method will cause these events to fire unless visModalNoBeforeAfter is specified.
visModalDontBlockMessages | &H40000 | Prevents Visio from rejecting calls from outside its main thread while modal. By default, Visio does reject calls from outside its thread while modal.In the case of several nested modal scopes, if any scope is deferring events, all scopes within the outermost scope that is deferring events will defer events.This flag only has an effect when Visio is entering a modal scope. When exiting a modal scope, Visio behaves as it did when entering the scope.
visModalDisableVisiosFrame | &H80000 | Causes Visio to disable its frame window while modal. By default, Visio disables its frame window when showing its own dialog boxes or when showing dialog boxes implemented by VBA, but not when client code in another process shows a dialog box.If code in another process wants to show a dialog box and have the Visio frame window behave as if it is the Visio process showing the dialog box, it can set this flag.This flag only has an effect when Visio entering a modal scope. When exiting a modal scope, Visio behaves as it did when entering the scope.


InvisibleApp.PurgeUndo Method (Visio)

 Copy code hover
[image]

InvisibleApp.PurgeUndo Method (Visio)
Send feedback

Published: July 16, 2012

Empties the Microsoft Visio queue of undo actions.

Version Information

Version Added: Visio 5.0

Syntax

expression .PurgeUndo

expression A variable that represents an InvisibleApp object.

Return Value

Nothing

Remarks

After calling the PurgeUndo method, no operation performed before the call can be reversed.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PurgeUndo method to clear the undo list.

VBA Copy code Copy code

Public Sub PurgeUndo_Example()

 Application.PurgeUndo

End Sub


InvisibleApp.QueueMarkerEvent Method (Visio)

 Copy code hover
[image]

InvisibleApp.QueueMarkerEvent Method (Visio)
Send feedback

Published: July 16, 2012

Queues a MarkerEvent event that fires after all other queued events.

Version Information

Version Added: Visio 5.0

Syntax

expression .QueueMarkerEvent(ContextString, lpi4Ret)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
ContextString | Required | String | An arbitrary string that is passed with the event that fires.

Return Value

Long

Remarks

The QueueMarkerEvent method works in conjunction with the MarkerEvent event to allow an Automation client to queue an event to itself. The QueueMarkerEvent method causes the application to fire a MarkerEvent event after it has fired all the events in its event queue.

The QueueMarkerEvent method returns the sequence number of the MarkerEvent event to fire, and the string passed to the QueueMarkerEvent method (legally empty) is passed to the MarkerEvent event handler.

A client program can use either the sequence number or the string to correlate QueueMarkerEvent calls with MarkerEvent events. In this way, the client is able to distinguish events it caused and events it did not cause.

Example

Paste this example code into the ThisDocument object and then run the UseMarker procedure. The output will be displayed in the Microsoft Visual Basic for Applications (VBA) Immediate window.

VBA Copy code Copy code

Dim WithEvents vsoApplication As Visio.Application

Private Sub vsoApplication_MarkerEvent(ByVal app As Visio.IVApplication, _
 ByVal SequenceNum As Long, ByVal ContextString As String)

 Debug.Print "Marker: " & app.EventInfo(0)

End Sub

Private Sub vsoApplication_ShapeAdded(ByVal Shape As Visio.IVShape)

 Debug.Print " ShapeAdded: " & Shape.Name

End Sub

Public Sub UseMarker()

 Set vsoApplication = ThisDocument.Application

 'Marker events can be used to comment a segment
 'of events in the queue.
 vsoApplication.QueueMarkerEvent "I am starting..."
 ActivePage.DrawRectangle 0, 0, 3, 3
 vsoApplication.QueueMarkerEvent "I am finished..."

End Sub

The output in the VBA Immediate window looks like this:

Marker: I am starting...

ShapeAdded: Sheet.1

Marker: I am finished...


InvisibleApp.Quit Method (Visio)

 Copy code hover
[image]

InvisibleApp.Quit Method (Visio)
Send feedback

Published: July 16, 2012

Closes the indicated instance of Microsoft Visio.

Version Information

Version Added: Visio 2.0

Syntax

expression .Quit

expression A variable that represents an InvisibleApp object.

Return Value

nothing

Remarks

If the Quit method is invoked when any open document has unsaved changes, a dialog box appears asking if you want to save the document. To quit the application without saving and seeing the dialog box, set the Saved property of the Document object representing the document to True immediately before quitting. Set the Saved property to True only if you are sure you want to close the document without saving changes, because you will lose any unsaved changes.


InvisibleApp.Redo Method (Visio)

 Copy code hover
[image]

InvisibleApp.Redo Method (Visio)
Send feedback

Published: July 16, 2012

Reverses the most recent undo unit.

Version Information

Version Added: Visio 2.0

Syntax

expression .Redo

expression A variable that represents an InvisibleApp object.

Return Value

nothing

Remarks

To reverse the effect of the Undo method, use the Redo method. For example, if you clear an item and then use the Undo method to restore it, use the Redo method to clear the item again.

You cannot invoke the Redo method from code that is executing inside the scope of an open undo unit. Code is in the scope of an open undo unit if it is one of the following:

  • A macro or add-on invoked by the Microsoft Visio user interface.

  • In an event handler responding to a Visio event other than the VisioIsIdle event.

  • In a user-created undo scope. If you call the Redo method from code inside the scope of an open undo unit, it will raise an exception.

The Redo method also raises an exception if the Visio instance is presently performing an undo or redo. To determine whether the Visio instance is undoing or redoing use the IsUndoingOrRedoing property.

You can call the Redo method from the VisioIsIdle event handler because the VisioIsIdle event can only fire when the IsUndoingOrRedoing property is False. You can also call the Redo method from code not invoked by the Visio instance, for example, code invoked from the Visual Basic Editor or from an external program.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to undo and redo actions.

VBA Copy code Copy code

Public Sub Redo_Example()

 Dim vsoShape As Visio.Shape

 'Draw a rectangle, use Undo to delete it, and
 'then use Redo to redraw it.
 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)

 'Delete the shape.
 Visio.Application.Undo

 'Bring it back.
 Visio.Application.Redo

End Sub


InvisibleApp.RegisterRibbonX Method (Visio)

 Copy code hover
[image]

InvisibleApp.RegisterRibbonX Method (Visio)
Send feedback

Published: July 16, 2012

Registers the IRibbonExtensibility interface that is implemented by the specified add-on to populate the custom user interface (UI).

Version Information

Version Added: Visio 2010

Syntax

expression .RegisterRibbonX(SourceAddOn, TargetDocument, TargetModes, FriendlyName)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
SourceAddOn | Required | IRibbonExtensibility | The add-on to register.
TargetDocument | Required | Document | The document that uses the custom UI.
TargetModes | Required | VisRibbonXModes | The modes in which the custom UI should be visible. See Remarks for possible values.
FriendlyName | Required | String | The name to associate with the UI items and errors that originate in the add-on.

Return Value

HRESULT

Remarks

If TargetDocument is null, the custom UI is defined at the level of the application. Otherwise, Microsoft Visio binds the visibility of the custom UI to the specified document. The UI does not appear in conjunction with any other document.

TargetModes can be one or more of the following VisRibbonXModes constants.

Names | Value | Description
visRxModeNone | 0 | Display the custom UI when no documents are open.
visRxModeDrawing | 1 | Display the custom UI in Drawing mode.
visRxModeStencil | 2 | Display the custom UI in Stencil mode.
visRxModePrintPreview | 4 | Display the custom UI in Print Preview mode.

If FriendlyName is null, the method fails.


InvisibleApp.RenameCurrentScope Method (Visio)

 Copy code hover
[image]

InvisibleApp.RenameCurrentScope Method (Visio)
Send feedback

Published: July 16, 2012

Renames the top-level open undo scope.

Version Information

Version Added: Visio 2002

Syntax

expression .RenameCurrentScope(bstrScopeName)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
bstrScopeName | Required | String | The new name of the undo scope.

Return Value

nothing

Remarks

The new name assigned to the undo scope appears on the Undo menu as the item name. If there is no open undo scope, the RenameCurrentScope method raises an exception.


InvisibleApp.SetCustomMenus Method (Visio)

 Copy code hover
[image]

InvisibleApp.SetCustomMenus Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the current built-in or custom menus of an application or document.

Version Information

Version Added: Visio 4.0

Syntax

expression .SetCustomMenus(MenusObject)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
MenusObject | Required | [IVUIOBJECT] | An expression that returns a UIObject object that represents the new custom menus.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the UIObject object was created in a separate process by using the CreateObject procedure instead of getting the appropriate property of an Application or Document object, the SetCustomMenus method returns an error.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to add a menu and menu item to the user interface, and then replace the built-in menu set with the custom set.

To restore the Microsoft Visio built-in user interface after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub SetCustomMenus_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UI object that represents the Microsoft Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a Demo menu.
 Set vsoMenu = vsoMenus.AddAt(1)
 vsoMenu.Caption = "Demo"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new Demo menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the properties for the new menu item.
 vsoMenuItem.Caption = "&Hello"
 vsoMenuItem.AddOnName = "MsgBox ""Hello"""

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


InvisibleApp.SetCustomToolbars Method (Visio)

 Copy code hover
[image]

InvisibleApp.SetCustomToolbars Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the current built-in or custom toolbars of an application or document.

Version Information

Version Added: Visio 4.0

Syntax

expression .SetCustomToolbars(ToolbarsObject)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
ToolbarsObject | Required | [IVUIOBJECT] | An expression that returns a UIObject object that represents the new custom toolbars.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the ToolbarsObject object was created in a separate process by using the VBA CreateObject method instead of getting the appropriate property of an Application or Document object, the SetCustomToolbars method returns an error.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the SetCustomToolbars method to replace the built-in toolbar set with the custom set. It retrieves a copy of the built-in Visio toolbars, adds a toolbar and a toolbar button, sets the button icon, and then replaces the toolbar set.

Before running this macro, replace path\filename in the code with the full path to and filename of an icon file (.ico) on your computer.

VBA Copy code Copy code
Public Sub SetCustomToolbarItems_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbar As Visio.Toolbar
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Create a new toolbar
 Set vsoToolbar = vsoToolbarSet.Toolbars.Add

 With vsoToolbar
 .Caption = "test"
 .Position = visBarFloating
 .Left = 300
 .Top = 200

 .Protection = visBarNoHorizontalDock
 .Visible = True
 .Enabled = True
 End With

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbar.ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = visCmdPanZoom

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


InvisibleApp.SetPreviewEnabled Method (Visio)

 Copy code hover
[image]

InvisibleApp.SetPreviewEnabled Method (Visio)
Send feedback

Published: July 16, 2012

Turns preview on or off for a gallery in the Microsoft Visio user interface.

Version Information

Version Added: Visio 2010

Syntax

expression .SetPreviewEnabled(GalleryName, OnOrOff)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
GalleryName | Required | String | The name of the gallery for which to set the preview status.
OnOrOff | Required | Boolean | True to turn preview on for the specified gallery; False to turn preview off.

Return Value

Nothing

Remarks

For the GalleryName parameter, you must pass the control ID for the specified gallery. You can find a list of control IDs for all Visio galleries by searching the MSDN library at http://msdn.microsoft.com/library.


InvisibleApp.Undo Method (Visio)

 Copy code hover
[image]

InvisibleApp.Undo Method (Visio)
Send feedback

Published: July 16, 2012

Reverses the most recent undo unit, if the undo unit can be reversed.

Version Information

Version Added: Visio 2.0

Syntax

expression .Undo

expression A variable that represents an InvisibleApp object.

Return Value

Nothing

Remarks

Use the Undo method to reverse actions one undo unit at a time.

The number of times that code can call the Undo method depends on whether or not the code is executing in the scope of an open undo unit. Code runs in the scope of an open undo unit if it is:

  • A macro or add-on invoked by the Microsoft Visio user interface.

  • In an event handler responding to a Visio event other than the VisioIsIdle event.

  • In a user-created undo scope.

If code is not executing in the scope of an open undo unit, it can call the Undo method for each undo unit presently on the Visio undo stack. You can set the maximum number of units on the undo stack (20 is the default) on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options). If the number of calls to the Undo method exceeds the number of undo units on the stack, no action is taken and the Undo method raises no exception.

If code is executing in the scope of an open undo unit, it can call the Undo method once for each operation in the open undo unit. If there are additional calls to the Undo method, it raises an exception and takes no action. For example, if code in a macro performs two operations, it can call the Undo method twice. If the macro calls the Undo method a third time, the Undo method raises an exception.

Code that calls the Undo method from within the scope of an undo unit cannot call the Redo method to reverse the action. The Redo method can only be called when there are no open undo units.

The Undo method also raises an exception if the Visio instance is presently performing an undo or redo. To determine whether the Visio instance is undoing or redoing, use the IsUndoingOrRedoing property.

You can call the Undo method from the VisioIsIdle event handler because the VisioIsIdle event can only fire when the IsUndoingOrRedoing property is False. You can also call the Undo method from code not invoked by the Visio instance, for example, code invoked from the Visual Basic Editor or from an external program.

You can undo most actions, but not all. Use the Redo method to reverse the effect of the Undo method.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to undo and redo actions.

VBA Copy code Copy code

Public Sub Undo_Example()

    Dim vsoShape As Visio.Shape

    'Draw a rectangle, use Undo to delete it, and
    'then use Redo to redraw it.
    Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)

    'Delete the shape.
    Visio.Application.Undo

    'Bring it back.
    Visio.Application.Redo

End Sub


InvisibleApp.UnregisterRibbonX Method (Visio)

 Copy code hover
[image]

InvisibleApp.UnregisterRibbonX Method (Visio)
Send feedback

Published: July 16, 2012

Unregisters a previouly registered IRibbonExtensiblity interface that a Microsoft Visio add-in implements.

Version Information

Version Added: Visio 2010

Syntax

expression .UnregisterRibbonX(SourceAddOn, TargetDocument)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
SourceAddOn | Required | IRibbonExtensibility | The add-in to unregister.
TargetDocument | Required | Document | The document in which to unregister the add-in.

Return Value

HRESULT


InvisibleApp Events (Visio)

 Copy code hover
[image]

InvisibleApp Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
AfterModal | Occurs after the Microsoft Visio instance leaves a modal state.
AfterRemoveHiddenInformation | Occurs when hidden information is removed from the document.
AfterReplaceShapes | Occurs after a shape-replacement operation.
AfterResume | Occurs when the operating system resumes normal operation after having been suspended.
AfterResumeEvents | Occurs after firing of events is resumed.
AppActivated | Occurs after a Microsoft Visio instance becomes active.
AppDeactivated | Occurs after a Microsoft Visio instance becomes inactive.
AppObjActivated | Occurs after a Microsoft Visio instance becomes active.
AppObjDeactivated | Occurs after a Microsoft Visio instance becomes inactive.
BeforeDataRecordsetDelete | Occurs before a DataRecordset object is deleted from the DataRecordsets collection.
BeforeDocumentClose | Occurs before a document is closed.
BeforeDocumentSave | Occurs before a document is saved.
BeforeDocumentSaveAs | Occurs just before a document is saved by using the Save As command.
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforeModal | Occurs before a Microsoft Visio instance enters a modal state.
BeforePageDelete | Occurs before a page is deleted.
BeforeQuit | Occurs before a Microsoft Visio instance terminates.
BeforeReplaceShapes | Occurs just before a shape-replacement operation.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
BeforeStyleDelete | Occurs before a style is deleted.
BeforeSuspend | Occurs before the operating system enters a suspended state.
BeforeSuspendEvents | Occurs before firing of events is suspended.
BeforeWindowClosed | Occurs before a window is closed.
BeforeWindowPageTurn | Occurs before a window is about to show a different page.
BeforeWindowSelDelete | Occurs before the shapes in the selection of a window are deleted.
CalloutRelationshipAdded | Occurs when a new callout relationship is added to the application.
CalloutRelationshipDeleted | Occurs when a callout relationship is deleted from the application.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ContainerRelationshipAdded | Occurs when a new container relationship is added to the document.
ContainerRelationshipDeleted | Occurs when a container relationship is deleted from the document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
DataRecordsetAdded | Occurs when a DataRecordset object is added to a DataRecordsets collection.
DataRecordsetChanged | Occurs when a data recordset changes as a result of being refreshed.
DesignModeEntered | Occurs before a document enters design mode.
DocumentChanged | Occurs after certain properties of a document are changed.
DocumentCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.
DocumentCreated | Occurs after a document is created.
DocumentOpened | Occurs after a document is opened.
DocumentSaved | Occurs after a document is saved.
DocumentSavedAs | Occurs after a document is saved by using the Save As command.
EnterScope | Queued when an internal command begins, or when an Automation client opens a scope by using the BeginUndoScope method.
ExitScope | Queued when an internal command ends, or when an automation client exits a scope by using the EndUndoScope method.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
KeyDown | Occurs when a keyboard key is pressed.
KeyPress | Occurs when a keyboard key is pressed.
KeyUp | Occurs when a keyboard key is released.
MarkerEvent | Caused by calling the QueueMarkerEvent method.
MasterAdded | Occurs after a new master is added to a document.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
MouseDown | Occurs when a mouse button is clicked.
MouseMove | Occurs when the mouse is moved.
MouseUp | Occurs when a mouse button is released.
MustFlushScopeBeginning | Occurs before the Microsoft Visio instance is forced to flush its event queue.
MustFlushScopeEnded | Occurs after the Microsoft Visio instance is forced to flush its event queue.
NoEventsPending | Occurs after the Microsoft Visio instance flushes its event queue.
OnKeystrokeMessageForAddon | Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.
PageAdded | Occurs after a new page is added to a document.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelDocumentClose | Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelQuit | Occurs before the application terminates in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelReplaceShapes | Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSuspend | Occurs before the operating system enters a suspended state. If any event handler returns True, the Microsoft Visio instance will deny the operating system's request.
QueryCancelSuspendEvents | Occurs before the application suspends events in response to a client code. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelWindowClose | Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QuitCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelQuit event.
ReplaceShapesCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.
RuleSetValidated | Occurs when a rule set is validated.
RunModeEntered | Occurs after a document enters run mode.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionChanged | Occurs after a set of shapes selected in a window changes.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
StyleAdded | Occurs after a new style is added to a document.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.
SuspendCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSuspend event.
SuspendEventsCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSuspendEvents event. .
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.
ViewChanged | Occurs when the zoom level or scroll position of a drawing window changes.
VisioIsIdle | Occurs after the application empties its message queue.
WindowActivated | Occurs after the active window changes in a Microsoft Visio instance.
WindowChanged | Occurs when the size or position of a window changes.
WindowCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.
WindowOpened | Occurs after a window is opened.
WindowTurnedToPage | Occurs after a window shows a different page.


InvisibleApp.AfterModal Event (Visio)

 Copy code hover
[image]

InvisibleApp.AfterModal Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the Microsoft Visio instance leaves a modal state.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _AfterModal(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance that is no longer modal.

Remarks

Visio becomes modal when it displays a dialog box. A modal instance of Visio does not handle Automation calls. The BeforeModal event indicates that the instance is about to become modal, and the AfterModal event indicates that the instance is no longer modal.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.AfterRemoveHiddenInformation Event (Visio)

 Copy code hover
[image]

InvisibleApp.AfterRemoveHiddenInformation Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when hidden information is removed from the document.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _AfterRemoveHiddenInformation(ByVal doc As IVDOCUMENT)

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document from which hidden information has been removed.

Remarks

The AfterRemoveHiddenInformation event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the AfterRemoveHiddenInformation event is fired, the EventInfo property returns a string that contains information about which items were removed from the document, consisting of the sum of applicable constant values from the VisRemoveHiddenInfoItems enumeration.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.AfterReplaceShapes Event (Visio)

 Copy code hover
[image]

InvisibleApp.AfterReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs after a shape-replacement operation.

Syntax

expression .AfterReplaceShapes(sel)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data type | Description
sel | Required | IVSELECTION | A Selection object that represents the replacement shape or shapes.

See also

Concepts

InvisibleApp Object

Other resources

InvisibleApp Members


InvisibleApp.AfterResume Event (Visio)

 Copy code hover
[image]

InvisibleApp.AfterResume Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the operating system resumes normal operation after having been suspended.

Version Information

Version Added: Visio 2000 SR-1

Syntax

Private Sub expression _AfterResume(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that resumes after the operating system resumes normal operation.

Remarks

You can use the AfterResume event to reopen any network files that you may have closed in response to the BeforeSuspend event.

If your solution runs outside the Microsoft Visio process, you cannot be assured of receiving this event. For this reason, you should monitor window messages in your program.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.AfterResumeEvents Event (Visio)

 Copy code hover
[image]

InvisibleApp.AfterResumeEvents Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after firing of events is resumed.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _AfterResumeEvents(ByVal app As [IVAPPLICATION],)

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio in which firing of events resumed.

Return Value

nothing

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.AppActivated Event (Visio)

 Copy code hover
[image]

InvisibleApp.AppActivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a Microsoft Visio instance becomes active.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _AppActivated(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that becomes the active application.

Remarks

The AppActivated event indicates that an instance of Visio has become the active application on the Microsoft Windows desktop. The AppActivated event is different from the AppObjectActivated event, which occurs after an instance of Visio becomes active—the instance of Visio that is retrieved by the GetObject method in a Microsoft Visual Basic program.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.AppDeactivated Event (Visio)

 Copy code hover
[image]

InvisibleApp.AppDeactivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a Microsoft Visio instance becomes inactive.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _AppDeactivated(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is no longer the active application.

Remarks

The AppDeactivated event indicates that an instance of Visio is no longer the active application on the Microsoft Windows desktop. The AppDeactivated event is different from the AppObjectDeactivated event, which occurs after an instance of Visio ceases to be the active instance—the instance of Visio that is retrieved by the GetObject method in a Microsoft Visual Basic program.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.AppObjActivated Event (Visio)

 Copy code hover
[image]

InvisibleApp.AppObjActivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a Microsoft Visio instance becomes active.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _AppObjActivated(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that has become the active instance.

Remarks

The AppObjActivated event indicates that an instance of Visio has become active—the instance of Visio that is retrieved by the GetObject method in a Microsoft Visual Basic program. The AppObjActivated event is different from the AppActivated event, which occurs after an instance of Visio becomes the active application on the Microsoft Windows desktop.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.AppObjDeactivated Event (Visio)

 Copy code hover
[image]

InvisibleApp.AppObjDeactivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a Microsoft Visio instance becomes inactive.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _AppObjDeactivated(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is no longer the active instance.

Remarks

The AppObjDeactivated event indicates that the instance of Visio is no longer the active instance of Visio—the instance of Visio that is retrieved by the GetObject method in a Microsoft Visual Basic program. The AppObjDeactivated event is different from the AppDeactivated event, which occurs after an instance of Visio is no longer the active instance on the Microsoft Windows desktop.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeDataRecordsetDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeDataRecordsetDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a DataRecordset object is deleted from the DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _BeforeDataRecordsetDelete(ByVal DataRecordset As IVDATARECORDSET)

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeDocumentClose Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeDocumentClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document is closed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeDocumentClose(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeDocumentSave Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeDocumentSave Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document is saved.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _BeforeDocumentSave(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be saved.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeDocumentSaveAs Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeDocumentSaveAs Event (Visio)
Send feedback

Published: July 16, 2012

Occurs just before a document is saved by using the Save As command.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _BeforeDocumentSaveAs(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be saved.

Remarks

The BeforeDocumentSaveAs event fires when a document is saved to either a native format (for example, VSD or VDX) or a non-native format (for example, HTM or BMP). It does not fire when a document is saved to DWG, DXF, and DGN formats. To save a document in a non-native format programmatically, you must use the Export method of the Page object. Note that when you call the SaveAs method, Microsoft Visio fires first the BeforeDocumentSaveAs event and then the DocumentSavedAs event. Calling the Export method, however, fires the BeforeDocumentSaveAs event but not the DocumentSavedAs event that follows it in response to the SaveAs method.

The BeforeDocumentSaveAs event is one of a group of events for which the EventInfo property of the Application object contains extra information.

If the BeforeDocumentSaveAs event is fired because a save was initiated by a user or a program, the EventInfo property returns the following string:

"/saveasfile=<filename>"

If it fires because Visio is saving a copy of an open file (for autorecovery or to include as a mail attachment), the EventInfo property will return one of the following strings:

  • If the event is fired for autorecovery purposes, the name of a recovery file in this format: "/autosavefile=C:\TEMP\~$2VSO2FD.vsd"

  • If the event is fired because a document copy is being made to send as a mail attachment, the name of an attachment file in this format: "/mailfile=C:\TEMP\~$2VSO2FD.vsd"

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection by using the AddAdvise method, the vMoreInfo argument to VisEventProc designates the document index: "/doc=1".


InvisibleApp.BeforeMasterDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a master is deleted from a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeModal Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeModal Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a Microsoft Visio instance enters a modal state.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeModal(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is going to enter a modal state.

Remarks

Visio becomes modal when it displays a dialog box. A modal instance of Visio does not handle Automation calls. The BeforeModal event indicates that an instance is about to become modal, and the AfterModal event indicates that the instance is no longer modal.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforePageDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforePageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a page is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforePageDelete(ByVal Page As [IVPAGE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeQuit Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeQuit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a Microsoft Visio instance terminates.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeQuit(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is going to terminate.

Remarks

When programming with Microsoft Visual Basic, use the BeforeDocumentClose event instead of the BeforeQuit event. The code in a Visual Basic project of a Visio document never has the chance to respond to the BeforeQuit event because the project is a property of a document, and all documents are closed before the BeforeQuit event notification is sent.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeReplaceShapes Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs just before a shape-replacement operation.

Syntax

expression .BeforeReplaceShapes(replaceShapes)

expression A variable that represents a InvisibleApp object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.

See also

Concepts

InvisibleApp Object

Other resources

InvisibleApp Members


InvisibleApp.BeforeSelectionDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before selected objects are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selected objects that are going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. To find out if a shape is locked against deletion, check the value of its LockDelete cell.

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeShapeDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeShapeDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is deleted.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeShapeDelete(ByVal Shape As [IVSHAPE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeShapeDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use the VBA WithEvents keyword to sink the BeforeShapeDelete event.

For performance considerations, the Document object's event set does not include the BeforeShapeDelete event. To sink the BeforeShapeDelete event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


InvisibleApp.BeforeShapeTextEdit Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeShapeTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is opened for text editing in the user interface.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _BeforeShapeTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be opened for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeStyleDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a style is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeSuspend Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeSuspend Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the operating system enters a suspended state.

Version Information

Version Added: Visio 2000 SR-1

Syntax

Private Sub expression _BeforeSuspend(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is going to be suspended.

Remarks

Client programs should close any open network files when this event is fired.

If your solution runs outside the Microsoft Visio process, you cannot be assured of receiving this event. For this reason, you should monitor window messages in your program.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeSuspendEvents Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeSuspendEvents Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before firing of events is suspended.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _BeforeSuspendEvents(ByVal app As [IVAPPLICATION] )

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio in which firing of events is going to be suspended.

Return Value

nothing

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeWindowClosed Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeWindowClosed Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a window is closed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeWindowClosed(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeWindowPageTurn Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeWindowPageTurn Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a window is about to show a different page.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeWindowPageTurn(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to show a different page.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.BeforeWindowSelDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.BeforeWindowSelDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the shapes in the selection of a window are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeWindowSelDelete(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that contains the selection that is going to be deleted.

Remarks

The BeforeWindowSelDelete event fires if user interactions cause shapes in a window to be deleted. It doesn't fire if a program deletes shapes in a window by using the Cut method, for example.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.CalloutRelationshipAdded Event (Visio)

 Copy code hover
[image]

InvisibleApp.CalloutRelationshipAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a new callout relationship is added to the application.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _CalloutRelationshipAdded(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the new callout shape-pair relationship.

Remarks

The RelatedShapePairEvent object returned by this event contains two shapes: the callout, represented by the FromShapeID property of the RelatedShapePairEvent object; and the target shape, represented by the ToShapeID property.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


InvisibleApp.CalloutRelationshipDeleted Event (Visio)

 Copy code hover
[image]

InvisibleApp.CalloutRelationshipDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a callout relationship is deleted from the application.

Syntax

Private Sub expression _CalloutRelationshipDeleted(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the callout shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively. When Microsoft Visio deletes both shapes in the container relationship simultaneously, for example when both shapes are deleted from a drawing as part of a selection, the event does not fire.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


InvisibleApp.CellChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


InvisibleApp.ConnectionsAdded Event (Visio)

 Copy code hover
[image]

InvisibleApp.ConnectionsAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections have been established between shapes.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsAdded(ByVal Connects As [IVCONNECTS])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that were established.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsAdded event. To sink the ConnectionsAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


InvisibleApp.ConnectionsDeleted Event (Visio)

 Copy code hover
[image]

InvisibleApp.ConnectionsDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections between shapes have been removed.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsDeleted(ByVal Connects As [IVCONNECTS])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that have been removed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsDeleted event. To sink the ConnectionsDeleted event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


InvisibleApp.ContainerRelationshipAdded Event (Visio)

 Copy code hover
[image]

InvisibleApp.ContainerRelationshipAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a new container relationship is added to the document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _ContainerRelationshipAdded(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the new container shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


InvisibleApp.ContainerRelationshipDeleted Event (Visio)

 Copy code hover
[image]

InvisibleApp.ContainerRelationshipDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a container relationship is deleted from the document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _ContainerRelationshipDeleted(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the container shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively. When Microsoft Visio deletes both shapes in the container relationship simultaneously, for example when both shapes are deleted from a drawing as part of a selection, the event does not fire.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


InvisibleApp.ConvertToGroupCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.ConvertToGroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ConvertToGroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.DataRecordsetAdded Event (Visio)

 Copy code hover
[image]

InvisibleApp.DataRecordsetAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a DataRecordset object is added to a DataRecordsets collection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetAdded(ByVal DataRecordset As [IVDATARECORDSET])

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordset | Required | [IVDATARECORDSET] | The data recordset that was added.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.DataRecordsetChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.DataRecordsetChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a data recordset changes as a result of being refreshed.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _DataRecordsetChanged(ByVal DataRecordsetChanged As IVDATARECORDSETCHANGEDEVENT)

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetChanged | Required | [IVDATARECORDSETCHANGEDEVENT] | The data recordset that changed.

Remarks

When the DataRecordsetChanged event fires, the DataRecordsetChangedEvent object is passed to the IVisEventProc.VisEventProc method as the pSubjectObj parameter, which represents he subject of the event—the object to which the event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.DesignModeEntered Event (Visio)

 Copy code hover
[image]

InvisibleApp.DesignModeEntered Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a document enters design mode.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _DesignModeEntered(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to enter design mode.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.DocumentChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.DocumentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after certain properties of a document are changed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentChanged(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document whose properties were changed.

Remarks

The DocumentChanged event indicates that one of a document's properties, such as Author or Description, has changed.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.DocumentCloseCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.DocumentCloseCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _DocumentCloseCanceled(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.DocumentCreated Event (Visio)

 Copy code hover
[image]

InvisibleApp.DocumentCreated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is created.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentCreated(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was created.

Remarks

The DocumentCreated event is often added to the EventList collection of a Microsoft Visio template file (.vst). The event's action is triggered whenever a new document is created based on that template.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

You can add DocumentCreated events to the EventList collection of an Application object, Documents collection, or Document object. The first two are straightforward; if a document is opened or created in the scope of the Application object or its Documents collection, the DocumentCreated event occurs.

However, adding a DocumentCreated event to the EventList collection of a Document object makes sense only if the event's action is visActCodeRunAddon. In this case, the event is persistable; it can be stored with the document. If the document that contains the persistent event is opened, its action is triggered. If a new document is based on or copied from the document that contains the persistent event, the DocumentCreated event is copied to the new document and its action is triggered. However, if the event's action is visActCodeAdvise, that event is not persistable and therefore is not stored with the document; hence, it is never triggered.

You can prevent code from running in response to the DocumentCreated, DocumentOpened, or DocumentAdded event and all events from firing by setting the value of the EventsEnabled property of an Application object to False.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square.

The DocumentCreated event handler runs when a new drawing based on the template that contains this code is created. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentCreated(ByVal vsoDocument As Visio.IVDocument)

'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 'the shape was created locally.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


InvisibleApp.DocumentOpened Event (Visio)

 Copy code hover
[image]

InvisibleApp.DocumentOpened Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is opened.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentOpened(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was opened.

Remarks

The DocumentOpened event is often added to the EventList collection of a Microsoft Visio template file (.vst). The event's action is triggered whenever an existing document is opened.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

You can add DocumentOpened events to the EventList collection of an Application object, Documents collection, or Document object. The first two are straightforward—if a document is opened or created in the scope of the Application object or its Documents collection, the DocumentOpened event occurs.

However, adding a DocumentOpened event to the EventList collection of a Document object makes sense only if the event's action is visActCodeRunAddon. In this case, the event is persistable—it can be stored with the document. If the document that contains the persistent event is opened, its action is triggered. If a new document is based on or copied from the document that contains the persistent event, the DocumentOpened event is copied to the new document and its action is triggered. However, if the event's action is visActCodeAdvise, that event is not persistable and therefore is not stored with the document; hence it is never triggered.

You can prevent code from running in response to the DocumentCreated, DocumentOpened or DocumentAdded event and all events from firing by setting the value of the EventsEnabled property of an Application object to False.


InvisibleApp.DocumentSaved Event (Visio)

 Copy code hover
[image]

InvisibleApp.DocumentSaved Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is saved.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentSaved(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was saved.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


InvisibleApp.DocumentSavedAs Event (Visio)

 Copy code hover
[image]

InvisibleApp.DocumentSavedAs Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document is saved by using the Save As command.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _DocumentSavedAs(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that was saved.

Remarks

The DocumentSavedAs event is one of a group of events for which the EventInfo property of the Application object contains extra information.

If the DocumentSavedAs event is fired because a save was initiated by a user or a program, the EventInfo property returns the following string:

"/saveasfile=<filename>"

If it fires because Microsoft Visio is saving a copy of an open file (for autorecovery or to include as a mail attachment), the EventInfo property returns one of the following strings:

  • If the event is fired for autorecovery purposes, the name of a recovery file in this format: "/autosavefile=drivename:\foldername\filename"

  • If the event is fired because a document copy is being made to send as a mail attachment, the name of an attachment file in this format: "/mailfile=drivename:\foldername\filename"

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection created by using the AddAdvise method, the varMoreInfo argument to VisEventProc designates the document index: "/doc=1".


InvisibleApp.EnterScope Event (Visio)

 Copy code hover
[image]

InvisibleApp.EnterScope Event (Visio)
Send feedback

Published: July 16, 2012

Queued when an internal command begins, or when an Automation client opens a scope by using the BeginUndoScope method.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _EnterScope(ByVal app As [IVAPPLICATION], ByVal nScopeID As Long, ByVal bstrDescription As String)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that contains the scope.
nScopeID | Required | Long | A language-independent number that describes the operation that just ended, or the scope ID returned by the BeginUndoScope method.
bstrDescription | Required | String | A textual description of the operation that changes in different language versions. Contains the user interface description of a Visio operation or the description passed to the BeginUndoScope method.

Remarks

The nScopeID value returned in the case of a Visio operation is the equivalent of the command-related constants that begin with visCmd*.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection created by using the AddAdvise method, the EnterScope event is one of a group of selected events that record extra information in the EventInfo property of the Application object.

The EventInfo property returns bstrDescription, as described above. In addition, the varMoreInfo argument to VisEventProc contains a string formatted as follows: [<nScopeID>;<bErrOrCancelled>;<bstrDescription>;<nHwndContext>], where nHwndContext is the window handle (HWND) of the window that is the context for the command. nHwndContext could be 0.

For EnterScope, bErrOrCancelled always equals zero.

Example

This example shows how to use the EnterScope event. The example determines whether a call to a procedure that handles the CellChanged event is in a particular scope—that is, whether the call occurs between the EnterScope and ExitScope events for that scope.

VBA Copy code Copy code
Private WithEvents vsoApplication As Visio.Application

Private lngScopeID As Long

Public Sub Scope_Example()

 Dim vsoShape As Visio.Shape

 'Set the module-level application variable to
 'trap application-level events.
 Set vsoApplication = Application

 'Begin a scope.
 lngScopeID = Application.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 Application.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering my scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting my scope " & nScopeID
 Else
 Debug.Print "Exit Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


InvisibleApp.ExitScope Event (Visio)

 Copy code hover
[image]

InvisibleApp.ExitScope Event (Visio)
Send feedback

Published: July 16, 2012

Queued when an internal command ends, or when an automation client exits a scope by using the EndUndoScope method.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ExitScope(ByVal app As [IVAPPLICATION], ByVal nScopeID As Long, ByVal bstrDescription As String, ByVal bErrOrCancelled As Boolean)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that contains the scope.
nScopeID | Required | Long | A language-independent number that describes the operation that just ended or the scope ID returned by the BeginUndoScope method.
bstrDescription | Required | String | A textual description of the operation that changes in different language versions. Contains the UI description of a Visio operation or the description passed to the BeginUndoScope method.
bErrOrCancelled | Required | Boolean | True if there was an error during the scope or if the scope was canceled; False if there wasn't an error and it wasn't canceled.

Remarks

The nScopeID value returned in the case of a Visio operation is the equivalent of the command-related constants that begin with visCmd*.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection created using the AddAdvise method, the ExitScope event is one of a group of selected events that record extra information in the EventInfo property of the Application object.

The EventInfo property returns bstrDescription, as described previously. In addition, the varMoreInfo argument to VisEventProc contains a string formatted as follows: [<nScopeID>;<bErrOrCancelled>;<bstrDescription>;<nHwndContext>], where nHwndContext is the window handle (HWND) of the window that is the context for the command. nHwndContext could be 0.

For ExitScope, bErrOrCancelled is non-zero if the operation failed or was canceled.

Example

This example shows how to use the ExitScope event. The example determines whether a call to a procedure that handles the CellChanged event is in a particular scope—that is, whether the call occurs between the EnterScope and ExitScope events for that scope.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application
Private lngScopeID AsLong

Public Sub Scope_Example()

 Dim vsoShape As Visio.Shape

 'Set the module-level application variable to
 'trap application-level events.
 Set vsoApplication = Application

 'Begin a scope.
 lngScopeID = Application.BeginUndoScope("Draw Shapes")

 'Draw three shapes.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)
 ActivePage.DrawOval 3, 4, 4, 3
 ActivePage.DrawLine 4, 5, 5, 4

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

 'End and commit this scope.
 Application.EndUndoScope lngScopeID, True

End Sub

Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell)

 'Check to see if this cell change is the result of something
 'happening within the scope.
 If vsoApplication.IsInScope(lngScopeID) Then
 Debug.Print Cell.Name & " changed in scope "; lngScopeID
 End If

End Sub

Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Entering my scope " & nScopeID
 Else
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub

Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _
 ByVal nScopeID As Long, _
 ByVal bstrDescription As String, _
 ByVal bErrOrCancelled As Boolean)

 If vsoApplication.CurrentScope = lngScopeID Then
 Debug.Print "Exiting my scope " & nScopeID
 Else
 Debug.Print "Exit Scope " & bstrDescription & "(" & nScopeID & ")"
 End If

End Sub


InvisibleApp.FormulaChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


InvisibleApp.GroupCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.GroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _GroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.KeyDown Event (Visio)

 Copy code hover
[image]

InvisibleApp.KeyDown Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is pressed.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, ByVal CancelDefault As Boolean)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | The key that was pressed. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the SHIFT and CTRL keys for the event. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 12, it indicates that the user held down both SHIFT and CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio does not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyDown does not have the prefix "Query," but it is still a query event. That is, you can cancel processing the message sent by KeyDown, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

Note Note

Pressing an accelererator key combination, for example, CTRL + C, does not fire the KeyDown event.

If you are using VBA, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyDown event. In the Immediate window, the handler prints the code of the key that was pressed to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


InvisibleApp.KeyPress Event (Visio)

 Copy code hover
[image]

InvisibleApp.KeyPress Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is pressed.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyPress(ByVal KeyAscii As Long, ByVal CancelDefault As Boolean)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
KeyAscii | Required | Long | The ASCII value of the key that was pressed. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyAscii are the ASCII codes. To see a list of these codes, search for "ASCII character codes" on MSDN.

If you set CancelDefault to True, Visio does not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyPress does not have the prefix "Query," but it is still a query event. That is, you can cancel processing the message sent by KeyPress, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

Note Note

Pressing an accelererator key combination, for example, CTRL + C, does not fire the KeyPress event.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyPress event. In the Immediate window, the handler prints the ASCII code of the key that was pressed to fire the event.


InvisibleApp.KeyUp Event (Visio)

 Copy code hover
[image]

InvisibleApp.KeyUp Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is released.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, ByVal CancelDefault As Boolean)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | The key that was released. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the SHIFT and CTRL keys for the event. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 12, it indicates that the user held down both SHIFT and CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyUp does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by KeyUp, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

If you are using Microsoft Visual Basic or VBA, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, press any key, and then release it to fire a KeyUp event. In the Immediate window, the handler prints the code of the key that was released to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


InvisibleApp.MarkerEvent Event (Visio)

 Copy code hover
[image]

InvisibleApp.MarkerEvent Event (Visio)
Send feedback

Published: July 16, 2012

Caused by calling the QueueMarkerEvent method.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _MarkerEvent(ByVal app As [IVAPPLICATION], ByVal SequenceNum As Long, ByVal ContextString As String)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The active instance of Microsoft Visio.
SequenceNum | Required | Long | The ordinal position of this event with respect to past events.
ContextString | Required | String | Context string passed by the QueueMarkerEvent method.

Remarks

Unlike other events that Visio fires, the MarkerEvent event is fired by a client program. A client program receives the MarkerEvent event only if the client program called the QueueMarkerEvent method.

By using the MarkerEvent event in conjunction with the QueueMarkerEvent method, a client program can queue an event to itself. The client program receives the MarkerEvent event after Visio fires all the events present in its event queue at the time of the QueueMarkerEvent call.

The MarkerEvent event passes both the context string that was passed by the QueueMarkerEvent method and the sequence number of the MarkerEvent event to the MarkerEvent event handler. Either of these values can be used to correlate QueueMarkerEvent calls with MarkerEvent events. In this way, a client program can distinguish events it caused from those it did not cause.

For example, a client program that changes the values of Visio cells may only want to respond to the CellChanged events that it did not cause. The client program can first call the QueueMarkerEvent method and pass a context string for later use to bracket the scope of its processing:

VBA Copy code Copy code

vsoObject.QueueMarkerEvent "ScopeStart"
 <My program changes cells here>
vsoObject.QueueMarkerEvent "ScopeEnd"

Then, in the MarkerEvent event handler, the client program could use the context string passed to the QueueMarkerEvent method to identify the CellChanged events that it caused:

VBA Copy code Copy code

Dim blsICausedCellChanges as Boolean

Private Sub vsoObject_MarkerEvent (ByVal vsoApplication As Visio.IVApplication, _
 ByVal lngSequenceNum As Long, ByVal strContextString As String)

 If strContextString = "ScopeStart" Then
 blsICausedCellChanges = True
 ElseIf strContextString = "ScopeEnd" Then
 blsICausedCellChanges = "False"
 End If

End Sub

Private Sub vsoObject_CellChanged (ByVal Cell As Visio.IVCell)

 'Respond only if this client didn't cause a cell change.
 If blsICausedCellChanges = False Then
 <respond to the cell changes>
 End If

End Sub

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification, the MarkerEvent event is one of one of a group of events that record extra information in the EventInfo property of the Application object.

The EventInfo property returns ContextString as described above. The varMoreInfo argument to VisEventProc will be empty.

Example

This example shows how to use the MarkerEvent event to mark an event in the event queue.

Paste this example code into the ThisDocument code window and then run UseMarker. The output will be displayed in the Immediate window.

VBA Copy code Copy code

Dim WithEvents vsoApplication As Visio.Application

Private Sub vsoApplication_MarkerEvent(ByVal app As Visio.IVApplication, _
 ByVal lngSequenceNum As Long, ByVal strContextString As String)
 Debug.Print "Marker: " & app.EventInfo(0)

End Sub

Private Sub vsoApplication_ShapeAdded(ByVal vsoShape As Visio.IVShape)
 Debug.Print " ShapeAdded: " & vsoShape.Name

End Sub

Public Sub UseMarker()

 Set vsoApplication = ThisDocument.Application

 'MarkerEvent events can be used to comment a segment
 'of events in the queue.
 vsoApplication.QueueMarkerEvent "I am starting..."
 ActivePage.DrawRectangle 0, 0, 3, 3
 vsoApplication.QueueMarkerEvent "I am finished..."

End Sub

The output in the Immediate window looks like this:

Marker: I am starting...

ShapeAdded: Sheet.1

Marker: I am finished...


InvisibleApp.MasterAdded Event (Visio)

 Copy code hover
[image]

InvisibleApp.MasterAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new master is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterAdded(ByVal Master As [IVMASTER])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.MasterChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.MasterChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after properties of a master are changed and propagated to its instances.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterChanged(ByVal Master As [IVMASTER])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master whose properties changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.MasterDeleteCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.MasterDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _MasterDeleteCanceled(ByVal Master As [IVMASTER])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.MouseDown Event (Visio)

 Copy code hover
[image]

InvisibleApp.MouseDown Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a mouse button is clicked.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was pressed. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseDown does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseDown, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseDown event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event.


InvisibleApp.MouseMove Event (Visio)

 Copy code hover
[image]

InvisibleApp.MouseMove Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the mouse is moved.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was clicked. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseMove does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseMove, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then move the mouse briefly in the active window to fire a series of MouseMove events. In the Immediate window, the handler prints a list of x- and y-position value pairs, each of which corresponds to the mouse position when a MouseMove event fired.


InvisibleApp.MouseUp Event (Visio)

 Copy code hover
[image]

InvisibleApp.MouseUp Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a mouse button is released.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was released. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseUp does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseUp, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseUp event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event.


InvisibleApp.MustFlushScopeBeginning Event (Visio)

 Copy code hover
[image]

InvisibleApp.MustFlushScopeBeginning Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the Microsoft Visio instance is forced to flush its event queue.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _MustFlushScopeBeginning(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is forced to flush its event queue.

Remarks

This event, along with the MustFlushScopeEnded event, can be used to identify whether an event is being fired because Visio is forced to flush its event queue.

Visio maintains a queue of pending events that it attempts to fire at discrete moments when it is able to process arbitrary requests (callbacks) from event handlers.

Occasionally, Visio is forced to flush its event queue when it is not prepared to handle arbitrary requests. When this occurs, Visio first fires a MustFlushScopeBeginning event, and then it fires the events that are presently in its event queue. After firing all pending events, Visio fires the MustFlushScopeEnded event.

After Visio has fired the MustFlushScopeBeginning event, client programs should not call Visio methods that have side effects until the MustFlushScopeEnded event is received. A client can perform arbitrary queries of Visio objects when Visio is between the MustFlushScopeBeginning event and MustFlushScopeEnded event, but operations that cause side effects may fail.

Visio performs a forced flush of its event queue immediately prior to firing a "before" event such as BeforeDocumentClose or BeforeShapeDelete because queued events may apply to objects that are about to close or be deleted. Using the BeforeDocumentClose event as an example, there can be queued events that apply to a shape object in the document that is being closed. So, before the document closes, Visio fires all the events in its event queue.

When a shape is deleted, events are fired in the following sequence:

  1. MustFlushScopeBeginning event
    Client should not call methods that have side effects.

  2. There are zero (0) or more events in the event queue.

  3. BeforeShapeDelete event
    Shape is viable, but Visio is going to delete it.

  4. MustFlushScopeEnded event
    Client can resume invoking methods that have side effects.

  5. ShapesDeleted event
    Shape has been deleted.

  6. NoEventsPending event
    No events remain to be fired.

An event is fired both before (BeforeShapeDeleted event) and after (ShapesDeleted event) the shape is deleted. If a program monitoring these events requires that additional shapes be deleted in response to the initial shape deletion, it should do so in the ShapesDeleted event handler, not the BeforeShapeDeleted event handler. The BeforeShapeDeleted event is inside the scope of the MustFlushScopeBeginning event and the MustFlushScopeEnded event, while the ShapesDeleted event is not.

The sequence number of a MustFlushScopeBeginning event may be higher than the sequence number of events the client sees after it has received the MustFlushScopeBeginning event because Visio assigns sequence numbers to events as they occur. Any events that were queued when the forced flush began have a lower sequence number than the MustFlushScopeBeginning event, even though the MustFlushScopeBeginning event fires first.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.MustFlushScopeEnded Event (Visio)

 Copy code hover
[image]

InvisibleApp.MustFlushScopeEnded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the Microsoft Visio instance is forced to flush its event queue.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _MustFlushScopeEnded(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that is forced to flush its event queue.

Remarks

This event, along with the MustFlushScopeBeginning event, can be used to identify whether an event is being fired because Visio is forced to flush its event queue.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.NoEventsPending Event (Visio)

 Copy code hover
[image]

InvisibleApp.NoEventsPending Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the Microsoft Visio instance flushes its event queue.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _NoEventsPending(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that flushed its event queue.

Remarks

Visio maintains a queue of events and fires them at discrete moments. Immediately after Visio fires the last event in its event queue, it fires a NoEventsPending event.

A client program can use the NoEventsPending event as a signal that Visio has completed a burst of activity. For example, a client program may want to react to changes in a shape's geometry. A single user action performed on the shape can generate several CellChanged events. The client program could record selected information for each CellChanged event and perform its processing after it receives the NoEventsPending event.

Visio fires the NoEventsPending event only if at least one of the events in the queue is being listened to. If no program is listening for any of the queued events, the NoEventsPending event does not fire. If your program is only listening to the NoEventsPending event, it does not fire unless another program is listening for some of the queued events.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.OnKeystrokeMessageForAddon Event (Visio)

 Copy code hover
[image]

InvisibleApp.OnKeystrokeMessageForAddon Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.

Version Information

Version Added: Visio 2002

Syntax

Private Sub expression _OnKeystrokeMessageForAddon(ByVal MSG As [IVMSGWRAP])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
MSG | Required | [IVMSGWRAP] | The message that Visio receives.

Remarks

Returns True to indicate that the message was handled by the add-on. Otherwise, returns False.

The OnKeystrokeMessageForAddon event enables add-ons to intercept and process accelerator and keystroke messages directed at their own add-on windows and child windows of their add-on windows. Only add-on windows created using the Add method will source this event.

For this event to fire, the add-on window or one of its child windows must have keystroke focus and the Visio message loop must receive the keystroke message. This event does not fire if the message loop associated with an add-on is handling messages instead of Visio.

Visio fires the OnKeystrokeMessageForAddon event when it receives messages in the following range:

WM_KEYDOWN | 0x0100
WM_KEYUP | 0x0101
WM_CHAR | 0x0102
WM_DEADCHAR | 0x0103
WM_SYSKEYDOWN | 0x0104
WM_SYSKEYUP | 0x0105
WM_SYSCHAR | 0x0106
WM_SYSDEADCHAR | 0x0107

The MSGWrap object, passed to the event handler when the OnKeystrokeMessageForAddon event fires, wraps the Microsoft Windows MSG structure, which contains message data. See the MSGWrap object for more information, or refer to your Windows documentation.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.PageAdded Event (Visio)

 Copy code hover
[image]

InvisibleApp.PageAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new page is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageAdded(ByVal Page As [IVPAGE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was added.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


InvisibleApp.PageChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.PageChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageChanged(ByVal Page As [IVPAGE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that changed.

Remarks

If several pages of a document have default names and any page but the last is deleted, Microsoft Visio will automatically rename the remaining pages to preserve the naming sequence, but the renaming will not trigger the PageChanged event. For example, if a document contains Page-1, Page-2, and Page-3, and then Page-1 is deleted, Page-2 will be renamed Page-1, and Page-3 will be renamed Page-2, but no PageChanged event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.PageDeleteCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.PageDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _PageDeleteCanceled(ByVal Page As [IVPAGE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was going to be deleted.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelConvertToGroup Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelConvertToGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelConvertToGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be converted to a group.

Remarks

A Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • If all handlers return False (don't cancel), the conversion is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelDocumentClose Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelDocumentClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelDocumentClose(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that is going to be closed.

Remarks

A Microsoft Visio instance fires QueryCancelDocumentClose after the user has directed the instance to close a document.

  • If any event handler returns True (cancel), the instance fires DocumentCloseCanceled and does not close the document.

  • If all handlers return False (don't cancel), the instance firesBeforeDocumentClose and then closes the document.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelGroup Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be grouped.

Remarks

A Microsoft Visio instance fires QueryCancelGroup after the user has directed the instance to group a selection of shapes.

  • If any event handler returns True (cancel), the instance fires GroupCanceled and does not group the shapes.

  • If all handlers return False (do not cancel), the grouping is performed.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you use Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelMasterDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelMasterDelete after the user has directed the instance to delete a master.

  • If any event handler returns True (cancel), the instance fires MasterDeleteCanceled and does not delete the master.

  • If all handlers return False (don't cancel), the instance fires BeforeMasterDelete and then deletes the master.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelPageDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelPageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelPageDelete(ByVal Page As [IVPAGE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

A Visio instance fires QueryCancelPageDelete after the user has directed the instance to delete a page.

  • If any event handler returns True (cancel), the instance fires PageDeleteCanceled and does not delete the page.

  • If all handlers return False (don't cancel) the instance fires BeforePageDelete and then deletes the page.

While a Microsoft Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelQuit Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelQuit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application terminates in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelQuit(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that is going to terminate.

Remarks

A Visio instance fires QueryCancelQuit after the user has directed the instance to terminate.

  • If any event handler returns True (cancel), the instance fires QuitCanceled and does not terminate.

  • If all handlers return False (don't cancel), the instance fires BeforeQuit and then terminates.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelReplaceShapes Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.

Syntax

expression .QueryCancelReplaceShapes(replaceShapes)

expression A variable that represents a InvisibleApp object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.
lpboolRet | Required | BOOL |

See also

Concepts

InvisibleApp Object

Other resources

InvisibleApp Members


InvisibleApp.QueryCancelSelectionDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelSelectionDelete after the user has directed the instance to delete one or more shapes.

  • If any event handler returns True (cancel), the instance fires SelectionDeleteCanceled and does not delete the shapes.

  • If all handlers returnFalse (don't cancel), the instance fires BeforeSelectionDelete and BeforeShapeDelete and then deletes the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelStyleDelete Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelStyleDelete after the user has directed the instance to delete a style.

  • If any event handler returns True (cancel), the instance fires StyleDeleteCanceled and does not delete the style.

  • If all handlers return False (don't cancel), the instance fires BeforeStyleDelete and then deletes the style.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelSuspend Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelSuspend Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the operating system enters a suspended state. If any event handler returns True, the Microsoft Visio instance will deny the operating system's request.

Version Information

Version Added: Visio 2000 SR-1

Syntax

Private Sub expression _QueryCancelSuspend(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Visio that responds to the operating system request.

Remarks

You will typically respond False and allow the operating system to enter a suspended state. If you have open network files, you can close them when you receive the BeforeSuspend event. If you have open network files that you cannot close, you can return True and Visio will deny the operating system's request.

  • If any event handler returns True (cancel), the instance fires SuspendCanceled and does not enter a suspended state.

  • If all handlers return False (don't cancel), the instance fires BeforeSuspend and then enters a suspended state.

If your solution runs outside the Visio process, you cannot be assured of receiving this event. For this reason, you should monitor window messages in your program.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA macro shows how to capture the QueryCancelSuspend event and allow the operating system to suspend. Declare a WithEvents variable to capture events fired by the Application object.

VBA Copy code Copy code

Public WithEvents vsoApplication As Visio.Application

Private Function vsoApplication_QueryCancelSuspend(ByVal _
    IVisioApplication As IVApplication) As Boolean

    'You agree to let the operating system suspend.
    vsoApplication_QueryCancelSuspend = False

End Function


InvisibleApp.QueryCancelSuspendEvents Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelSuspendEvents Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application suspends events in response to a client code. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelSuspendEvents(ByVal app As [IVAPPLICATION])

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio in which firing of events is going to be suspended.

Return Value

nothing

Remarks

A Visio instance fires QueryCancelSuspendEvents after client code has directed the instance to suspend events.

  • If any event handler returns True (cancel), the instance fires SuspendEventsCanceled and does not suspend events.

  • If all handlers return False (don't cancel), the suspension occurs.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelUngroup Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelUngroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelUngroup(ByVal Selection As [IVSELECTION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be ungrouped.

Remarks

A Microsoft Visio instance fires QueryCancelUngroup after the user has directed the instance to ungroup one or more shapes.

  • If any event handler returns True (cancel), the instance fires UngroupCanceled and does not ungroup the shapes.

  • If all handlers return False (don't cancel), the instance fires ShapeParentChanged, BeforeSelectionDelete, and BeforeShapeDelete, and then ungroups the shapes.

While a Visio instance is firing a query or cancel event, it respondsto inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QueryCancelWindowClose Event (Visio)

 Copy code hover
[image]

InvisibleApp.QueryCancelWindowClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelWindowClose(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to be closed.

Remarks

A Microsoft Visio instance fires QueryCancelWindowClose after the user has directed the instance to close a window.

  • If any event handler returns True (cancel), the instance fires WindowCloseCanceled and does not close the window.

  • If all handlers return False (don't cancel), the instance fires BeforeWindowClosed and then closes the window.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but it refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.QuitCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.QuitCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelQuit event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QuitCanceled(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that was going to be terminated.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.ReplaceShapesCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.ReplaceShapesCanceled Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.

Syntax

expression .ReplaceShapesCanceled(replaceShapes)

expression A variable that represents a InvisibleApp object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.

See also

Concepts

InvisibleApp Object

Other resources

InvisibleApp Members


InvisibleApp.RuleSetValidated Event (Visio)

 Copy code hover
[image]

InvisibleApp.RuleSetValidated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a rule set is validated.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _RuleSetValidated(ByVal RuleSet As ValidationRuleSet)

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
RuleSet | Required | ValidationRuleSet | The rule set that was validated.

Remarks

When Microsoft Visio performs validation, it fires a RuleSetValidated event for every rule set that it processes, even if a rule set is empty.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


InvisibleApp.RunModeEntered Event (Visio)

 Copy code hover
[image]

InvisibleApp.RunModeEntered Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a document enters run mode.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _RunModeEntered(ByVal doc As [IVDOCUMENT])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
doc | Required | [IVDOCUMENT] | The document that entered run mode.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.SelectionAdded Event (Visio)

 Copy code hover
[image]

InvisibleApp.SelectionAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionAdded(ByVal Selection As [IVSELECTION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the SelectionAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the SelectionAdded event.

For performance considerations, the Document object's event set does not include the SelectionAdded event. To sink the SelectionAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


InvisibleApp.SelectionChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.SelectionChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a set of shapes selected in a window changes.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionChanged(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window in which the selection changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.SelectionDeleteCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.SelectionDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _SelectionDeleteCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.ShapeAdded Event (Visio)

 Copy code hover
[image]

InvisibleApp.ShapeAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _ShapeAdded(ByVal Shape As [IVSHAPE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape or group of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the ShapeAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

To determine if a ShapeAdded event was triggered by a new shape or group of shapes being added to the page, by a set of existing shapes being grouped, or by a paste action, you can use the Application.IsInScope property. If IsInScope returns True when passed visCmdObjectGroup, the ShapeAdded event was triggered by a grouping action. If IsInScope returns True when passed visCmdUFEditPaste or visCmdEditPasteSpecial, the ShapeAdded event was triggered by a paste operation. If IsInScope returns False when passed all of these arguments, the event must have been triggered by new shapes being added to the page.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square. Paste the code into the active document's project in Visio.

The DocumentSaved event handler runs when the active document is saved. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentSaved(ByVal vsoDocument As Visio.IVDocument)

 'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 'the shape was created locally.
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


InvisibleApp.ShapeChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.ShapeChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a property of a shape that is not stored in a cell is changed in a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _ShapeChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose property changed.

Remarks

To determine which properties have changed when ShapeChanged fires, use the EventInfo property. The string returned by the EventInfo property contains a list of substrings that identify the properties that changed.

Changes to the following shape properties cause the ShapeChanged event to fire:

  • Name (the EventInfo property contains "/name")

  • Data1 (the EventInfo property contains "/data1")

  • Data2 (the EventInfo property contains "/data2")

  • Data3 (the EventInfo property contains "/data3")

  • UniqueID (the EventInfo property contains "/uniqueid")

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection that was created by using AddAdvise, the varMoreInfo argument to VisEventProc contains the string: "/doc=1 /page=1 /shape=Sheet.3"

Note Note

You can use VBA WithEvents variables to sink the ShapeChanged event.

For performance considerations, the Document object's event set does not include the ShapeChanged event. To sink the ShapeChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


InvisibleApp.ShapeDataGraphicChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.ShapeDataGraphicChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a data graphic is applied to or deleted from a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeDataGraphicChanged(ByVal Shape As IVSHAPE)

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape to which the data graphic was applied or from which it was deleted.

Remarks

A data graphic is a Master object of type visTypeDataGraphic. When the same master that is already applied to a shape is re-applied to the shape, the ShapeDataGraphicChanged event does not fire, even if the master has been modified since it was applied originally. If, however, a different data graphic master is applied to the shape, the event does fire.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.ShapeExitedTextEdit Event (Visio)

 Copy code hover
[image]

InvisibleApp.ShapeExitedTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is no longer open for interactive text editing.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeExitedTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that was closed for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.ShapeLinkAdded Event (Visio)

 Copy code hover
[image]

InvisibleApp.ShapeLinkAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is linked to a data row.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkAdded(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long)

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is linked to data.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row linked to the shape.
DataRowID | Required | Long | The ID of the data row linked to the shape.

Remarks

The ShapeLinkAdded event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkAdded event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.ShapeLinkDeleted Event (Visio)

 Copy code hover
[image]

InvisibleApp.ShapeLinkDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the link between a shape and a data row is deleted.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkDeleted(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long )

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose link to a data row was broken.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row that was linked to the shape.
DataRowID | Required | Long | The ID of the data row that was linked to the shape.

Remarks

The ShapeLinkDeleted event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkDeleted event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.ShapeParentChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.ShapeParentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after shapes are grouped or a group is ungrouped.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeParentChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose parent changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.StyleAdded Event (Visio)

 Copy code hover
[image]

InvisibleApp.StyleAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new style is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleAdded(ByVal Style As [IVSTYLE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.StyleChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.StyleChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleChanged(ByVal Style As [IVSTYLE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.StyleDeleteCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.StyleDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _StyleDeleteCanceled(ByVal Style As [IVSTYLE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.SuspendCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.SuspendCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSuspend event.

Version Information

Version Added: Visio 2000 SR-1

Syntax

Private Sub expression _SuspendCanceled(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that was going to be suspended.

Remarks

If your solution runs outside the Visio process, you cannot be assured of receiving this event. For this reason, you should monitor window messages in your program.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.SuspendEventsCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.SuspendEventsCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSuspendEvents event. .

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _SuspendEventsCanceled(ByVal app As , )

expression An expression that returns a InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio in which firing of events was going to be suspended.

Return Value

nothing

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.TextChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.TextChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the text of a shape is changed in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _TextChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose text changed.

Remarks

The TextChanged event is fired when the raw text of a shape changes, such as when the characters Microsoft Visio stores for the shape change. If a shape's characters change because a user is typing, the TextChanged event does not fire until the text editing session terminates.

When a field is added to or removed from a shape's text, its raw text changes; hence, a TextChanged event fires. However, no TextChanged event fires when the text in a field changes. For example, a shape has a text field that shows its width. A TextChanged event does not fire when the shape's width changes, because the raw text stored for the shape has not changed, even though the apparent (expanded) text of the shape does change. Use the CellChanged event for one of the cells in the Text Fields section to detect when the text in a text field changes.

To access a shape's raw text, use the Text property. To access the text of a shape in which text fields have been expanded, use the Characters.Text property. You can determine the location and properties of text fields in a shape's text by using the Shape.Characters object.

In Visio 5.0 and earlier versions, the raw characters reported by the Text property for a field included four characters, the first being the escape character. Starting with Visio 2000, only a single escape character is present in the raw text stream.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the TextChanged event.

For performance considerations, the Document object's event set does not include the TextChanged event. To sink the TextChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


InvisibleApp.UngroupCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.UngroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _UngroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be ungrouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.ViewChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.ViewChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the zoom level or scroll position of a drawing window changes.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ViewChanged(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window whose zoom level or scroll position changed.

Remarks

This event fires whenever the zoom level or scroll position of a Window object of the type visDrawing changes.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.VisioIsIdle Event (Visio)

 Copy code hover
[image]

InvisibleApp.VisioIsIdle Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the application empties its message queue.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _VisioIsIdle(ByVal app As [IVAPPLICATION])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
app | Required | [IVAPPLICATION] | The instance of Microsoft Visio that emptied its message queue.

Remarks

Visio continually processes messages in its message queue. When its message queue is empty:

  1. Visio performs its own idle-time processing.

  2. Visio tells Microsoft Visual Basic for Applications to perform its idle-time processing.

  3. If the message queue is still empty, Visio fires the VisioIsIdle event.

  4. If the message queue is still empty, Visio calls WaitMessage, which is a call to Microsoft Windows that doesn't return until a new message gets added to the Visio message queue.

A client program can use the VisioIsIdle event as a signal to perform its own background processing.

The VisioIsIdle event is not the equivalent of a standard timer event. Client programs that need to be called on a periodic basis should use standard timer techniques, because the duration in which Visio is idle (calls WaitMessage) is unpredictable. For client programs that are only monitoring Visio activity, however, the VisioIsIdle event can be sufficient, because until WaitMessage returns to Visio, there cannot have been any Visio activity since the VisioIsIdle event was last fired.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.WindowActivated Event (Visio)

 Copy code hover
[image]

InvisibleApp.WindowActivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the active window changes in a Microsoft Visio instance.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _WindowActivated(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that was activated.

Remarks

The WindowActivated event indicates that the active window has changed in a Visio instance. This event implies that the ActiveDocument and ActivePage properties of the Application object may also have changed; in contrast, any time the ActiveDocument or ActivePage property changes, a WindowActivated event is always generated.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.WindowChanged Event (Visio)

 Copy code hover
[image]

InvisibleApp.WindowChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the size or position of a window changes.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _WindowChanged(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window whose size or position has changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.WindowCloseCanceled Event (Visio)

 Copy code hover
[image]

InvisibleApp.WindowCloseCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _WindowCloseCanceled(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that was going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.WindowOpened Event (Visio)

 Copy code hover
[image]

InvisibleApp.WindowOpened Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a window is opened.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _WindowOpened(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that opened.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


InvisibleApp.WindowTurnedToPage Event (Visio)

 Copy code hover
[image]

InvisibleApp.WindowTurnedToPage Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a window shows a different page.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _WindowTurnedToPage(ByVal Window As [IVWINDOW])

expression A variable that represents an InvisibleApp object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that shows a different page.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


IVBUndoUnit Object (Visio)

 Copy code hover
[image]

IVBUndoUnit Object (Visio)
Send feedback

Published: July 16, 2012

The interface on an undo unit in Microsoft Visio. An undo unit encapsulates the information necessary to undo or redo a single action.

Remarks

The default property of IVBUndoUnit is Description.

You can use the IVBUndoUnit interface in Microsoft Visual Basic for Applications (VBA) or Microsoft Visual Basic to create your own undo units for the Visio undo manager. To create an undo unit, you must implement this interface, along with all of its public procedures, in a class module that you insert into your project.

For more information about using the IVBUndoUnit interface to create undo units, search for "creating undo units" on MSDN, the Microsoft Developer Network.

IVBUndoUnit methods and properties in VTable order

IUnknown Methods | Description
QueryInterface | Returns a pointer to a specified interface.
AddRef | Increments the reference count.
Release | Decrements the reference count.
IVBUndoUnit Methods | Description
Do | Instructs the undo unit to carry out its action.
OnNextAdd | Notifies the last undo unit in the collection that a new unit has been added.
IVBUndoUnit Properties | Description
Description | Read-only. Describes the undo action.
UnitTypeCLSID | Read-only. Returns the CLSID and a type identifier for the undo unit.
UnitTypeLong | Read-only. Returns a Long that can be used to identify the undo unit.
UnitSize | Size in bytes. Used to measure how much memory undo information is using.


IVBUndoUnit Members (Visio)

 Copy code hover
[image]

IVBUndoUnit Members (Visio)
Send feedback

Published: July 16, 2012

The interface on an undo unit in Microsoft Visio. An undo unit encapsulates the information necessary to undo or redo a single action.

Methods

Name | Description
Do | Called by the Undo Manager to tell an undo unit to perform its action.
OnNextAdd | Notifies an undo unit that another undo unit has been added to the undo stack. Returns Nothing.

Properties

Name | Description
Description | Gets the description of an IVBUndoUnit interface. Read-only.
UnitSize | Returns the size of the undo unit in memory, in bytes. Read-only.
UnitTypeCLSID | Identifies an undo unit by its class ID (CLSID). Read-only.
UnitTypeLong | Identifies an undo unit by a Long. Read-only.


IVBUndoUnit Properties (Visio)

 Copy code hover
[image]

IVBUndoUnit Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Description | Gets the description of an IVBUndoUnit interface. Read-only.
UnitSize | Returns the size of the undo unit in memory, in bytes. Read-only.
UnitTypeCLSID | Identifies an undo unit by its class ID (CLSID). Read-only.
UnitTypeLong | Identifies an undo unit by a Long. Read-only.


IVBUndoUnit.Description Property (Visio)

 Copy code hover
[image]

IVBUndoUnit.Description Property (Visio)
Send feedback

Published: July 16, 2012

Gets the description of an IVBUndoUnit interface. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Description

expression A variable that represents an IVBUndoUnit object.

Return Value

String

Remarks

The Description property of the IVBUndoUnit interface is read-only. It returns a string that describes the undo unit and appears in the Undo list on the Quick Access toolbar. For more information about the Description property as it applies to the IVBUndoUnit interface, search for "creating undo units" on MSDN, the Microsoft Developer Network.


IVBUndoUnit.UnitSize Property (Visio)

 Copy code hover
[image]

IVBUndoUnit.UnitSize Property (Visio)
Send feedback

Published: July 16, 2012

Returns the size of the undo unit in memory, in bytes. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .UnitSize

expression A variable that represents a IVBUndoUnit object.

Return Value

Long

Remarks

If you are creating an undo unit for your solution, the UnitSize property is one of the members of IVBUndoUnit that you must implement. The Visio engine may use the memory size returned by the UnitSize property to decide whether to clear the undo queue.

The UnitSize value is optional, and you can set the value to zero (0) when you implement the property.

For more information about the UnitSize property and using the IVBUndoUnit interface to create undo units, search for "Creating Undo Units" on MSDN, the Microsoft Developer Network.


IVBUndoUnit.UnitTypeCLSID Property (Visio)

 Copy code hover
[image]

IVBUndoUnit.UnitTypeCLSID Property (Visio)
Send feedback

Published: July 16, 2012

Identifies an undo unit by its class ID (CLSID). Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .UnitTypeCLSID

expression A variable that represents a IVBUndoUnit object.

Return Value

String

Remarks

If you are creating an undo unit for your solution, the UnitTypeCLSID property is one of the members of IVBUndoUnit that you must implement. You can use the UnitTypeCLSID value to identify your undo units. You can use the same CLSID for multiple undo units and use different values in the UnitTypeLong property.

The UnitTypeCLSID value is optional, and you can set the value to Nothing or to an empty string when you implement the property.

For more information about the UnitTypeCLSID property and using the IVBUndoUnit interface to create undo units, search for "creating undo units" on MSDN.


IVBUndoUnit.UnitTypeLong Property (Visio)

 Copy code hover
[image]

IVBUndoUnit.UnitTypeLong Property (Visio)
Send feedback

Published: July 16, 2012

Identifies an undo unit by a Long. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .UnitTypeLong

expression A variable that represents a IVBUndoUnit object.

Return Value

Long

Remarks

If you are creating an undo unit for your solution, the UnitTypeLong property is one of the members of IVBUndoUnit that you must implement. You can use the UnitTypeLong value to identify your undo units.

The UnitTypeLong value is optional, and you can and set the value to zero (0) when you implement the property.

For more information about the UnitTypeLong property and using the IVBUndoUnit interface to create undo units, search for "creating undo units" on MSDN, the Microsoft Developer Network.


IVBUndoUnit Methods (Visio)

 Copy code hover
[image]

IVBUndoUnit Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Do | Called by the Undo Manager to tell an undo unit to perform its action.
OnNextAdd | Notifies an undo unit that another undo unit has been added to the undo stack. Returns Nothing.


IVBUndoUnit.Do Method (Visio)

 Copy code hover
[image]

IVBUndoUnit.Do Method (Visio)
Send feedback

Published: July 16, 2012

Called by the Undo Manager to tell an undo unit to perform its action.

Version Information

Version Added: Visio 2000

Syntax

expression .Do(pMgr)

expression A variable that represents an IVBUndoUnit object.

Parameters

Name | Required/Optional | Data Type | Description
pMgr | Required | [IVBUNDOMANAGER] | A pointer to an IVBUndoManager interface.

Return Value

Nothing

Remarks

If you are creating an undo unit for your solution, the Do method is one of the procedures that you must implement. It provides the actions that are required to undo and redo actions.

If you are creating a single object for both undoing and redoing, the Do method maintains the undo/redo state and adds an undo unit to the opposite stack.

If the Do method is passed a Nothing pointer, the unit should carry out the undo action but should not place anything on the undo or redo stack.

For more information about the Do method and using the IVBUndoUnit interface to create undo units, search for "creating undo units" on MSDN.


IVBUndoUnit.OnNextAdd Method (Visio)

 Copy code hover
[image]

IVBUndoUnit.OnNextAdd Method (Visio)
Send feedback

Published: July 16, 2012

Notifies an undo unit that another undo unit has been added to the undo stack. Returns Nothing.

Version Information

Version Added: Visio 2000

Syntax

expression .OnNextAdd

expression A variable that represents an IVBUndoUnit object.

Return Value

Nothing

Remarks

If you are creating an undo unit for your solution, the OnNextAdd method is one of the procedures that you must implement. It gets called when the next undo unit in the same undo scope gets added to the undo stack.

When an undo unit receives an OnNextAdd notification, it communicates back to the creating object that it can no longer insert data into this undo unit.

For more information about the using the OnNextAdd method and using the IVBUndoUnit interface to create undo units, search for "creating undo units" on MSDN.


IVisEventProc Object (Visio)

 Copy code hover
[image]

IVisEventProc Object (Visio)
Send feedback

Published: July 16, 2012

The interface for handling event notifications in Microsoft Visio.

Version Information

Version Added: Visio 2000

Remarks

In addition to the methods inherited from IDispatch, the IVisEventProc interface contains a single function, VisEventProc, which returns a Variant. Because IVisEventProc inherits from IDispatch and hence from IUnknown, you must implement the methods in those interfaces as well as the VisEventProc method in IVisEventProc.

To handle event notifications in Visio, create a class module that implements the IVisEventProc interface in Microsoft Visual Basic for Applications (VBA) or Microsoft Visual Basic, and then create an instance of this class to pass as an argument to the AddAdvise method of the EventList collection.

For more information about using the IVisEventProc interface to handle event notifications, search for "Visio event objects" on MSDN, the Microsoft Developer Network. For more information about implementing IDispatch methods, search for "Implementing the IDispatch Interface" on MSDN.


IVisEventProc Members (Visio)

 Copy code hover
[image]

IVisEventProc Members (Visio)
Send feedback

Published: July 16, 2012

The interface for handling event notifications in Microsoft Visio.

Methods

Name | Description
VisEventProc | Private member function of IVisEventProc that handles event notifications passed to it by the EventList.AddAdvise method.


IVisEventProc Methods (Visio)

 Copy code hover
[image]

IVisEventProc Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
VisEventProc | Private member function of IVisEventProc that handles event notifications passed to it by the EventList.AddAdvise method.


IVisEventProc.VisEventProc Method (Visio)

 Copy code hover
[image]

IVisEventProc.VisEventProc Method (Visio)
Send feedback

Published: July 16, 2012

Private member function of IVisEventProc that handles event notifications passed to it by the EventList.AddAdvise method.

Version Information

Version Added: Visio 2000

Syntax

expression .VisEventProc(nEventCode, pSourceObj, nEventID, nEventSeqNum, pSubjectObj, vMoreInfo)

expression A variable that represents an IVisEventProc object.

Parameters

Name | Required/Optional | Data Type | Description
nEventCode | Required | Integer | The event or events that occurred.
pSourceObj | Required | Object | The object whose EventList collection contains the Event object that sent the notification.
nEventID | Required | Long | The unique identifier of the Event object within the EventList collection.
nEventSeqNum | Required | Long | The ordinal position of the event with respect to the sequence of events that have occurred in the calling instance of the application.
pSubjectObj | Required | Object | The subject of the event, which is the object to which the event occurred. See Remarks for examples.
vMoreInfo | Required | Variant | Additional information about the subject of the event. See Remarks for more information.

Return Value

Variant

Remarks

To handle event notifications, create a class module that implements the IVisEventProc interface and then create an instance of this class to pass as an argument to the AddAdvise method of the EventList collection. Use the AddAdvise method to create Event objects that send the notifications.

The nEventCode parameter identifes the specific event or events that occurred. The EventCode argument of the AddAdvise method is passed to VisEventProc as nEventCode. Within your procedure, you can use any branching technique you want to determine which event occurred and handle it. The example that accompanies this topic uses a Select Case decision structure.

Unlike the Index property of the EventList collection, nEventID does not change as Event objects are added or deleted from the collection.

From within VisEventProc , you can use the following code to get the Event object that sent the notification:

VBA Copy code Copy code
pSourceObj.EventList.ItemFromID(nEventID)

The connection between the source object pSourceObj and the Event object exists until one of the following occurs:

  • The program deletes the Event object.

  • The program releases the last reference to the source object. (The EventList collection and Event objects hold a reference to their source object.)

  • The Microsoft Visio application instance terminates.

The first event that occurs in a Visio instance has nEventSeqNum = 1, the second event = 2, and so on. In some cases, you can use the sequence number in conjunction with the EventInfo property to obtain more information about the event.

The pSubjectObj parameter for a ShapeAdded event is a Shape object that represents the shape that was just added, while the subject of a BeforeSelectionDelete event is a Selection object in which the shapes that are about to be deleted are selected.

For many events, vMoreInfo is a string similar to the command line the application passes to the add-ons it executes. If the notification does not include additional information, this parameter is set to Nothing. For details about notification parameters for a particular event, see the particular event topic in this Automation Reference.

Beginning with Visio 2000, VisEventProc is defined as a function that returns a value. However, Visio only looks at return values from calls to VisEventProc that are passed a query event code. Sink objects that provide VisEventProc through IDispatch require no change. To modify existing event handlers so that they can handle query events, change the Sub procedure to a Function procedure and return the appropriate value. (For details about query events, see this reference for event topics prefixed with Query.)

If nEventCode identifies a query event (events prefixed with Query), return True from VisEventProc to cancel the event, and return False to allow it to happen. The value is arbitrary for other events. If you do not return an explicit value, Microsoft Visual Basic for Applications (VBA) returns an empty Variant, which Visio interprets as False.

Example

This example shows how to create a class module that implements IVisEventProc to handle events fired by a source object in Visio, for example, the Document object. The module consists of the function VisEventProc , which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, see the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


KeyboardEvent Object (Visio)

 Copy code hover
[image]

KeyboardEvent Object (Visio)
Send feedback

Published: July 16, 2012

The object passed to VisEventProc as the subject of KeyDown, KeyPress, and KeyUp events.

Version Information

Version Added: Visio 2003

Remarks

The default property of KeyboardEvent is ToString. The ToString property returns a string that represents the properties of the KeyboardEvent object, and has the form

event code; KeyCode property value; KeyButtonState property value; KeyAscii property value; Window.Caption

where event code returns the code of the event that fired (KeyDown, KeyPress, or KeyUp) and Window.Caption returns the caption of the window that sourced the event. For example, if a user pressed the "L" key while holding down the SHIFT key, in response to the KeyPress event, ToString might return the following:

713;0;4;76;Drawing1

Use the Application property of the KeyboardEvent object to determine the Microsoft Visio instance hosting the object, and use the Window property to determine the Visio window associated with a keyboard event.


KeyboardEvent Members (Visio)

 Copy code hover
[image]

KeyboardEvent Members (Visio)
Send feedback

Published: July 16, 2012

The object passed to VisEventProc as the subject of KeyDown, KeyPress, and KeyUp events.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
KeyAscii | Returns the ASCII code associated with a KeyPress event. Read-only.
KeyButtonState | Returns the state of mouse buttons and the SHIFT and CTRL keys associated with a keyboard event. Read-only.
KeyCode | Returns the key associated with KeyDown and KeyUp events. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information. Read-only.
ToString | Returns a string that represents the properties of a KeyboardEvent or MouseEvent object. Read-only.
Window | Returns the window associated with a KeyboardEvent object. Read-only.


KeyboardEvent Properties (Visio)

 Copy code hover
[image]

KeyboardEvent Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
KeyAscii | Returns the ASCII code associated with a KeyPress event. Read-only.
KeyButtonState | Returns the state of mouse buttons and the SHIFT and CTRL keys associated with a keyboard event. Read-only.
KeyCode | Returns the key associated with KeyDown and KeyUp events. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information. Read-only.
ToString | Returns a string that represents the properties of a KeyboardEvent or MouseEvent object. Read-only.
Window | Returns the window associated with a KeyboardEvent object. Read-only.


KeyboardEvent.Application Property (Visio)

 Copy code hover
[image]

KeyboardEvent.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a KeyboardEvent object.

Return Value

Application


KeyboardEvent.KeyAscii Property (Visio)

 Copy code hover
[image]

KeyboardEvent.KeyAscii Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ASCII code associated with a KeyPress event. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .KeyAscii

expression A variable that represents a KeyboardEvent object.

Return Value

Long

Remarks

The values returned by KeyAscii are ASCII codes. To see a list of these codes, search for "ASCII character codes" on MSDN, the Microsoft Developer Network.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your Microsoft Visual Basic for Applications (VBA) project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyPress event. In the Immediate window, the handler prints the ASCII code of the key that was pressed to fire the event.


KeyboardEvent.KeyButtonState Property (Visio)

 Copy code hover
[image]

KeyboardEvent.KeyButtonState Property (Visio)
Send feedback

Published: July 16, 2012

Returns the state of mouse buttons and the SHIFT and CTRL keys associated with a keyboard event. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .KeyButtonState

expression A variable that represents a KeyboardEvent object.

Return Value

Long

Remarks

Possible values for KeyButtonState can be a combination of any of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your Microsoft Visual Basic for Applications (VBA) project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub
VBA Copy code Copy code

Save the document to initialize the class, and then press any key to fire a KeyDown event. In the Immediate window, the handler prints the code of the key that was pressed to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


KeyboardEvent.KeyCode Property (Visio)

 Copy code hover
[image]

KeyboardEvent.KeyCode Property (Visio)
Send feedback

Published: July 16, 2012

Returns the key associated with KeyDown and KeyUp events. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .KeyCode

expression A variable that represents a KeyboardEvent object.

Return Value

Long

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyDown event. In the Immediate window, the handler prints the code of the key that was pressed to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


KeyboardEvent.ObjectType Property (Visio)

 Copy code hover
[image]

KeyboardEvent.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a KeyboardEvent object.

Return Value

VisObjectType

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


KeyboardEvent.Stat Property (Visio)

 Copy code hover
[image]

KeyboardEvent.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a KeyboardEvent object.

Return Value

VisStatCodes


KeyboardEvent.ToString Property (Visio)

 Copy code hover
[image]

KeyboardEvent.ToString Property (Visio)
Send feedback

Published: July 16, 2012

Returns a string that represents the properties of a KeyboardEvent or MouseEvent object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ToString

expression A variable that represents a KeyboardEvent object.

Return Value

String

Remarks

ToString is the default property of both KeyboardEvent and MouseEvent objects.

When a KeyDown, KeyPress, or KeyUp event fires, the ToString property returns a string that represents the properties of the KeyboardEvent object that gets passed to VisEventProc. The string has the following form:

event code; KeyCode property value; KeyButtonState property value; KeyAscii property value; Window.Caption

where event code returns the code of the event that fired and Window.Caption returns the caption of the window that sourced the event. For example, if a user pressed the "L" key while holding down the SHIFT key, in response to the KeyPress event, ToString might return

713;0;4;76;Drawing1

When a MouseDown, MouseMove, or MouseUp event fires, the ToString property returns a string that represents the properties of the MouseEvent object that gets passed to VisEventProc. The string has the following form:

event code; Button property value; KeyButtonState property value; x property value; y property value; Window.Caption

where event code returns the code of the event that fired and Window.Caption returns the caption of the window that sourced the event. For example, if a user clicked the left mouse button near the middle of the drawing page while holding down the SHIFT key, in response to the MouseDown event, ToString might return

709;1;5;4.3750003+000;4.265000+000;Drawing1

For more information about the possible values returned by each of the individual properties represented by the string returned by ToString, see the respective property topics in this Automation Reference.

Example

The following Microsoft Visual Basic for Applications (VBA) example shows how to use the AddAdvise method to create a Event object that will sink a MouseDown event. It uses the ToString property of the MouseEvent object to report the details of the event that fired.

The example contains a class module and two public procedures that are inserted into the ThisDocument project of the active Visio document:

  • The CreateEventObject procedure creates an instance of a sink-object (event-handling) class named clsEventSink that gets passed to the AddAdvise method, and that receives notifications of events. In addition, the procedure creates an Event object to send notifications of firings of the MouseDown event sourced by the Application object to the sink object.

  • The DeleteEventObject procedure deletes this Event object when your program is finished using it.

The clsEventSink class implements the IVisEventProc interface. The class module creates a class to handle events fired by the Visio Application object. The module consists of the function VisEventProc, which uses a Select Case block to check for the MouseDown event. When a MouseDown event fires, Visio passes a MouseEvent object to VisEventProc as pSubjectObj. The function then constructs a message that displays the string returned by the ToString property of the MouseEvent object passed to the function.

Other events fall under the default case (Case Else). The Case Else block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

The example assumes that there is an active document in the Visio application window. Copy the following code into the ThisDocument project in the Visual Basic Editor:

VBA Copy code Copy code
Option Explicit

Private mEventSink As clsEventSink

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Public Sub CreateMouseDownEventObject()

 Dim vsoApplicationEvents As Visio.EventList
 Dim vsoMouseDownEvent As Visio.Event

 'Create an instance of the clsEventSink class
 'to pass to the AddAdvise method.
 Set mEventSink = New clsEventSink

 'Get the EventList collection of the application
 Set vsoApplicationEvents = Application.EventList

 'Add an Event object for the MouseDown event
 'that will send notifications.
 Set vsoMouseDownEvent= vsoApplicationEvents.AddAdvise( _
 visEvtCodeMouseDown, mEventSink, "", "Mouse down...")

End Sub

Public Sub DeleteMouseDownEventObject()

 'Delete the Event object for the MouseDown event
 vsoMouseDownEvent.Delete
 Set vsoMouseDownEvent = Nothing

End Sub

Copy the following code into a new class module in VBA, naming the module clsEventSink.

VBA Copy code Copy code
Implements Visio.IVisEventProc

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String
 Dim vsoMouseDownEvent As Visio.MouseEvent

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeMouseDown
 Set vsoMouseEvent = pSubjectObj
 strMessage = "ToString is: " & vsoMouseEvent.ToString
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


KeyboardEvent.Window Property (Visio)

 Copy code hover
[image]

KeyboardEvent.Window Property (Visio)
Send feedback

Published: July 16, 2012

Returns the window associated with a KeyboardEvent object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Window

expression A variable that represents a KeyboardEvent object.

Return Value

Window

Remarks

For the KeyboardEvent object, the Window property returns the window associated with the event represented by this object.


Layer Object (Visio)

 Copy code hover
[image]

Layer Object (Visio)
Send feedback

Published: July 16, 2012

Represents a layer of a page or master. You can assign shapes to or remove them from the layer.

Version Information

Version Added: Visio 4.0

Remarks

The default property of a Layer object is Name.

To access cells whose values define layer attributes, such as whether the layer is visible or printable, use the CellsC property.

A layer's Index and Row properties typically have different values. The Index property indicates the layer's ordinal position in its Layers collection. The layer's Row property indicates the index of the row in the Layers section where the layer's attributes are defined.


Layer Members (Visio)

 Copy code hover
[image]

Layer Members (Visio)
Send feedback

Published: July 16, 2012

Represents a layer of a page or master. You can assign shapes to or remove them from the layer.

Methods

Name | Description
Add | Adds a Shape object to a Layer object.
Delete | Deletes a Layer object. Can also delete shapes assigned to the deleted layer.
Remove | Removes a shape from a layer.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
CellsC | Returns a Cell object that represents a ShapeSheet cell in a row in the Layers section. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Index | Gets the ordinal position of a Layer object in the Layers collection. Read-only.
Master | Returns the master that contains the Layer object. Read-only.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Layer object. Read/write.
ObjectType | Returns an object's type. Read-only.
Page | Gets the page that contains the layer. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Row | Returns the row index of a layer. Read-only.
Stat | Returns status information for an object. Read-only.


Layer Properties (Visio)

 Copy code hover
[image]

Layer Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
CellsC | Returns a Cell object that represents a ShapeSheet cell in a row in the Layers section. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Index | Gets the ordinal position of a Layer object in the Layers collection. Read-only.
Master | Returns the master that contains the Layer object. Read-only.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Layer object. Read/write.
ObjectType | Returns an object's type. Read-only.
Page | Gets the page that contains the layer. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Row | Returns the row index of a layer. Read-only.
Stat | Returns status information for an object. Read-only.


Layer.Application Property (Visio)

 Copy code hover
[image]

Layer.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Layer object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Layer.CellsC Property (Visio)

 Copy code hover
[image]

Layer.CellsC Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Cell object that represents a ShapeSheet cell in a row in the Layers section. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CellsC(Column)

expression An expression that returns a Layer object.

Parameters

Name | Required/Optional | Data Type | Description
Column | Required | Integer | The cell index of the cell to get.

Return Value

Cell

Remarks

The following constants for the cell index are declared by the Microsoft Visio type library in VisCellIndices.

Constant | Value
visLayerName | 0
visLayerColor | 2
visLayerStatus | 3
visLayerVisible | 4
visLayerPrint | 5
visLayerActive | 6
visLayerLock | 7
visLayerSnap | 8
visLayerGlue | 9
visLayerNameUniv | 10
visLayerColorTrans | 11


Layer.Document Property (Visio)

 Copy code hover
[image]

Layer.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Layer object.

Return Value

Document


Layer.EventList Property (Visio)

 Copy code hover
[image]

Layer.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Layer object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Layer.Index Property (Visio)

 Copy code hover
[image]

Layer.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Layer object in the Layers collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Layer object.

Return Value

Integer

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Layer.Master Property (Visio)

 Copy code hover
[image]

Layer.Master Property (Visio)
Send feedback

Published: July 16, 2012

Returns the master that contains the Layer object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Master

expression A variable that represents a Layer object.

Return Value

Master

Remarks

If the Layer object is from a page rather than a master, its Master property returns Nothing.


Layer.Name Property (Visio)

 Copy code hover
[image]

Layer.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a Layer object.

Return Value

String

Remarks

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Name property to display layer names. It also uses the Layer property to get a reference to a particular layer and the LayerCount property to determine the number of layers to which a shape is assigned.

VBA Copy code Copy code

Public Sub Name_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoLayers As Visio.Layers
 Dim vsoLayer As Visio.Layer

 If ActiveDocument Is Nothing Then
 Documents.Add ("")
 End If

 Set vsoPage = ActivePage
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Get the Layers collection.
 Set vsoLayers = vsoPage.Layers

 'Create a layer named ExampleLayer1 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer1")
 vsoLayer.Add vsoShape, 1

 'Create a layer named ExampleLayer2 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer2")
 vsoLayer.Add vsoShape, 1

 'Verify that the shape has been assigned to 2 layers.
 Debug.Print "The page has " & vsoShape.LayerCount & " layers."

 'Get a reference to the first layer.
 Set vsoLayer = vsoShape.Layer(1)

 'Verify by using the Name property.
 Debug.Print "Current vsoLayer name is """ & vsoLayer.Name & "."""

End Sub


Layer.NameU Property (Visio)

 Copy code hover
[image]

Layer.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of a Layer object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .NameU

expression A variable that represents a Layer object.

Return Value

String

Remarks

You can set the NameU property of a Style object that represents a style that is not a default Microsoft Office Visio style. If you attempt to set the NameU property of a default Visio style, an error is generated.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the NameU property to display layer names. It also uses the Layer property to get a reference to a particular layer and the LayerCount property to determine the number of layers to which a shape is assigned.

VBA Copy code Copy code

Public Sub NameU_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoLayers As Visio.Layers
 Dim vsoLayer As Visio.Layer

 If ActiveDocument Is Nothing Then
 Documents.Add ("")
 End If

 Set vsoPage = ActivePage
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Get the Layers collection.
 Set vsoLayers = vsoPage.Layers

 'Create a layer named ExampleLayer1 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer1")
 vsoLayer.Add vsoShape, 1

 'Create a layer named ExampleLayer2 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer2")
 vsoLayer.Add vsoShape, 1

 'Verify that the shape has been assigned to 2 layers.
 Debug.Print "The page has " & vsoShape.LayerCount & " layers."

 'Get a reference to the first layer.
 Set vsoLayer = vsoShape.Layer(1)

 'Verify by using the NameU property.
 Debug.Print "Current vsoLayer name is """ & vsoLayer.NameU & "."""

End Sub


Layer.ObjectType Property (Visio)

 Copy code hover
[image]

Layer.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Layer object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Layer.Page Property (Visio)

 Copy code hover
[image]

Layer.Page Property (Visio)
Send feedback

Published: July 16, 2012

Gets the page that contains the layer. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Page

expression A variable that represents a Layer object.

Return Value

Page

Remarks

If the Layer object is in a master rather than in a page, the Page property returns Nothing. You cannot set the Page property of a Layer object.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Page property to return a Page object from various other objects.

VBA Copy code Copy code
Public Sub Page_Example()

 Dim vsoPage1 As Visio.Page
 Dim vsoPage2 As Visio.Page
 Dim vsoTempPage As Visio.Page
 Dim vsoLayer1 As Visio.Layer
 Dim vsoLayer2 As Visio.Layer
 Dim vsoLayers1 As Visio.Layers
 Dim vsoLayers2 As Visio.Layers

 'Set the current page name to MyPage1.
 ActivePage.Name = "MyPage1"

 'Use the Page property to return the current
 'Page object from the Window object.
 Set vsoPage1 = ActiveWindow.Page

 'Verify that the expected page was received.
 Debug.Print "The active window contains: " & vsoPage1.Name

 'Add a second page named MyPage2.
 Set vsoPage2 = ActiveDocument.Pages.Add
 vsoPage2.Name = "MyPage2"

 'Get the Layers collection from each page.
 Set vsoLayers1 = vsoPage1.Layers
 Set vsoLayers2 = vsoPage2.Layers

 'Create a layer for each of the Layers collections.
 Set vsoLayer1 = vsoLayers1.Add("ExampleLayer1")
 Set vsoLayer2 = vsoLayers2.Add("ExampleLayer2")

 'Use the Page property to return the Page object
 'from a Layers object.
 Set vsoTempPage = vsoLayers1.Page

 'Verify that the expected page was received.
 Debug.Print " vsoLayers1 is from: " & vsoTempPage.Name

 'Use the Page property to return the Page object
 'from a Layer object.
 Set vsoTempPage = vsoLayer2.Page

 'Verify that the expected page was received.
 Debug.Print " vsoLayer2 is from: " & vsoTempPage.Name

 'Set the active window's page to "MyPage1."
 ActiveWindow.Page = "MyPage1"

End Sub


Layer.PersistsEvents Property (Visio)

 Copy code hover
[image]

Layer.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Layer object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Layer.Row Property (Visio)

 Copy code hover
[image]

Layer.Row Property (Visio)
Send feedback

Published: July 16, 2012

Returns the row index of a layer. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Row

expression A variable that represents a Layer object.

Return Value

Integer


Layer.Stat Property (Visio)

 Copy code hover
[image]

Layer.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Layer object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Layer Methods (Visio)

 Copy code hover
[image]

Layer Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a Shape object to a Layer object.
Delete | Deletes a Layer object. Can also delete shapes assigned to the deleted layer.
Remove | Removes a shape from a layer.


Layer.Add Method (Visio)

 Copy code hover
[image]

Layer.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a Shape object to a Layer object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add(SheetObject, fPresMems)

expression A variable that represents a Layer object.

Parameters

Name | Required/Optional | Data Type | Description
SheetObject | Required | [IVSHAPE] | The new Shape object added to the Layer object.
fPresMems | Required | Integer | Zero to remove subshapes from any previous layer assignments; non-zero to preserve layer assignments.

Return Value

Nothing

Remarks

If the shape is a group and fPresMems is non-zero, the component shapes of the group retain their current layer assignments and are also added to this layer. If fPresMems is zero, the component shapes are reassigned to this layer and lose their current layer assignments.

Example

The following example shows how to use the Add method to add Shape objects to a Layer object. When the Shape object you add to a Layer object is a group shape, use the fPresMems argument of the Add method to specify whether the component shapes of the group retain or lose their previous layer assignments. If the shape you add is not a group shape, the fPresMems argument has no effect, but is still required.

In the example, two new layers are created. Two rectangle shapes are drawn and then added to the first layer. Subsequently, the rectangles are grouped into a group shape. The group shape is then selected and duplicated, and the duplicate group shapes are added to the second layer in two different ways.

Layer assignments of the component shapes of vsoShapeGroup2 are retained by passing a non-zero value for the fPresMems argument of the Add method, but previous layer assignments of the component shapes of vsoShapeGroup1 are lost when zero is passed to the Add method for that argument. As a result, the component shapes of vsoShapeGroup1 are assigned only to vsoLayer2, while the components of vsoShapeGroup2 are assigned to both vsoLayer1 and vsoLayer2.

VBA Copy code Copy code
Public Sub AddShapesToLayer_Example()

 Dim vsoDocument As Visio.Document
 Dim vsoPages As Visio.Pages
 Dim vsoPage As Visio.Page
 Dim vsoLayers As Visio.Layers
 Dim vsoLayer1 As Visio.Layer
 Dim vsoLayer2 As Visio.Layer
 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShapeGroup1 As Visio.Shape
 Dim vsoShapeGroup2 As Visio.Shape

 'Add a Document object based on the Basic Diagram template.
 Set vsoDocument = Documents.Add("Basic Diagram.vst")

 'Get the Pages collection and add a page to the collection.
 Set vsoPages = vsoDocument.Pages
 Set vsoPage = vsoPages.Add

 'Get the Layers collection and add two layers
 'to the collection.
 Set vsoLayers = vsoPage.Layers
 Set vsoLayer1 = vsoLayers.Add("MyLayer")
 Set vsoLayer2 = vsoLayers.Add("MySecondLayer")

 'Draw two rectangles.
 Set vsoShape1 = vsoPage.DrawRectangle(3, 3, 5, 6)
 Set vsoShape2 = vsoPage.DrawRectangle(4, 4, 6, 7)

 'Assign each rectangle to the first layer.
 vsoLayer1.Add vsoShape1, 0
 vsoLayer1.Add vsoShape2, 0

 'Select the two rectangles and group them.
 ActiveWindow.SelectAll
 ActiveWindow.Selection.Group

 'Duplicate the group and set each group as a Shape object.
 Set vsoShapeGroup1 = vsoPage.Shapes(1)
 vsoShapeGroup1.Duplicate
 Set vsoShapeGroup2 = vsoPage.Shapes(2)

 'Add the first grouped shape to the second layer.
 'This group's component shapes are added to the layer
 'but lose their previous layer assignment.
 vsoLayer2.Add vsoShapeGroup1, 0

 'Add the second grouped shape to the second layer.
 'This group's component shapes are added to the layer
 'but retain their previous layer assignment.
 vsoLayer2.Add vsoShapeGroup2, 1

End Sub


Layer.Delete Method (Visio)

 Copy code hover
[image]

Layer.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes a Layer object. Can also delete shapes assigned to the deleted layer.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete(fDeleteShapes)

expression A variable that represents a Layer object.

Parameters

Name | Required/Optional | Data Type | Description
fDeleteShapes | Required | Integer | 1 (True) to delete shapes assigned to the layer; otherwise, 0 (False).

Return Value

Nothing

Remarks

When fDeleteShapes is non-zero, shapes assigned only to the deleted layer are deleted. Otherwise, the shapes are simply no longer assigned to that layer.


Layer.Remove Method (Visio)

 Copy code hover
[image]

Layer.Remove Method (Visio)
Send feedback

Published: July 16, 2012

Removes a shape from a layer.

Version Information

Version Added: Visio 4.0

Syntax

expression .Remove(SheetObject, fPresMems)

expression A variable that represents a Layer object.

Parameters

Name | Required/Optional | Data Type | Description
SheetObject | Required | [IVSHAPE] | An expression that returns the Shape object to remove.
fPresMems | Required | Integer | Flag that indicates whether to remove members of a group.

Return Value

Nothing

Remarks

If the shape is a group and fPresMems is non-zero, member shapes of the group are unaffected. If fPresMems is zero (0), the group's member shapes are also removed from the layer.

Removing a shape from a layer does not delete the shape.


Layers Object (Visio)

 Copy code hover
[image]

Layers Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Layer object for each layer defined for a page or master.

Version Information

Version Added: Visio 4.0

Remarks

To retrieve a Layers collection, use the Layers property of a Page object or a Master object.

The default property of a Layers collection is Item.


Layers Members (Visio)

 Copy code hover
[image]

Layers Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Layer object for each layer defined for a page or master.

Methods

Name | Description
Add | Adds a new Layer object to a Layers collection.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemU | Returns an object from a collection. Read-only.
Master | Returns the master that contains the Layers collection. Read-only.
ObjectType | Returns an object's type. Read-only.
Page | Gets the page that contains the layers. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Stat | Returns status information for an object. Read-only.


Layers Properties (Visio)

 Copy code hover
[image]

Layers Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemU | Returns an object from a collection. Read-only.
Master | Returns the master that contains the Layers collection. Read-only.
ObjectType | Returns an object's type. Read-only.
Page | Gets the page that contains the layers. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Stat | Returns status information for an object. Read-only.


Layers.Application Property (Visio)

 Copy code hover
[image]

Layers.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Layers object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Layers.Count Property (Visio)

 Copy code hover
[image]

Layers.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Layers object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Layers.Document Property (Visio)

 Copy code hover
[image]

Layers.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Layers object.

Return Value

Document


Layers.EventList Property (Visio)

 Copy code hover
[image]

Layers.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Layers object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Layers.Item Property (Visio)

 Copy code hover
[image]

Layers.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameOrIndex)

expression A variable that represents a Layers collection.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

Layer

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.


Layers.ItemU Property (Visio)

 Copy code hover
[image]

Layers.ItemU Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ItemU(NameOrIndex)

expression A variable that represents a Layers object.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the universal name, unique ID, or index of the object to retrieve.

Return Value

Layer

Remarks

You can retrieve an object in an Addons, Hyperlinks, Layers, Masters, MasterShortcuts, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

If you retrieve a Shape object by name, the ItemU property searches all shapes in the Shapes collection's containing page or containing master, in addition to the collection's containing shape. Therefore, the Shape object returned by the ItemU property can be a shape that is not in the Shapes collection.

You can also pass the unique ID string of a Master or Shape object to the ItemU property. For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

If such a string is passed to the ItemU property of a Shapes collection, all the shapes contained in the collection are searched. Shapes within the group shapes in the containing shape are not searched.

To search all shapes in the collection, plus the shapes inside groups and the containing shape of the collection, prefix the unique ID string with an asterisk (*). For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")
Note Note

  • In Visio 2000 only, vsoShapes.ItemU("{guid}") examined the Shapes collection's containing shape and all descendants, and vsoShapes.ItemU("*{guid}") examined all shapes in the Shapes collection's containing page or containing master.

  • Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

    As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

Example

This Microsoft Visual Basic macro shows how to use the ItemU property of the Pages collection to get the Shapes collection. Then it uses the ItemU property of the Shapes collection to print the universal names of all shapes on Page-1 in the Immediate window.

To run this macro, make sure the active document has shapes on Page-1.

VBA Copy code Copy code
Public Sub ItemU_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.ItemU(1).Shapes

    Debug.Print "Shapes in Document: "; ActiveDocument.Name
    Debug.Print "          on  Page: "; ActiveDocument.Pages.ItemU(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then

        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.ItemU(intCounter).Name
        Next intCounter

    Else

        Debug.Print " No Shapes On Page"

    End If

End Sub


Layers.Master Property (Visio)

 Copy code hover
[image]

Layers.Master Property (Visio)
Send feedback

Published: July 16, 2012

Returns the master that contains the Layers collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Master

expression A variable that represents a Layers object.

Return Value

Master

Remarks

If the Layers collection is from a page rather than a master, its Master property returns Nothing.


Layers.ObjectType Property (Visio)

 Copy code hover
[image]

Layers.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Layers object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Layers.Page Property (Visio)

 Copy code hover
[image]

Layers.Page Property (Visio)
Send feedback

Published: July 16, 2012

Gets the page that contains the layers. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Page

expression A variable that represents a Layers object.

Return Value

Page

Remarks

If theLayers collection is in a master rather than in a page, the Page property returns Nothing. You cannot set the Page property of a Layers collection.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Page property to return a Page object from various other objects.

VBA Copy code Copy code
Public Sub Page_Example()

 Dim vsoPage1 As Visio.Page
 Dim vsoPage2 As Visio.Page
 Dim vsoTempPage As Visio.Page
 Dim vsoLayer1 As Visio.Layer
 Dim vsoLayer2 As Visio.Layer
 Dim vsoLayers1 As Visio.Layers
 Dim vsoLayers2 As Visio.Layers

 'Set the current page name to MyPage1.
 ActivePage.Name = "MyPage1"

 'Use the Page property to return the current
 'Page object from the Window object.
 Set vsoPage1 = ActiveWindow.Page

 'Verify that the expected page was received.
 Debug.Print "The active window contains: " & vsoPage1.Name

 'Add a second page named MyPage2.
 Set vsoPage2 = ActiveDocument.Pages.Add
 vsoPage2.Name = "MyPage2"

 'Get the Layers collection from each page.
 Set vsoLayers1 = vsoPage1.Layers
 Set vsoLayers2 = vsoPage2.Layers

 'Create a layer for each of the Layers collections.
 Set vsoLayer1 = vsoLayers1.Add("ExampleLayer1")
 Set vsoLayer2 = vsoLayers2.Add("ExampleLayer2")

 'Use the Page property to return the Page object
 'from a Layers object.
 Set vsoTempPage = vsoLayers1.Page

 'Verify that the expected page was received.
 Debug.Print " vsoLayers1 is from: " & vsoTempPage.Name

 'Use the Page property to return the Page object
 'from a Layer object.
 Set vsoTempPage = vsoLayer2.Page

 'Verify that the expected page was received.
 Debug.Print " vsoLayer2 is from: " & vsoTempPage.Name

 'Set the active window's page to "MyPage1."
 ActiveWindow.Page = "MyPage1"

End Sub


Layers.PersistsEvents Property (Visio)

 Copy code hover
[image]

Layers.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Layers object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Layers.Stat Property (Visio)

 Copy code hover
[image]

Layers.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Layers object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Layers Methods (Visio)

 Copy code hover
[image]

Layers Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new Layer object to a Layers collection.


Layers.Add Method (Visio)

 Copy code hover
[image]

Layers.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new Layer object to a Layers collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add(LayerName)

expression A variable that represents a Layers object.

Parameters

Name | Required/Optional | Data Type | Description
LayerName | Required | String | The name of the new layer.

Return Value

Layer

Example

The following macro shows how to add a Layer object to the Layers collection.

VBA Copy code Copy code
Public Sub AddLayer_Example()

 Dim vsoDocument As Visio.Document
 Dim vsoPages As Visio.Pages
 Dim vsoPage As Visio.Page
 Dim vsoLayers As Visio.Layers
 Dim vsoLayer As Visio.Layer

 'Add a document based on the Basic Diagram template.
 Set vsoDocument = Documents.Add("Basic Diagram.vst")

 'Get the Pages collection and add a page to the collection.
 Set vsoPages = vsoDocument.Pages
 Set vsoPage = vsoPages.Add

 'Get the Layers collection and add a layer named "MyLayer"
 'to the collection.
 Set vsoLayers = vsoPage.Layers
 Set vsoLayer = vsoLayers.Add("MyLayer")

End Sub


Master Object (Visio)

 Copy code hover
[image]

Master Object (Visio)
Send feedback

Published: July 16, 2012

Represents a master in a stencil.

Version Information

Version Added: Visio 2.0

Remarks

You retrieve a particular Master object from the Masters collection of a Document object whose stencil contains that master.

The default property of a Master object is Name.

To create an instance of a master in a drawing, use the Drop method of a Page object that represents a drawing page.


Master Members (Visio)

 Copy code hover
[image]

Master Members (Visio)
Send feedback

Published: July 16, 2012

Represents a master in a stencil.

Events

Name | Description
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Methods

Name | Description
AddGuide | Adds a guide to a master.
BoundingBox | Returns a rectangle that tightly encloses the shapes of a master.
CenterDrawing | Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .
Close | Closes a master.
CreateSelection | Creates various types of Selection objects.
CreateShortcut | Creates a shortcut for a master.
DataGraphicDelete | Deletes the Master of type visTypeDataGraphic from the Masters collection of the document.
Delete | Deletes an object.
DrawArcByThreePoints | Creates a shape whose path consists of an arc defined by the three points passed as parameters.
DrawBezier | Creates a shape whose path is defined by the supplied sequence of Bezier control points.
DrawCircularArc | Creates a new shape whose path consists of a circular arc defined by its center, radius, and start and end angles.
DrawLine | Adds a line to the Shapes collection of a master.
DrawNURBS | Creates a new shape whose path consists of a single NURBS (nonuniform rational B-spline) segment.
DrawOval | Adds an oval (ellipse) to the Shapes collection of a master.
DrawPolyline | Creates a shape whose path is a polyline along a given set of points.
DrawQuarterArc | Creates a shape whose path consists of an elliptical arc defined by the two points and the flag passed in as arguments.
DrawRectangle | Adds a rectangle to the Shapes collection of a page, master, or group.
DrawSpline | Creates a new shape whose path follows a given sequence of points.
Drop | Creates one or more new Shape objects by dropping an object onto a receiving object such as a master, drawing page, shape, or group.
DropMany | Creates one or more new Shape objects in a master. It returns an array of the IDs of the Shape objects it produces.
DropManyU | Creates one or more new Shape objects on a page, in a master, or in a group. It returns an array of the IDs of the Shape objects it produces.
Export | Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.
ExportIcon | Exports the icon for a Master object to a named file or the Clipboard.
GetFormulas | Returns the formulas of many cells.
GetFormulasU | Returns the formulas of many cells.
GetResults | Gets the results or formulas of many cells.
Import | Imports a file into the current document.
ImportIcon | Imports the icon for a Master object from a named file.
InsertFromFile | Adds a linked or embedded object to a page, master, or group.
InsertObject | Adds a new embedded object or ActiveX control to a page, master, or group.
Layout | Lays out the shapes and/or reroutes the connectors for the page, master, group, or selection.
Open | Opens an existing master so that it can be edited.
OpenDrawWindow | Opens a new drawing window that displays a master.
OpenIconWindow | Opens an icon window that shows a master's icon.
Paste | Pastes the contents of the Clipboard into an object.
PasteSpecial | Inserts the contents of the Clipboard, allowing you to control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Word document).
PasteToLocation | Pastes a shape to the specified location.
ResizeToFitContents | Resizes the page, or the master's page, to fit tightly around the shapes or master that are on it.
SetFormulas | Sets the formulas of one or more cells.
SetResults | Sets the results or formulas of one or more cells.
VisualBoundingBox |

Properties

Name | Description
AlignName | Gets or sets the position of a master name in a stencil window. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
BaseID | Returns a base ID for a master. Read-only.
Connects | Returns a Connects collection for a shape, page, or master. Read-only.
DataGraphicHidden | Hides or displays a data graphic in the Data Graphics task pane in the Microsoft Visio user interface. Read/write.
DataGraphicHidesText | Displays or hides the text of a shape or of the primary shape in a selection when a data graphic is applied to the shape or to the selection. Read/write.
DataGraphicHorizontalPosition | Gets or sets the default horizontal callout position for members of the GraphicItems collection of the Master object of type visTypeDataGraphic. Read/write.
DataGraphicShowBorder | Gets or sets whether a border is displayed around the graphic items contained in the data graphic that are in default positions. Read/write.
DataGraphicVerticalPosition | Gets or sets the default vertical callout position for members of the GraphicItems collection of the Master object of type visTypeDataGraphic. Read/write.
Document | Gets the Document object that is associated with an object. Read-only.
EditCopy | Returns a master that is open for editing and originally copied from this master. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
GraphicItems | Returns the GraphicItems collection that the master contains. Read-only.
Hidden | Hides or shows a master on a stencil or a style in the user interface. Read/write.
Icon | Returns the icon contained in a master. Read/write.
IconSize | Gets or sets the size of a master icon. Read/write.
IconUpdate | Determines whether a master icon is updated manually or automatically. Read/write.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a Master object in the Masters collection. Read-only.
IndexInStencil | Gets or sets the index of a master or master shortcut object within its stencil. Read/write.
IsChanged | Indicates whether a master has changed since it was opened. Read-only.
Layers | Returns the Layers collection of an object. Read-only.
MatchByName | Determines how the application decides if a document master is already present when an instance of a master is dropped on the drawing page. It allows changes made to a document master to apply to new instances of the master, even if the instances are dragged from a stand-alone stencil file. Read/write.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Master object. Read/write.
NewBaseID | Generates a new base ID for a master. Read-only.
ObjectType | Returns an object's type. Read-only.
OLEObjects | Returns the OLEObjects collection of a master. Read-only.
OneD | Determines whether an object behaves as a one-dimensional (1-D) object. Read-only.
Original | Returns the original master that produced this open master. Read-only.
PageSheet | Returns the page sheet (an object that represents the ShapeSheet spreadsheet) of a master. Read-only.
PatternFlags | Determines whether a master behaves as a custom pattern. Read/write.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Picture | Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.
Prompt | Gets or sets the prompt string for a master or master shortcut. Read/write.
Shapes | Returns the Shapes collection for a page, master, or group. Read-only.
SpatialSearch | Returns a Selection object whose shapes meet certain criteria in relation to a point that is expressed in the coordinate space of a page, master, or group. Read-only.
Stat | Returns status information for an object. Read-only.
Type | Returns the type of the Master object. Read-only.
UniqueID | Returns the unique ID of a master. Read-only.


Master Properties (Visio)

 Copy code hover
[image]

Master Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlignName | Gets or sets the position of a master name in a stencil window. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
BaseID | Returns a base ID for a master. Read-only.
Connects | Returns a Connects collection for a shape, page, or master. Read-only.
DataGraphicHidden | Hides or displays a data graphic in the Data Graphics task pane in the Microsoft Visio user interface. Read/write.
DataGraphicHidesText | Displays or hides the text of a shape or of the primary shape in a selection when a data graphic is applied to the shape or to the selection. Read/write.
DataGraphicHorizontalPosition | Gets or sets the default horizontal callout position for members of the GraphicItems collection of the Master object of type visTypeDataGraphic. Read/write.
DataGraphicShowBorder | Gets or sets whether a border is displayed around the graphic items contained in the data graphic that are in default positions. Read/write.
DataGraphicVerticalPosition | Gets or sets the default vertical callout position for members of the GraphicItems collection of the Master object of type visTypeDataGraphic. Read/write.
Document | Gets the Document object that is associated with an object. Read-only.
EditCopy | Returns a master that is open for editing and originally copied from this master. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
GraphicItems | Returns the GraphicItems collection that the master contains. Read-only.
Hidden | Hides or shows a master on a stencil or a style in the user interface. Read/write.
Icon | Returns the icon contained in a master. Read/write.
IconSize | Gets or sets the size of a master icon. Read/write.
IconUpdate | Determines whether a master icon is updated manually or automatically. Read/write.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a Master object in the Masters collection. Read-only.
IndexInStencil | Gets or sets the index of a master or master shortcut object within its stencil. Read/write.
IsChanged | Indicates whether a master has changed since it was opened. Read-only.
Layers | Returns the Layers collection of an object. Read-only.
MatchByName | Determines how the application decides if a document master is already present when an instance of a master is dropped on the drawing page. It allows changes made to a document master to apply to new instances of the master, even if the instances are dragged from a stand-alone stencil file. Read/write.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Master object. Read/write.
NewBaseID | Generates a new base ID for a master. Read-only.
ObjectType | Returns an object's type. Read-only.
OLEObjects | Returns the OLEObjects collection of a master. Read-only.
OneD | Determines whether an object behaves as a one-dimensional (1-D) object. Read-only.
Original | Returns the original master that produced this open master. Read-only.
PageSheet | Returns the page sheet (an object that represents the ShapeSheet spreadsheet) of a master. Read-only.
PatternFlags | Determines whether a master behaves as a custom pattern. Read/write.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Picture | Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.
Prompt | Gets or sets the prompt string for a master or master shortcut. Read/write.
Shapes | Returns the Shapes collection for a page, master, or group. Read-only.
SpatialSearch | Returns a Selection object whose shapes meet certain criteria in relation to a point that is expressed in the coordinate space of a page, master, or group. Read-only.
Stat | Returns status information for an object. Read-only.
Type | Returns the type of the Master object. Read-only.
UniqueID | Returns the unique ID of a master. Read-only.


Master.AlignName Property (Visio)

 Copy code hover
[image]

Master.AlignName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the position of a master name in a stencil window. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .AlignName

expression A variable that represents a Master object.

Return Value

Integer

Remarks

Only user-created stencils are editable. By default, Visio stencils are not editable.

The following constants declared by the Visio type library show the possible alignment values.

Constant | Value
visLeft | 1
visCenter | 2
visRight | 3


Master.Application Property (Visio)

 Copy code hover
[image]

Master.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Master object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Master.BaseID Property (Visio)

 Copy code hover
[image]

Master.BaseID Property (Visio)
Send feedback

Published: July 16, 2012

Returns a base ID for a master. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .BaseID

expression A variable that represents a Master object.

Return Value

String

Remarks

A base ID is assigned to a master when it is created. When a master is copied, the copies all have the same base ID as the original master.

A Master object also has a UniqueID property. When a master is copied, the copy is assigned the same unique ID as the original master, and its base also ID remains the same as that of the original master. If the copy of the master gets changed, its unique ID changes its the base ID remains the same.

In addition, if you copy into a stencil a master that has the same unique ID as a master already in the stencil, Visio assigns a new unique ID to the copy.

The only way to change a master's base ID is to use the NewBaseID property.

If you know the base ID of a master, you can use the following code to retrieve the master from the Masters collection of the active document:

VBA Copy code Copy code
'Retrieve the master whose BaseID value is
'{0478DA94-1315-9876-8E4C-006523ABC9B2}
Dim vsoMaster As Visio.Master
Set vsoMaster = Visio.ActiveDocument.Masters("B{0478DA94-1315-9876-8E4C-006523ABC9B2}")

If you know the base ID or the unique ID of a master, but are not sure which kind of ID it is, you can use the following code to retrieve the master from the Masters collection of the active document:

VBA Copy code Copy code
'Retrieve the master whose UniqueID or BaseID value is
'{0478DA94-1315-9876-8E4C-006523ABC9B2}
Dim vsoMaster As Visio.Master
Set vsoMaster = Visio.ActiveDocument.Masters("A{0478DA94-1315-9876-8E4C-006523ABC9B2}")


Master.Connects Property (Visio)

 Copy code hover
[image]

Master.Connects Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Connects collection for a shape, page, or master. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Connects

expression A variable that represents a Master object.

Return Value

Connects

Remarks

The Connects collection of a shape contains every Connect object for which the shape is returned by the FromSheet property. This tells you all the shapes to which the shape is connected.

To obtain a Connects collection that contains every Connect object for which the shape is the ToSheet property, use the shape's FromConnects property. This tells you all the shapes that are connected to this shape.

The Connects collection of a page contains a Connect object for every connection on the page.

The Connects collection of a master contains a Connect object for every connection in the master.


Master.DataGraphicHidden Property (Visio)

 Copy code hover
[image]

Master.DataGraphicHidden Property (Visio)
Send feedback

Published: July 16, 2012

Hides or displays a data graphic in the Data Graphics task pane in the Microsoft Visio user interface. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataGraphicHidden

expression An expression that returns a Master object.

Return Value

Boolean

Remarks

Set the DataGraphicHidden property to True (-1) to hide a data graphic. Set the property to False (0) to display the data graphic. The default is to display the data graphic (False).

A data graphic is a Master object of type visTypeDataGraphic. Before you can set any property of a data graphic master, you must use the Master.Open method to open a copy of the data graphic master for editing. When you are finished setting properties, use the Master.Close method to commit changes.


Master.DataGraphicHidesText Property (Visio)

 Copy code hover
[image]

Master.DataGraphicHidesText Property (Visio)
Send feedback

Published: July 16, 2012

Displays or hides the text of a shape or of the primary shape in a selection when a data graphic is applied to the shape or to the selection. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataGraphicHidesText

expression An expression that returns a Master object.

Return Value

Boolean

Remarks

Setting the DataGraphicHidesText property to False (0) displays the shape text. Setting the property to True (-1) hides the text. The default is to display the text (False).

The value of the DataGraphicHidesText property corresponds to the setting of the HIde shape text when data graphic is applied box under Display options in the New Data Graphic or Edit Data Graphic dialog box.

A data graphic is a Master object of type visTypeDataGraphic. Before you can set any property of a data graphic master, you must use the Master.Open method to open a copy of the data graphic master for editing. When you are finished setting properties, use the Master.Close method to commit changes.


Master.DataGraphicHorizontalPosition Property (Visio)

 Copy code hover
[image]

Master.DataGraphicHorizontalPosition Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the default horizontal callout position for members of the GraphicItems collection of the Master object of type visTypeDataGraphic. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataGraphicHorizontalPosition

expression An expression that returns a Master object.

Return Value

VisGraphicPositionHorizontal

Remarks

The default horizontal callout position for graphic items in the GraphicItems collection of a Master object of type visTypeDataGraphic, commonly called a data graphic master, is specified by the settings of the Master.DataGraphicHorizontalPosition property. If GraphicItem.UseDataGraphicPosition is True, the graphic item is positioned according to the default setting. If UseDataGraphicPosition is False, its horizontal position is determined by the settings of the GraphicItem.HorizontalPosition property.

Note, however, that users can manually re-position a data graphic that was applied to a shape by using the control handle of the data graphic. A position set in this manner takes precedence over the position specified by property settings.

The setting of the DataGraphicHorizontalPosition property corresponds to the setting of the Horizontal box under Default position in the New Data Graphic or Edit Data Graphic dialog box in the Microsoft Visio user interface (UI).

The following possible values for the DataGraphicHorizontalPosition property are from the VisGraphicPositionHorizontal enumeration, which is declared in the Visio type library.

Constant | Value | Description
visGraphicFarLeft | 0 | The right edge of the graphic item's alignment box is aligned with the left edge of the shape's alignment box.
visGraphicLeftEdge | 1 | The vertical centerline of the graphic item's alignment box is aligned with the left edge of the shape's alignment box.
visGraphicLeft | 2 | The left edge of the graphic item's alignment box is aligned with the left edge of the shape's alignment box.
visGraphicCenter | 3 | The vertical centerline of the graphic item's alignment box is aligned with the vertical centerline of the shape's alignment box.
visGraphicRight | 4 | The right edge of the graphic item's alignment box is aligned with the right edge of the shape's alignment box.
visGraphicRightEdge | 5 | The vertical centerline of the graphic item's alignment box is aligned with the right edge of the shape's alignment box.
visGraphicFarRight | 6 | The left edge of the graphic item's alignment box is aligned with the right edge of the shape's alignment box.
Note Note

Before you can set any property of a graphic item, you must use the Master.Open method to open for editing a copy of the data graphic master whose GraphicItems collection the graphic item belongs to. When you are finished setting properties, use the Master.Close method to commit changes.


Master.DataGraphicShowBorder Property (Visio)

 Copy code hover
[image]

Master.DataGraphicShowBorder Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets whether a border is displayed around the graphic items contained in the data graphic that are in default positions. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataGraphicShowBorder

expression An expression that returns a Master object.

Return Value

Boolean

Remarks

Setting the DataGraphicShowBorder property to False (0) hides the border around graphic items contained in the data graphic that are at the default position. Setting the property to True (-1) displays the border. The default is to hide the border (False).

The value of the DataGraphicShowBorder property corresponds to the setting of the Show border around items at default position box under Display options in the New Data Graphic or Edit Data Graphic dialog box.

A data graphic is a Master object of type visTypeDataGraphic. Before you can set any property of a data graphic master, you must use the Master.Open method to open a copy of the data graphic master for editing. When you are finished setting properties, use the Master.Close method to commit changes.


Master.DataGraphicVerticalPosition Property (Visio)

 Copy code hover
[image]

Master.DataGraphicVerticalPosition Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the default vertical callout position for members of the GraphicItems collection of the Master object of type visTypeDataGraphic. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataGraphicVerticalPosition

expression An expression that returns a Master object.

Return Value

VisGraphicPositionVertical

Remarks

The default vertical callout position for graphic items in the GraphicItems collection of a Master object of type visTypeDataGraphic, commonly called a data graphic master, is specified by the settings of the Master.DataGraphicVerticalPosition property. If GraphicItem.UseDataGraphicPosition is True, the graphic item is positioned according to the default setting. If UseDataGraphicPosition is False, its vertical position is determined by the settings of the GraphicItem.VerticalPosition property.

Note, however, that users can manually re-position a data graphic that was applied to a shape by using the control handle of the data graphic. A position set in this manner takes precedence over the position specified by property settings.

The setting of the DataGraphicVerticalPosition property corresponds to the setting of the Vertical box under Default position in the New Data Graphic or Edit Data Graphic dialog box in the Microsoft Visio user interface (UI).

The following possible values for the DataGraphicVerticalPosition property are from the VisGraphicPositionVertical enumeration, which is declared in the Visio type library.

Constant | Value | Description
visGraphicBelow | 0 | The top edge of the graphic item's alignment box is aligned with the bottom edge of the shape or container's alignment box.
visGraphicBottomEdge | 1 | The horizontal centerline of the graphic item's alignment box is aligned with the bottom edge of the shape or container's alignment box.
visGraphicBottom | 2 | The bottom edge of the graphic item's alignment box is aligned with the bottom edge of the shape or container's alignment box.
visGraphicMiddle | 3 | The horizontal centerline of the graphic item's alignment box is aligned with the horizontal centerline of the shape or container's alignment box.
visGraphicTop | 4 | The top edge of the graphic item's alignment box is aligned with the top edge of the shape or container's alignment box.
visGraphicTopEdge | 5 | The horizontal centerline of the graphic item's alignment box is aligned with the top edge of the shape or container's alignment box.
visGraphicAbove | 6 | The bottom edge of the graphic item's alignment box is aligned with the top edge of the shape or container's alignment box.
Note Note

Before you can set any property of a graphic item, you must use the Master.Open method to open for editing a copy of the data graphic master whose GraphicItems collection the graphic item belongs to. When you are finished setting properties, use the Master.Close method to commit changes.


Master.Document Property (Visio)

 Copy code hover
[image]

Master.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Master object.

Return Value

Document

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Document property of various objects to retrieve data about those objects, and does the following:

  • It adds a Document object to the Documents collection and sets several of the Document object's properties.

  • It gets the active window and active page, draws a rectangle on the page, and drops a master on the Document object to provide various objects to work on.

  • It uses the Document property to get the Document object associated with each of these other objects.

VBA Copy code Copy code

Public Sub Document_Example()

 Dim vsoDocument As Visio.Document
 Dim vsoTempDocument As Visio.Document
 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoWindow As Visio.Window
 Dim vsoMaster As Visio.Master

 'Add a document to the Documents collection.
 Set vsoDocument = Documents.Add("")

 'Set the title of the document.
 vsoDocument.Title = "My Document"

 'Get the active window and active page.
 Set vsoWindow = ActiveWindow
 Set vsoPage = ActivePage

 'Draw a rectangle on the page.
 Set vsoShape = vsoPage.DrawRectangle(2, 2, 5, 5)

 'Add a master.
 Set vsoMaster = vsoDocument.Masters.Add

 'Get the Document object associated with various other objects.'Get the Document object associated with the Window object.
 Set vsoTempDocument = vsoWindow.Document

 'Get the Title property of the Document object'to verify that this is the same document we added earlier.
 Debug.Print vsoTempDocument.Title

 'Get the Document object associated with the Page object.
 Set vsoTempDocument = vsoPage.Document
 Debug.Print vsoTempDocument.Title

 'Get the Document object associated with the Shape object.
 Set vsoTempDocument = vsoShape.Document
 Debug.Print vsoTempDocument.Title

 'Get the Document object associated with the Master object.
 Set vsoTempDocument = vsoMaster.Document
 Debug.Print vsoTempDocument.Title

End Sub


Master.EditCopy Property (Visio)

 Copy code hover
[image]

Master.EditCopy Property (Visio)
Send feedback

Published: July 16, 2012

Returns a master that is open for editing and originally copied from this master. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .EditCopy

expression A variable that represents a Master object.

Return Value

Master

Remarks

If there is no master associated with the object that is open for editing, the EditCopy property returns Nothing.


Master.EventList Property (Visio)

 Copy code hover
[image]

Master.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Master object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Master.GraphicItems Property (Visio)

 Copy code hover
[image]

Master.GraphicItems Property (Visio)
Send feedback

Published: July 16, 2012

Returns the GraphicItems collection that the master contains. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GraphicItems

expression An expression that returns a Master object.

Return Value

GraphicItems

Remarks

The master must be of type visTypeDataGraphic.


Master.Hidden Property (Visio)

 Copy code hover
[image]

Master.Hidden Property (Visio)
Send feedback

Published: July 16, 2012

Hides or shows a master on a stencil or a style in the user interface. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Hidden

expression A variable that represents a Master object.

Return Value

Integer

Remarks

A master that is hidden still appears in the Drawing Explorer window.


Master.Icon Property (Visio)

 Copy code hover
[image]

Master.Icon Property (Visio)
Send feedback

Published: July 16, 2012

Returns the icon contained in a master. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .Icon

expression A variable that represents a Master object.

Return Value

IPictureDisp

Remarks

The Icon property returns and accepts only HICON files. Microsoft Visio raises an exception if the object returned is a non-HICON file.

COM provides a standard implementation of a picture object that has the IPictureDisp interface on top of the underlying system picture support. The IPictureDisp interface exposes a picture object's properties and is implemented in the stdole type library as a StdPicture object creatable within Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic for Applications (VBA) projects in Visio.

To get information about the StdPicture object that supports the IPictureDisp interface:

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click stdole.

  4. Under Classes, examine the class named StdPicture.

For details about the IPictureDisp interface, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.

Currently, only in-process solutions can use the Icon property because the IPictureDisp interface cannot be marshaled.


Master.IconSize Property (Visio)

 Copy code hover
[image]

Master.IconSize Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the size of a master icon. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .IconSize

expression A variable that represents a Master object.

Return Value

Integer

Remarks

The following constants declared by the Visio type library in VisMasterProperties show the possible values for the IconSize property.

Constant | Value
visNormal | 1
visTall | 2
visWide | 3
visDouble | 4


Master.IconUpdate Property (Visio)

 Copy code hover
[image]

Master.IconUpdate Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a master icon is updated manually or automatically. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .IconUpdate

expression A variable that represents a Master object.

Return Value

Integer

Remarks

The following constants declared by the Visio type library in VisMasterProperties show the possible values for the IconUpdate property.

Constant | Value | Description
visManual | 0 | Update icon manually.
visAutomatic | 1 | Update icon automatically from shape geometry data.


Master.ID Property (Visio)

 Copy code hover
[image]

Master.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ID of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ID

expression A variable that represents a Master object.

Return Value

Long

Remarks

The ID of a shape is unique only within the scope of the page or master. The ID of a page, master, or style is unique within the scope of the document.

If a shape, page, master, or style is deleted, future objects in the same scope may be assigned the same ID. Therefore, persisting shape or style IDs in separate data stores is generally not as sound as persisting unique IDs using the UniqueID property.


Master.Index Property (Visio)

 Copy code hover
[image]

Master.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Master object in the Masters collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Master object.

Return Value

Integer

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Master.IndexInStencil Property (Visio)

 Copy code hover
[image]

Master.IndexInStencil Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the index of a master or master shortcut object within its stencil. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .IndexInStencil

expression A variable that represents a Master object.

Return Value

Integer

Remarks

Beginning with Visio 2000, the document stencil window shows all Master and MasterShortcut objects in a Visio document. The Visio object model exposes the Master and MasterShortcut objects in a Document object as two distinct collections. The index returned by a Master object is its index with respect to other Master objects in its Document object and is unrelated to the presence or absence of MasterShortcut objects in the document. The index returned by a MasterShortcut object is its index with respect to other MasterShortcut objects in its Document object and is unrelated to the presence or absence of Master objects in the document.

Use the IndexInStencil property to maintain the relative order of Master and MasterShortcut objects when considered as a single collection.

Note Note

Beginning with Microsoft Office Visio 2003, only user-created stencils are editable. By default, Visio stencils are not editable.


Master.IsChanged Property (Visio)

 Copy code hover
[image]

Master.IsChanged Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether a master has changed since it was opened. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .IsChanged

expression A variable that represents a Master object.

Return Value

Boolean


Master.Layers Property (Visio)

 Copy code hover
[image]

Master.Layers Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Layers collection of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Layers

expression A variable that represents a Master object.

Return Value

Layers

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Layers property to add shapes to layers. It also uses the Layer property to get a reference to a particular layer, the LayerCount property to determine the number of layers to which a shape is assigned, and the Name property to get the name of the current layer.

VBA Copy code Copy code

Public Sub Layers_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoLayer As Visio.Layer
 Dim vsoLayers As Visio.Layers

 If ActiveDocument Is Nothing Then
 Documents.Add ("")
 End If

 Set vsoPage = ActivePage
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Get the Layers collection.
 Set vsoLayers = vsoPage.Layers

 'Create a layer named ExampleLayer1 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer1")
 vsoLayer.Add vsoShape, 1

 'Create a layer named ExampleLayer2 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer2")
 vsoLayer.Add vsoShape, 1

 'Verify that the shape has been assigned to 2 layers.
 Debug.Print "The shape is assigned to " & vsoShape.LayerCount & " layers."

 'Get a reference to the first layer.
 Set vsoLayer = vsoShape.Layer(1)

 'Verify by using the Name property.
 Debug.Print "Current layer name is """ & vsoLayer.Name & "."""

End Sub


Master.MatchByName Property (Visio)

 Copy code hover
[image]

Master.MatchByName Property (Visio)
Send feedback

Published: July 16, 2012

Determines how the application decides if a document master is already present when an instance of a master is dropped on the drawing page. It allows changes made to a document master to apply to new instances of the master, even if the instances are dragged from a stand-alone stencil file. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .MatchByName

expression A variable that represents a Master object.

Return Value

Integer

Remarks

Setting the MatchByName property is equivalent to selecting or clearing the Match master by name on drop check box in the Master Properties dialog box (right-click the master, point to Edit Master, and then click Master Properties on the shortcut menu).

Suppose you create an instance of a master from a stencil in a document (producing a local copy of the master in that document) and then make modifications to the document master (such as changing its fill color). If the MatchByName property of the document master is False, dragging the original master from the stand-alone stencil into the drawing creates an instance that has the stand-alone master's attributes and produces a second document master.

If the MatchByName property of the document master is True, dragging the original master from the stand-alone stencil into the drawing creates an instance that has the document master's attributes and doesn't produce a second document master.


Master.Name Property (Visio)

 Copy code hover
[image]

Master.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a Master object.

Return Value

String

Remarks

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Master.NameU Property (Visio)

 Copy code hover
[image]

Master.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of a Master object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .NameU

expression A variable that represents a Master object.

Return Value

String

Remarks

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Master.NewBaseID Property (Visio)

 Copy code hover
[image]

Master.NewBaseID Property (Visio)
Send feedback

Published: July 16, 2012

Generates a new base ID for a master. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .NewBaseID

expression A variable that represents a Master object.

Return Value

String


Master.ObjectType Property (Visio)

 Copy code hover
[image]

Master.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Master object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Master.OLEObjects Property (Visio)

 Copy code hover
[image]

Master.OLEObjects Property (Visio)
Send feedback

Published: July 16, 2012

Returns the OLEObjects collection of a master. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .OLEObjects

expression A variable that represents a Master object.

Return Value

OLEObjects

Remarks

The OLEObjects property returns an OLEObjects collection that includes any OLE 2.0 linked or embedded objects or ActiveX controls contained in a document, master, or page.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the OLEObjects collection of an active page and print the ClassID and ProgID for each OLEObject object in the Immediate window. This example assumes that the active page contains at least one OLE 2.0 embedded or linked object or an ActiveX control.

VBA Copy code Copy code

Public Sub OLEObjects_Example()

 Dim intCounter As Integer
 Dim vsoOLEObjects As Visio.OLEObjects

 'Get the OLEObjects collection of the active page.
 Set vsoOLEObjects = ActivePage.OLEObjects

 'Step through the collection of OLEObjects on the page.
 For intCounter = 1 To vsoOLEObjects.Count
 Debug.Print vsoOLEObjects(intCounter).ClassID
 Debug.Print vsoOLEObjects(intCounter).ProgID
 Next intCounter

End Sub


Master.OneD Property (Visio)

 Copy code hover
[image]

Master.OneD Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object behaves as a one-dimensional (1-D) object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .OneD

expression A variable that represents a Master object.

Return Value

Integer

Remarks

Setting the OneD property is equivalent to changing a shape's interaction style in the Behavior dialog box (click Behavior in the Shape Design group of the Developer tab). Setting the OneD property for a 1-D shape to False deletes its 1-D Endpoints section, even if the cells in that section were protected with the GUARD function.

You can get, but not set, the OneD property of a Master object.

The OneD property of a Shape object that is a guide is always 0. If you try to change the value of the OneD property of a guide shape, no error is raised, but the value remains 0.

The OneD property of an object from another application is always False.


Master.Original Property (Visio)

 Copy code hover
[image]

Master.Original Property (Visio)
Send feedback

Published: July 16, 2012

Returns the original master that produced this open master. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .Original

expression A variable that represents a Master object.

Return Value

Master

Remarks

If this Master object is not an open copy of another Master object, the Original property returns Nothing.


Master.PageSheet Property (Visio)

 Copy code hover
[image]

Master.PageSheet Property (Visio)
Send feedback

Published: July 16, 2012

Returns the page sheet (an object that represents the ShapeSheet spreadsheet) of a master. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .PageSheet

expression A variable that represents a Master object.

Return Value

Shape

Remarks

Every master contains a tree of Shape objects. Constants representing shape types are prefixed with visType and are declared by the Visio type library in VisShapeTypes.

In the tree of shapes of a master, there is exactly one shape of type visTypePage. This shape is always the root shape in the tree, and the PageSheet property returns this shape.

The page sheet contains important settings for the master such as its size and scale. It also contains the Layers section that defines the layers for that master.

Assuming that there is at least one shape on the page, you can use the following macro to get a master's page shape:

VBA Copy code Copy code
Sub MasterPageSheet_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoMaster As Visio.Master
 Set vsoMaster = ActiveDocument.Masters.Item(1)
 Set vsoShapes = vsoMaster.Shapes
 Set vsoShape = vsoShapes("ThePage")

End Sub


Master.PatternFlags Property (Visio)

 Copy code hover
[image]

Master.PatternFlags Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a master behaves as a custom pattern. Read/write.

Version Information

Version Added: Visio 5.0

Syntax

expression .PatternFlags

expression A variable that represents a Master object.

Return Value

Integer

Remarks

Microsoft Visio allows a master to be used as a custom line pattern, line end, or fill pattern.

The PatternFlags property determines whether you can use a master as a pattern (non-zero); whether it is a line, fill, or line end pattern; and which pattern mode to use when applying it to shapes.

If you can use the PatternFlags property as a pattern (non-zero), the property can include a combination of the following bits.

Constant | Value | Description
visMasIsLinePat | &H1 | Line pattern
visMasIsLineEnd | &H2 | Line end pattern
visMasIsFillPat | &H4 | Fill pattern

If visMasIsLinePat is selected, the pattern mode should be one of the following values.

Constant | Value
visMasLPTileDeform | &H0
visMasLPTile | &H10
visMasLPStretch | &H20
visMasLPAnnotate | &H30

In addition, visMasLPScale (&H40) can optionally be included in the PatternFlags property value.

If visMasIsLineEnd is selected, the pattern mode should be one of the following values.

Constant | Value
visMasLEDefault | &H0
visMasLEUpright | &H100

In addition, visMasLEScale (&H400) can optionally be included in the PatternFlags property value.

If visMasIsFillPat is selected, the pattern mode should be one of the following values.

Constant | Value
visMasFPTile | &H0
visMasFPCenter | &H1000
visMasFPStretch | &H2000

In addition, visMasFPScale (&H4000) can optionally be included in the PatternFlags property value.


Master.PersistsEvents Property (Visio)

 Copy code hover
[image]

Master.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Master object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Master.Picture Property (Visio)

 Copy code hover
[image]

Master.Picture Property (Visio)
Send feedback

Published: July 16, 2012

Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .Picture

expression A variable that represents a Master object.

Return Value

IPictureDisp

Remarks

The Picture property returns only EMF files.

COM provides a standard implementation of a picture object that has the IPictureDisp interface on top of the underlying system picture support. The IPictureDisp interface exposes a picture object's properties and is implemented in the stdole type library as a StdPicture object creatable within Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic for Applications (VBA) projects in Microsoft Visio.

Currently, only in-process solutions can use the Picture property because the IPictureDisp interface cannot be marshaled.

To get information about the StdPicture object that supports the IPictureDisp interface

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click stdole.

  4. Under Classes, examine the class named StdPicture.

For details about the IPictureDisp interface, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Master.Prompt Property (Visio)

 Copy code hover
[image]

Master.Prompt Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the prompt string for a master or master shortcut. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Prompt

expression A variable that represents a Master object.

Return Value

String


Master.Shapes Property (Visio)

 Copy code hover
[image]

Master.Shapes Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shapes collection for a page, master, or group. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Shapes

expression A variable that represents a Master object.

Return Value

Shapes

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Shapes property to get the Shapes collection. It prints the names of all shapes on Page1 in the Immediate window.

To run this macro, make sure the active document has shapes on Page1.

VBA Copy code Copy code

Public Sub Shapes_Example()

 Dim intCounter As Integer
 Dim intShapeCount As Integer
 Dim vsoShapes As Visio.Shapes

 Set vsoShapes = ActiveDocument.Pages.Item(1).Shapes

 Debug.Print "Shapes in document: "; ActiveDocument.Name
 Debug.Print "On page: "; ActiveDocument.Pages.Item(1).Name

 intShapeCount = vsoShapes.Count

 If intShapeCount > 0 Then
 For intCounter = 1 To intShapeCount
 Debug.Print " "; vsoShapes.Item(intCounter).Name
 Next intCounter

 Else
 Debug.Print "No Shapes On Page"
 End If

End Sub


Master.SpatialSearch Property (Visio)

 Copy code hover
[image]

Master.SpatialSearch Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Selection object whose shapes meet certain criteria in relation to a point that is expressed in the coordinate space of a page, master, or group. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .SpatialSearch(x, y, Relation, Tolerance, Flags)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Double | The x-coordinate.
y | Required | Double | The y-coordinate.
Relation | Required | Integer | Any combination of the values of the constants visSpatialContainedIn and visSpatialTouching.
Tolerance | Required | Double | A distance in internal drawing units with respect to the coordinate space.
Flags | Required | Integer | Flags that influence the result.

Return Value

Selection

Remarks

  • The relation argument can be any combination of the constants defined in VisSpatialRelationCodes. If relation is not specified, the SpatialSearch property uses both relationships as criteria.

  • The flags argument can be any combination of the values of the constants defined in VisSpatialRelationFlags in the Visio type library (except visSpatialIncludeHidden, which is reserved for future use, and should not be used).

Use the NoShow cell to determine whether a Geometry section is hidden or visible. Hidden Geometry section sections have a value of TRUE and visible Geometry sections have a value of FALSE in the NoShow cell.

Beginning with Microsoft Visio 2002, if flags contains visSpatialFrontToBack, items in the Selection object returned by the SpatialNeighbors property are ordered front to back. If visSpatialBackToFront is set, the items returned are ordered back to front. If this flag is not set, or if you are running an earlier version of Visio, the order is unpredictable. You can determine the order by using the Index property of the shapes identified in the Selection object.

Note Note

When it compares two shapes, the SpatialSearch property does not consider the width of a shape's line, shadows, line ends, control points, or connection points.


Master.Stat Property (Visio)

 Copy code hover
[image]

Master.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Master object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Master.Type Property (Visio)

 Copy code hover
[image]

Master.Type Property (Visio)
Send feedback

Published: July 16, 2012

Returns the type of the Master object. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .Type

expression A variable that represents a Master object.

Return Value

VisMasterTypes

Remarks

Type value constants for Master objects (the possible values that the Type property of a Master object returns) are declared by the Visio type library in VisMasterTypes.


Master.UniqueID Property (Visio)

 Copy code hover
[image]

Master.UniqueID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the unique ID of a master. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .UniqueID

expression An expression that returns a Master object.

Return Value

String

Remarks

A Master object always has a unique ID. If you copy a master, the new master has the same unique ID as the original master (as well as the same base ID). However, if you subsequently change the copy, Visio assigns it a new unique ID, but its base ID remains the same.

Note that if you copy into a stencil a master that has the same unique ID as a master already in the stencil, Visio assigns a new unique ID to the copy.

For more information about the base ID, see the BaseID property.

You can determine a Master object's unique ID by using the following code:

VBA Copy code Copy code
strID = vsoMaster.UniqueID

The value it returns is a string in the following form:

VBA Copy code Copy code
{2287DC42-B167-11CE-88E9-0020AFDDD917}

To get a master if you know its unique ID, use Masters.Item(UniqueIDString) .

For example, you can use the following code to retrieve the master from the Masters collection of the active document:

VBA Copy code Copy code
Dim vsoMaster As Visio.Master
Set vsoMaster = Visio.ActiveDocument.Masters("{0478DA94-1315-9876-8E4C-006523ABC9B2}")

Alternatively, you can use the following code, which adds the letter "U" before the string to identify it as a unique ID:

VBA Copy code Copy code
Dim vsoShape As Visio.Shape
Set vsoMaster = Visio.ActiveDocument.Masters("U{0478DA94-1315-9876-8E4C-006523ABC9B2}")


Master Methods (Visio)

 Copy code hover
[image]

Master Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddGuide | Adds a guide to a master.
BoundingBox | Returns a rectangle that tightly encloses the shapes of a master.
CenterDrawing | Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .
Close | Closes a master.
CreateSelection | Creates various types of Selection objects.
CreateShortcut | Creates a shortcut for a master.
DataGraphicDelete | Deletes the Master of type visTypeDataGraphic from the Masters collection of the document.
Delete | Deletes an object.
DrawArcByThreePoints | Creates a shape whose path consists of an arc defined by the three points passed as parameters.
DrawBezier | Creates a shape whose path is defined by the supplied sequence of Bezier control points.
DrawCircularArc | Creates a new shape whose path consists of a circular arc defined by its center, radius, and start and end angles.
DrawLine | Adds a line to the Shapes collection of a master.
DrawNURBS | Creates a new shape whose path consists of a single NURBS (nonuniform rational B-spline) segment.
DrawOval | Adds an oval (ellipse) to the Shapes collection of a master.
DrawPolyline | Creates a shape whose path is a polyline along a given set of points.
DrawQuarterArc | Creates a shape whose path consists of an elliptical arc defined by the two points and the flag passed in as arguments.
DrawRectangle | Adds a rectangle to the Shapes collection of a page, master, or group.
DrawSpline | Creates a new shape whose path follows a given sequence of points.
Drop | Creates one or more new Shape objects by dropping an object onto a receiving object such as a master, drawing page, shape, or group.
DropMany | Creates one or more new Shape objects in a master. It returns an array of the IDs of the Shape objects it produces.
DropManyU | Creates one or more new Shape objects on a page, in a master, or in a group. It returns an array of the IDs of the Shape objects it produces.
Export | Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.
ExportIcon | Exports the icon for a Master object to a named file or the Clipboard.
GetFormulas | Returns the formulas of many cells.
GetFormulasU | Returns the formulas of many cells.
GetResults | Gets the results or formulas of many cells.
Import | Imports a file into the current document.
ImportIcon | Imports the icon for a Master object from a named file.
InsertFromFile | Adds a linked or embedded object to a page, master, or group.
InsertObject | Adds a new embedded object or ActiveX control to a page, master, or group.
Layout | Lays out the shapes and/or reroutes the connectors for the page, master, group, or selection.
Open | Opens an existing master so that it can be edited.
OpenDrawWindow | Opens a new drawing window that displays a master.
OpenIconWindow | Opens an icon window that shows a master's icon.
Paste | Pastes the contents of the Clipboard into an object.
PasteSpecial | Inserts the contents of the Clipboard, allowing you to control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Word document).
PasteToLocation | Pastes a shape to the specified location.
ResizeToFitContents | Resizes the page, or the master's page, to fit tightly around the shapes or master that are on it.
SetFormulas | Sets the formulas of one or more cells.
SetResults | Sets the results or formulas of one or more cells.
VisualBoundingBox |


Master.AddGuide Method (Visio)

 Copy code hover
[image]

Master.AddGuide Method (Visio)
Send feedback

Published: July 16, 2012

Adds a guide to a master.

Version Information

Version Added: Visio 2.0

Syntax

expression .AddGuide(Type, xPos, yPos)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | Integer | The type of guide to add.
xPos | Required | Double | The x-coordinate of a point on the guide.
yPos | Required | Double | The y-coordinate of a point on the guide.

Return Value

Shape

Remarks

To view guides you add to a master by using the AddGuide method, use the OpenDrawWindow method to open the Master Editing window.

The following constants declared by the Visio type library are valid values for guide types.

Constant | Value | Description
visPoint | 1 | Guide point
visHorz | 2 | Horizontal guide
visVert | 3 | Vertical guide


Master.BoundingBox Method (Visio)

 Copy code hover
[image]

Master.BoundingBox Method (Visio)
Send feedback

Published: July 16, 2012

Returns a rectangle that tightly encloses the shapes of a master.

Version Information

Version Added: Visio 4.5

Syntax

expression .BoundingBox(Flags, lpr8Left, lpr8Bottom, lpr8Right, lpr8Top)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Required | Integer | Flags that influence the bounding box calculated for each shape that contributes to the resulting bounding box.
lpr8Left | Required | Double | Returns the x-coordinate of the left edge of the bounding box.
lpr8Bottom | Required | Double | Returns the y-coordinate of the bottom edge of the bounding box.
lpr8Right | Required | Double | Returns the x-coordinate of the right edge of the bounding box.
lpr8Top | Required | Double | Returns the y-coordinate of the top edge of the bounding box.

Return Value

Nothing

Remarks

For a Shape object, the BoundingBox method returns a rectangle that tightly encloses the shape and its subshapes.

For a Page, Master, or Selection object, the BoundingBox method returns a rectangle that tightly encloses the page's, master's, or selection's shapes and their subshapes.

If the BoundingBox method returns an error, or if it is asked to return the rectangle enclosing zero shapes, the rectangle returned is { left: 0, bottom: 0, right: -1, top: -1 }; otherwise, the rectangle returned has left less than or equal to (<=) right, and bottom less than or equal to (<=) top. The numbers returned are in internal units (inches).

The bounding rectangle returned for an individual shape depends on its Type property.

Constant | Description
visTypePage | Equivalent to Page.BoundingBox or Master.BoundingBox.
visTypeGroup | Rectangle that tightly encloses the group and its subshapes.
visTypeShape | Determined rectangle depends on flags. See the following table.
visTypeForeignObject | Determined rectangle depends on flags. See the following table.
visTypeGuide | Determined rectangle depends on flags. See the following table.

The method will raise an exception for object type visTypeDoc.

The Flags argument has several bits that control the bounding box retrieved for each shape. If more than one of the bits described in the following table is set, the rectangle determined for the shape covers all rectangles implied by the bits.

Flag | Value | Description
visBBoxUprightWH | &H1 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the shape's width-height box.If the shape is not rotated, its upright width-height box and its width-height box are the same. Paths in the shape's geometry need not and often do not lie entirely within the shape's width-height box.
visBBoxUprightText | &H2 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the shape's text.
visBBoxExtents | &H4 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the paths stroked by the shape's geometry.This may be larger or smaller than the shape's upright width-height box. The extents box determined for a shape of type visTypeForeignObject equals that shape's upright width-height box.
visBBoxIncludeHidden | &H10 | Includes hidden geometry.
visBBoxIgnoreVisible | &H20 | Ignores visible geometry.
visBBoxIncludeDataGraphics | &H10000 | Includes data-graphic callout shapes (and their sub-shapes) that are applied to the shapes of the master. Off by default.
visBBoxIncludeGuides | &H1000 | Includes extents for shapes of type visTypeguide. By default, the extents of shapes of type visTypeGuide are ignored.If you request guide extents, then only the x positions of vertical guides and the y positions of horizontal guides contribute to the rectangle that is returned. If any vertical guides are reported on, an infinite y extent is returned. If any horizontal guides are reported on, an infinite x extent is returned. If any rotated guides are reported on, infinite x and y extents are returned.
visBBoxDrawingCoords | &H2000 | Returns numbers in the drawing coordinate system of the page or master whose shapes are being considered. By default, the returned numbers are drawing units in the local coordinate system of the parent of the considered shapes.
visBBoxNoNonPrint | &H4000 | Ignores the extents of shapes that are nonprinting. A shape is nonprinting if the value of its NonPrinting cell is non-zero or it belongs only to nonprinting layers.

The extents rectangle is determined using the center of the shape's strokes; it does not take into account the width of the strokes. Nor does the rectangle include any area covered by shadows or line end markers. Microsoft Visio does not expose a means to determine a shape's "black bits" box, that is, the extents box adjusted to account for stroke widths, shadows, and line ends.

A shape may have control points or connection points that lie outside any of the bounding rectangles reported by the shape. You can determine the position of control points and connection points by querying results of the shape's cells.

Example

The following procedure prints the dimensions of the bounding box of the selected shape in the Immediate window. If more than one shape is selected in the active window, a message box indicating an error is displayed. In all cases, results are reported in the drawing units of the page or master to which the shape belongs. This means that if the shape is a subshape of a group, visBBoxDrawingCoords is passed as a flag to the BoundingBox method.

If the shape is a guide, the procedure passes visBBoxIncludeGuides to the BoundingBox method so that the shape will be considered to have extent. Three rectangles are reported for the shape:

  • visBBoxUprightWH: an upright box that encloses the shape's width-height box

  • visBBoxUprightText: an upright box that encloses the shape's text box

  • visBBoxExtents: an upright box that encloses the shape's paths

To run this macro, make sure exactly one shape is selected on the Visio drawing page.

VBA Copy code Copy code

Public Sub BoundingBox_Example()

 Dim vsoSelection As Visio.Selection
 Set vsoSelection = ActiveWindow.Selection
 vsoSelection.IterationMode = visSelModeSkipSub

 If vsoSelection.Count <> 1 Then
 MsgBox "BoundingBox_Example() expects exactly one selected shape."

 Else

 Dim vsoShape As Visio.Shape
 Set vsoShape = vsoSelection(1)
 Dim intFlags As Integer
 intFlags = 0

 If vsoShape.ContainingShape.Type = visTypeGroup Then

 intFlags = visBBoxDrawingCoords

 End If

 If vsoShape.Type = visTypeGuide Then

 intFlags = intFlags + visBBoxIncludeGuides

 End If

 Dim dblTop As Double
 Dim dblBottom As Double
 Dim dblLeft As Double
 Dim dblRight As Double

 vsoShape.BoundingBox intFlags + visBBoxUprightWH, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Upright WH "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 vsoShape.BoundingBox intFlags + visBBoxUprightText, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Upright text "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 vsoShape.BoundingBox intFlags + visBBoxExtents, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Bounding Box "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 End If

End Sub

The following macro uses the BoundingBox method and the ShapesOverlap() function to determine if one shape (vsoShape2) overlaps another (vsoShape1).

VBA Copy code Copy code
Public Sub OverlappingShapes_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim blsIsOverlapping As Boolean

 Set vsoShape1 = Application.ActiveWindow.Page.Drop(Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Square"), 3, 9)

 Set vsoShape2 = Application.ActiveWindow.Page.Drop(Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3, 8)

 blsIsOverlapping = ShapesOverlap(vsoShape2, vsoShape1)

 If blsIsOverlapping Then
 Debug.Print "Shapes overlap."
 Else
 Debug.Print "Shapes do not overlap."
 End If

End Sub

Private Function ShapesOverlap(vsoShape1 As IVShape, vsoShape2 As IVShape) As Boolean

 Dim dblLeft1 As Double
 Dim dblLeft2 As Double
 Dim dblBottom1 As Double
 Dim dblBottom2 As Double
 Dim dblRight1 As Double
 Dim dblRight2 As Double
 Dim dblTop1 As Double
 Dim dblTop2 As Double

 vsoShape1.BoundingBox Flags + visBBoxExtents, dblLeft1, dblBottom1, dblRight1, dblTop1
 vsoShape2.BoundingBox Flags + visBBoxExtents, dblLeft2, dblBottom2, dblRight2, dblTop2

 If ((dblLeft2 >= dblLeft1 And dblLeft2 <= dblRight1) Or _
 (dblRight2 >= dblLeft1 And dblRight2 <= dblRight1)) And _
 ((dblTop2 >= dblBottom1 And dblTop2 <= dblTop1) Or _
 (dblBottom2 >= dblBottom1 And dblBottom2 <= dblTop1)) Then
 ShapesOverlap = True
 Else
 ShapesOverlap = False
 End If

End Function


Master.CenterDrawing Method (Visio)

 Copy code hover
[image]

Master.CenterDrawing Method (Visio)
Send feedback

Published: July 16, 2012

Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .

Version Information

Version Added: Visio 4.0

Syntax

expression .CenterDrawing

expression A variable that represents a Master object.

Return Value

Nothing

Remarks

Centering shapes does not change their position relative to each other.


Master.Close Method (Visio)

 Copy code hover
[image]

Master.Close Method (Visio)
Send feedback

Published: July 16, 2012

Closes a master.

Version Information

Version Added: Visio 2.0

Syntax

expression .Close

expression A variable that represents a Master object.

Return Value

Nothing

Remarks

Use the Close method for a Master object after opening a master for editing using the Open method. The Close method pushes any changes made to the master while it was open to instances of the master.

Example

This example shows how to close all open ShapeSheet windows. It assumes at least one ShapeSheet window is open in Microsoft Visio.

VBA Copy code Copy code

Public Sub Close_Example()
 Dim intCounter As Integer
 intCounter = Windows.Count

 'Close all ShapeSheet windows that are open.
 While intCounter <> 0
 If Windows(intCounter).Type = visSheet Then
 Windows(intCounter).Close
 intCounter = Windows.Count
 Else
 intCounter = intCounter - 1
 End If
 Wend
End Sub


Master.CreateSelection Method (Visio)

 Copy code hover
[image]

Master.CreateSelection Method (Visio)
Send feedback

Published: July 16, 2012

Creates various types of Selection objects.

Version Information

Version Added: Visio 2003

Syntax

expression .CreateSelection(SelType, IterationMode, [Data])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
SelType | Required | VisSelectionTypes | The type of selection. See Remarks for possible values.
IterationMode | Optional | VisSelectMode | The selection mode used. See Remarks for possible values.
Data | Optional | Variant | The object type that corresponds to the SelType argument. See Remarks for possible values.

Return Value

Selection

Remarks

The CreateSelection method makes it possible to create complex selections programmatically. So instead of having to select all shapes on a page, for example, you can select only those on a given layer, or only those based on a certain master.

Calling the CreateSelection method with SelType equal to visSelTypeByType or visSelTypeByLayer is equivalent to selecting options in the Select byType dialog box (click Select in the Editing group on the Home tab, and then click Select by Type).

The SelType argument should be one of the following values, which are declared in VisSelectionTypes in the Visio type library.

Constant | Value | Description
visSelTypeAll | 1 | A selection that initially contains all shapes.
visSelTypeByDataGraphic | 6 | A selection that initially contains all shapes that have a given type of data graphic appled.
visSelTypeByLayer | 3 | A selection that initially contains all the shapes of a given layer.
visSelTypeByMaster | 5 | A selection that initially contains all the instantiated shapes of a given master.
visSelTypeByRole | 7 | A selection that initially contains all the shapes of a given role.
visSelTypeByType | 4 | A selection that initially contains all the shapes of a given type.
visSelTypeEmpty | 0 | A selection that initially contains no shapes.
visSelTypeSingle | 2 | A selection that initially contains one shape.

The optional IterationMode argument should be one of the following values, which are declared in VisSelectMode in the Visio type library. The default is visSelModeSkipSuper.

Constant | Value | Description
visSelModeOnlySub | &H0800 | Selection only reports subselected shapes.
visSelModeOnlySuper | &H0200 | Selection only reports superselected shapes.
visSelModeSkipSub | &H0400 | Selection does not report subselected shapes.
visSelModeSkipSuper | &H0100 | Selection does not report superselected shapes.

The optional Data argument should be an object that corresponds to the object type specified by SelType. For example, if you want to select all the masters of a certain type, Data should be of type Master. And if you want to select all the shapes on a certain layer, Data should be of type Layer.

When SelType is visSelTypeByRole, Data should be a member of the VisRoleSelectionTypes enumeration.

When the SelType argument is visSelTypeByType, possible Data values should be one of the following values, which are declared in VisTypeSelectionTypes in the Visio type library.

Constant | Value | Description
visTypeSelBitmap | 16 | A shape that is a bitmap.
visTypeSelGroup | 1 | A shape that contains other shapes.
visTypeSelGuide | 4 | A shape that is a guide.
visTypeSelInk | 32 | A shape that is ink.
visTypeSelMetafile | 8 | A shape that is a metafile.
visTypeSelOLE | 64 | A shape that is linked, embedded, or a control.
visTypeSelShape | 2 | A native Visio shape.


Master.CreateShortcut Method (Visio)

 Copy code hover
[image]

Master.CreateShortcut Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shortcut for a master.

Version Information

Version Added: Visio 2000

Syntax

expression .CreateShortcut

expression A variable that represents a Master object.

Return Value

MasterShortcut

Remarks

The new master shortcut is created in the same document as the target master and is added to the document's MasterShortcuts collection. If you are trying to create a shortcut in a stencil, the stencil must therefore be editable for this method to succeed.

Note Note

Starting with Microsoft Office Visio 2003, only user-created stencils are editable. By default, Visio stencils are not editable.

The new shortcut's name is "Shortcut to X", where "X" is the name of the target master. The shortcut's TargetDocumentName and TargetMasterName properties identify the target master. So once a shortcut has been created, it can be moved or copied into other documents.

You cannot create a shortcut to a master in an unsaved stencil. If you try to do so, the CreateShortcut method returns an error.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the CreateShortcut method to create a shortcut to a master. This example assumes that you have created a stencil named "SampleStencil.vss" containing a master named "SampleMaster" and saved it to the C drive on your computer.

VBA Copy code Copy code

Public Sub CreateShortcut_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoMasterShortcut As MasterShortcut

 Set vsoApplication = ActiveDocument.Application
 Set vsoMasterShortcut = vsoApplication.Documents("C:\SampleStencil.vss").Masters("SampleMaster").CreateShortcut

End Sub


Master.DataGraphicDelete Method (Visio)

 Copy code hover
[image]

Master.DataGraphicDelete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes the Master of type visTypeDataGraphic from the Masters collection of the document.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataGraphicDelete

expression An expression that returns a Master object.

Return Value

Nothing

Remarks

The DataGraphicDelete method deletes the data graphic master and removes the data graphic from all shapes in the drawing to which it has been applied. The Master.Delete method deletes only the data graphic master, leaving data graphics based on the master and already applied to shapes in the drawing intact.

Calling the DataGraphicDelete method is the equivalent of right-clicking a data graphic in the Data Graphics task pane in the Microsoft Visio user interface and then clicking Delete on the context menu.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the DataGraphicDelete to delete a Master of type visTypeDataGraphic from the Masters collection of the active document. The data graphic master deleted in this example is named "Data Graphic." You can determine the name of a data graphic master by pausing your mouse over a data graphic thumbnail in the Data Graphics task pane.

VBA Copy code Copy code
Public Sub DataGraphicDelete_example()

    Dim vsoMaster As Visio.Master

    Set vsoMaster = ActiveDocument.Masters("Data Graphic")
    vsoMaster.DataGraphicDelete

End Sub


Master.Delete Method (Visio)

 Copy code hover
[image]

Master.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a Master object.

Return Value

Nothing


Master.DrawArcByThreePoints Method (Visio)

 Copy code hover
[image]

Master.DrawArcByThreePoints Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path consists of an arc defined by the three points passed as parameters.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawArcByThreePoints(xBegin, yBegin, xEnd, yEnd, xControl, yControl)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
xBegin | Required | Double | The x-coordinate of the begin point of the arc.
yBegin | Required | Double | The y-coordinate of the begin point of the arc.
xEnd | Required | Double | The x-coordinate of the endpoint of the arc.
yEnd | Required | Double | The y-coordinate of the endpoint of the arc.
xControl | Required | Double | The x-coordinate of the control point of the arc.
yControl | Required | Double | The y-coordinate of the control point of the arc.

Return Value

Shape

Remarks

All points should be in internal drawing units with respect to the coordinate space of the master, page, or group where the shape is being drawn.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the DrawArcByThreePoints method to draw an arc on the drawing page.

VBA Copy code Copy code
Public Sub DrawArcByThreePoints_Example

 Dim vsoShape As Visio.Shape
 Set vsoShape = ActivePage.DrawArcByThreePoints(3, 3, 6, 8, 5, 5)

End Sub


Master.DrawBezier Method (Visio)

 Copy code hover
[image]

Master.DrawBezier Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path is defined by the supplied sequence of Bezier control points.

Version Information

Version Added: Visio 4.1

Syntax

expression .DrawBezier(xyArray(), degree, Flags)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
xyArray() | Required | Double | An array of alternating x and y values that define the Bezier control points for the new shape.
degree | Required | Integer | The degree of the Bezier curve.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Shape

Remarks

The xyArray() and degree parameters must meet the following conditions:

1 <= degree <= 9

The number of points must be k * degree + 1, where k is a positive integer. If the first point is called p0, for any integer m between 1 and k, p(m * degree) is assumed to be the last control point of a Bezier segment, as well as the first control point of the next.

The result is a composite curve that consists of k Bezier segments. The input points from xyArray() define the curve's control points. If you want a smooth curve, make sure the points p(n - 1), pn, and p(n + 1) are co-linear whenever n = m * degree with an integer m. The composite Bezier curve is represented in the application as a B-spline with integer knots of multiplicity = degree.

The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group where the shape is being drawn. The passed array should be a SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The Flags argument is a bitmask that specifies options for drawing the new shape. Its value should be zero (0) or visSpline1D (8).

If Flags is visSpline1D and the first and last points in xyArray() don't coincide, the DrawBezier method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.

If the first and last points in xyArray() do coincide, the DrawBezier method produces a filled shape.

Example

The following example shows how to draw a Bezier curve through five arbitrary points on the active page.

VBA Copy code Copy code

Public Sub DrawBezier_Example()

 Dim vsoShape As Visio.Shape
 Dim intCounter As Integer
 Dim adblXYPoints(1 To (5 * 2)) As Double

 For intCounter = 1 To 5

 'Set x-coordinates (array elements 1,3,5,7,9) to 1,2,3,4,5
 adblXYPoints((intCounter * 2) - 1) = intCounter

 'Set y-coordinates (array elements 2,4,6,8,10) to f(intCounter)
 adblXYPoints(intCounter * 2) = (intCounter * intCounter) - (7 * intCounter) + 15

 Next intCounter

 Set vsoShape = ActivePage.DrawBezier(adblXYPoints, 2, visSpline1D)

End Sub


Master.DrawCircularArc Method (Visio)

 Copy code hover
[image]

Master.DrawCircularArc Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape whose path consists of a circular arc defined by its center, radius, and start and end angles.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawCircularArc(xCenter, yCenter, Radius, StartAngle, EndAngle)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
xCenter | Required | Double | The x-coordinate of the center of the arc.
yCenter | Required | Double | The y-coordinate of the center of the arc.
Radius | Required | Double | The radius of the arc.
StartAngle | Optional | Double | The angle in radians with respect to the x-axis at which to start drawing the arc. The default is 0.
EndAngle | Optional | Double | The angle in radians with respect to the x-axis at which to end the arc. The default is pi (3.14592634898).

Return Value

Shape

Remarks

By default, DrawCircularArc draws a 180-degree arc on the drawing page.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the DrawCircularArc method to draw an arc on the drawing page.

VBA Copy code Copy code
Public Sub DrawCircularArc_Example

 Dim vsoShape As Visio.Shape
 Set vsoShape = ActivePage.DrawCircularArc(3, 3, 3)

End Sub


Master.DrawLine Method (Visio)

 Copy code hover
[image]

Master.DrawLine Method (Visio)
Send feedback

Published: July 16, 2012

Adds a line to the Shapes collection of a master.

Version Information

Version Added: Visio 2.0

Syntax

expression .DrawLine(xBegin, yBegin, xEnd, yEnd)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
xBegin | Required | Double | The x-coordinate of the line's begin point.
yBegin | Required | Double | The y-coordinate of the line's begin point.
xEnd | Required | Double | The x-coordinate of the line's endpoint.
yEnd | Required | Double | The y-coordinate of the line's endpoint.

Return Value

Shape

Remarks

Using the DrawLine method is equivalent to using the Line tool in Microsoft Visio. The arguments are in internal drawing units with respect to the coordinate space of the page, master, or group where the line is being placed.

Example

The following example shows how to draw a line shape on the active page.

VBA Copy code Copy code

Public Sub DrawLine_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawLine(5, 4, 7.5, 1)

End Sub


Master.DrawNURBS Method (Visio)

 Copy code hover
[image]

Master.DrawNURBS Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape whose path consists of a single NURBS (nonuniform rational B-spline) segment.

Version Information

Version Added: Visio 2000

Syntax

expression .DrawNURBS(degree, Flags, xyArray(), knots(), weights)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
degree | Required | Integer | The spline's degree; an integer between 1 and 25.
Flags | Required | Integer | Flags that influence how the shape is drawn.
xyArray() | Required | Double | An array of alternating x and y values that define the control points coordinates; use internal drawing units (inches).
knots() | Required | Double | An array of knots.
weights | Optional | Variant | An array of weights.

Return Value

Shape

Remarks

The DrawNURBS method creates a new shape whose path consists of a single NURBS segment as specified by the arguments.

The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group in which the new shape is being created. The xyArray, knots, and weights arrays should be of type SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The knots argument is unit-less. The sequence of knots should be non-decreasing. In other words, knots(i + 1) < knots(i) is not acceptable. knots(i + 1) = knots(i) is permitted, and then the value is repeated, but the following restrictions apply:

  • The first knot may not be repeated more than degree + 1 times.

  • The last knot may not be repeated.

  • Any knot between the first and last may not be repeated more than degree times.

  • If the first knot is repeated less than degree + 1 times, the spline is periodic.

  • The list of weights is optional. Its absence signals that the spline is non-rational. Weights are unit-less.

The following rules apply to the sizes of the lists. For a spline with n control points:

  • If the spline is periodic, n > 2. Otherwise, n > degree.

  • The size of xyArray is 2n.

  • The size of the weights array is n (if present).

  • The size of the knots array is n + 1.

The conventional non-periodic spline requires n + degree + 1 knots, but the application implies the repeated knots at the end. For example, the degree 2 knot list (0,0,0,2,5,8) is interpreted in the application as the conventional knot sequence (0,0,0,2,5,8,8,8).

The Flags parameter is a bitmask that specifies options for drawing the new shape. Its value should be either zero (0) or visSpline1D (8). If Flags is visSpline1D and if the first and last points in xyArray don't coincide, the DrawNURBS method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.

If the first and last points in xyArray do coincide, the DrawNURBS method produces a filled shape.


Master.DrawOval Method (Visio)

 Copy code hover
[image]

Master.DrawOval Method (Visio)
Send feedback

Published: July 16, 2012

Adds an oval (ellipse) to the Shapes collection of a master.

Version Information

Version Added: Visio 2.0

Syntax

expression .DrawOval(x1, y1, x2, y2)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
x1 | Required | Double | The x-coordinate of one corner of the ellipse's width-height box.
y1 | Required | Double | The y-coordinate of one corner of the ellipse's width-height box.
x2 | Required | Double | The x-coordinate of the other corner of the ellipse's width-height box.
y2 | Required | Double | The y-coordinate of the other corner of the ellipse's width-height box.

Return Value

Shape

Remarks

Using the DrawOval method is equivalent to using the Ellipse tool in the application. The arguments are in internal drawing units with respect to the coordinate space of the page, master, or group where the ellipse is being placed.

Example

The following example shows how to draw an oval (ellipse) on the active page.

VBA Copy code Copy code

Public Sub DrawOval_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawOval(1.5, 10.5, 7.5, 6.5)

End Sub


Master.DrawPolyline Method (Visio)

 Copy code hover
[image]

Master.DrawPolyline Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path is a polyline along a given set of points.

Version Information

Version Added: Visio 2000

Syntax

expression .DrawPolyline(xyArray(), Flags)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
xyArray() | Required | Double | An array of alternating x and y values that defines points in the new shape's path.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Shape

Remarks

The DrawPolyline method creates a new shape whose path consists of a sequence of line segments and whose endpoints match the points specified in xyArray. Calling the DrawPolyline method is equivalent to calling the DrawSpline method with a tolerance of zero (0) and a flag of visSplineAbrupt.

The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group in which the new shape is being created. The passed array should be a type SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The Flags argument is a bitmask that specifies options for drawing the new shape. Its value can include visPolyline1D (8) or visPolyarcs (256). If Flags includes:

  • visPolyline1D and if the first and last points in xyArray don't coincide, the DrawPolyline method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.

  • visPolyarcs, Microsoft Visio will produce a sequence of arcs rather than a sequence of line segments; xyArray should specify the initial x,y point of the sequence followed by x,y bow triples. Visio will produce a shape with EllipticalArcTo rows where the bow of the arc matches the specified value.

If the first and last points in xyArray coincide, the DrawPolyline method produces a filled shape.

Example

The following example shows how to draw two polyline shapes that have 2-D and 1-D behavior, respectively, on the active page.

VBA Copy code Copy code

Public Sub DrawPolyline_Example()

 Dim vsoShape As Visio.Shape
 Dim adblXYPoints(1 To 8) As Double
 Dim intCounter As Integer

 'Initialize array with coordinates.
 adblXYPoints(1) = 1
 adblXYPoints(2) = 1
 adblXYPoints(3) = 3
 adblXYPoints(4) = 3
 adblXYPoints(5) = 5
 adblXYPoints(6) = 1
 adblXYPoints(7) = 1
 adblXYPoints(8) = 2

 'Use the DrawPolyline method to draw a shape that has 2-D behavior.
 Set vsoShape = ActivePage.DrawPolyline(adblXYPoints, 0)

 'Increase the Y-coordinate of the array by 4 to separate
 'the next shape drawn from the first.
 For intCounter = 2 To UBound(adblXYPoints) Step 2
 adblXYPoints(intCounter) = adblXYPoints(intCounter) + 4
 Next intCounter

 'Use the DrawPolyline method to draw a shape that has 1-D behavior.
 Set vsoShape = ActivePage.DrawPolyline(adblXYPoints, visPolyline1D)

End Sub


Master.DrawQuarterArc Method (Visio)

 Copy code hover
[image]

Master.DrawQuarterArc Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path consists of an elliptical arc defined by the two points and the flag passed in as arguments.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawQuarterArc(xBegin, yBegin, xEnd, yEnd, SweepFlag)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
xBegin | Required | Double | The x-coordinate of the begin point of the arc.
yBegin | Required | Double | The y-coordinate of the begin point of the arc.
xEnd | Required | Double | The x-coordinate of the endpoint of the arc.
yEnd | Required | Double | The y-coordinate of the endpoint of the arc.
SweepFlag | Required | VisArcSweepFlags | The type of arc, concave or convex.

Return Value

Shape

Remarks

The begin and endpoints define the bounding rectangle of the arc, and the SweepFlag argument determines which of the two possible arcs within the bounding rectangle is drawn. The bounding rectangle is always aligned to the page coordinate system; that is, the x-axis of the ellipse is parallel to the x-axis of the page.

The following possible values for the SweepFlag argument are declared in VisArcSweepFlags in the Visio type library.

Constant | Value | Description
visArcSweepFlagConcave | 0 | Concave arc
visArcSweepFlagConvex | 1 | Convex arc

If SweepFlag is visArcSweepFlagConcave, the line joining the center of the ellipse to the arc sweeps through decreasing angles; if it is visArcSweepFlagConvex, it sweeps through increasing angles.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the DrawQuarterArc method to draw a concave arc on the drawing page.

VBA Copy code Copy code
Public Sub DrawQuarterArc_Example

 Dim vsoShape As Visio.Shape
 Set vsoShape = ActivePage.DrawQuarterArc(3, 3, 6, 8, visArcSweepFlagConcave)

End Sub


Master.DrawRectangle Method (Visio)

 Copy code hover
[image]

Master.DrawRectangle Method (Visio)
Send feedback

Published: July 16, 2012

Adds a rectangle to the Shapes collection of a page, master, or group.

Version Information

Version Added: Visio 2.0

Syntax

expression .DrawRectangle(x1, y1, x2, y2)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
x1 | Required | Double | The x-coordinate of one corner of the rectangle's width-height box.
y1 | Required | Double | The y-coordinate of one corner of the rectangle's width-height box.
x2 | Required | Double | The x-coordinate of the other corner of the rectangle's width-height box.
y2 | Required | Double | The y-coordinate of the other corner of the rectangle's width-height box.

Return Value

Shape

Remarks

Using the DrawRectangle method is equivalent to using the Rectangle tool in the application. The arguments are in internal drawing units with respect to the coordinate space of the page, master, or group where the rectangle is being placed.

Example

The following example shows how to draw a rectangle on the active page.

VBA Copy code Copy code

Public Sub DrawRectangle_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawRectangle(1, 4, 4, 1)

End Sub


Master.DrawSpline Method (Visio)

 Copy code hover
[image]

Master.DrawSpline Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape whose path follows a given sequence of points.

Version Information

Version Added: Visio 4.1

Syntax

expression .DrawSpline(xyArray(), Tolerance, Flags)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
xyArray() | Required | Double | An array of alternating x and y values that define points in the new shape's path.
Tolerance | Required | Double | How closely the path of the new shape must approximate the given points.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Shape

Remarks

The DrawSpline method creates a new shape whose path falls within the given tolerance of the given array of points. To fit the given points exactly, specify a tolerance of zero (0). Typically, the DrawSpline method fits spline segments through the points, but it sometimes produces line or circular arc segments in the new shape.

The control points and tolerance are in internal drawing units (inches) with respect to the coordinate space of the page, master, or group in which the new shape is being created. The passed array should be a SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The error from the points to the path of the resulting shape is roughly within tolerance. When the number of points is large, the actual error may sometimes exceed the prescribed tolerance.

The Flags parameter is a bitmask that specifies options for drawing the new shape. Its value should be zero or a combination of one or more of the following values.

Constant | Value
visSplinePeriodic | 1(&H1)
visSplineDoCircles | 2(&H2)
visSplineAbrupt | 4(&H4)
visSpline1D | 8(&H8)

If Flags includes visSplinePeriodic and the following conditions are met, the application attempts to draw a periodic spline. Otherwise, Visio draws a non-periodic spline:

  • The last point must be a repetition of the first one.

  • If the flag visSplineAbrupt is included as well, the entire closed path outlined by the points must be free of abrupt changes of direction and curvature.

If Flags includes visSplineDoCircles, Microsoft Visio recognizes circular segments in the given array of points and generates circular arcs instead of spline rows for those segments.

If Flags includes visSplineAbrupt, Visio breaks the spline whenever it detects an abrupt change of direction or curvature in the point's trail. An abrupt change of direction is defined by three consecutive points A, B, C in the list, for which the distance between B and the line segment AC is more than twice the tolerance. The application also considers point B to be an abrupt change if one of the segments AB or BC is more than twice as long as the other. At a point where an abrupt change is detected, the application ends the current piece (line, arc, or spline) and starts a fresh one.

If Flags includes visSpline1D and the first and last points in xyArray() don't coincide, the DrawSpline method produces a shape that has one-dimensional (1-D) behavior, otherwise, it produces a shape that has two-dimensional (2-D) behavior.

If the first and last points in xyArray() do coincide, the DrawSpline method produces a filled shape.

Example

The following example shows how to draw a periodic spline through five arbitrary points, requiring that the spline approach within 0.25 (drawing) inches of each point. It allows Visio to start new segments in the path of the new shape at points considered abrupt.

VBA Copy code Copy code

Public Sub DrawSpline_Example()

 Dim vsoShape As Visio.Shape
 Dim intCounter As Integer
 Dim adblXYPoints(1 To (5 * 2)) As Double

 For intCounter = 1 To 5

 'Set x components (array elements 1,3,5,7,9) to 1,2,3,4,5
 adblXYPoints((intCounter * 2) - 1) = intCounter

 'Set y components (array elements 2,4,6,8,10) to f(i)
 adblXYPoints(intCounter * 2) = (intCounter * intCounter) - (7 * intCounter) + 15
 Next intCounter

 Set vsoShape = ActivePage.DrawSpline(adblXYPoints, 0.25, visSplineAbrupt)

End Sub


Master.Drop Method (Visio)

 Copy code hover
[image]

Master.Drop Method (Visio)
Send feedback

Published: July 16, 2012

Creates one or more new Shape objects by dropping an object onto a receiving object such as a master, drawing page, shape, or group.

Version Information

Version Added: Visio 2.0

Syntax

expression .Drop(ObjectToDrop, xPos, yPos)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | [UNKNOWN] | The object or selection to drop. While this is typically a Visio object such as a Master, Shape, or Selection object, it can be any OLE object that provides an IDataObject interface.
xPos | Required | Double | The x-coordinate at which to place the center of the shape's width or PinX.
yPos | Required | Double | The y-coordinate at which to place the center of the shape's height or PinY.

Return Value

Shape

Remarks

Using the Drop method is similar to moving a shape with the mouse. The object dropped (ObjectToDrop) can be a master or a shape on the drawing page.

To add a shape to a group or on a drawing page, apply the Drop method to a Shape or Page object, respectively. The center of the shape's width-height box is positioned at the specified coordinates, and a Shape object that represents the shape that is created is returned. When applying this method to a Shape object, make sure that the Shape object represents a group.

If ObjectToDrop is a Master, the pin of the master is dropped at the specified coordinates. A master's pin is often, but not necessarily, at its center of rotation.


Master.DropMany Method (Visio)

 Copy code hover
[image]

Master.DropMany Method (Visio)
Send feedback

Published: July 16, 2012

Creates one or more new Shape objects in a master. It returns an array of the IDs of the Shape objects it produces.

Version Information

Version Added: Visio 4.5

Syntax

expression .DropMany(ObjectsToInstance(), xyArray(), IDArray())

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectsToInstance() | Required | Variant | An array that identifies masters or other objects from which to make shapes.
xyArray() | Required | Double | An array of alternating x and y values specifying the positions for the new shapes.
IDArray() | Required | Integer | Out parameter. An array that returns the IDs of the created shapes.

Return Value

Integer

Remarks

Using the DropMany method is like using the Page, Master, or Shape object's Drop method, except you can use the DropMany method to create many new Shape objects at once, rather than one per method call. The DropMany method creates new Shape objects on the page, in the master, or in the group shape to which it is applied (this shape is called the "target object" in the following discussion).

You can identify which master to drop by passing the DropMany method a Master object or the master's index or the master's name. When you pass an object, DropMany isn't constrained to just dropping a master from the document stencil of the document onto which it is being dropped. The object can be a master from another document or another type of object.

Passing integers (master indices) or strings (master names) to DropMany is faster than passing objects, but integers or strings can identify only masters in the document stencil of the document onto which it is being dropped. Hence your program has to somehow get the masters in question into the document stencil in the first place, provided they weren't there already.

ObjectsToInstance() should be a one-dimensional array of n >= 1 variants. Its entries identify objects from which you want to make new Shape objects. An entry often refers to a Microsoft Visio application Master object. It might also refer to a Visio application Shape object, Selection object, or even an object from another application. The application doesn't care what the lower and upper array bounds of the ObjectsToInstance() entries are. Call these vlb and vub, respectively.

  • If ObjectsToInstance(i) is a reference to an OLE object that provides an IDataObject interface (in Microsoft Visual Basic for Applications, a reference to a selection, shape, master, guide, or OLE object), the object it is referencing is instanced. This is essentially equivalent to calling Drop(ObjectsToInstance(i),x,y).

  • If ObjectsToInstance(i) is the integer j, an instance of the Master object in the document stencil of the target object's document whose 1-based index is j is made. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to be triggered.

  • If ObjectsToInstance(i) is the string s (or a reference to the string s), an instance of the Master object with name s in the document stencil of the target object's document is made; s can equal either the Master object's UniqueID or Name property. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to be triggered.

  • For vlb < i <= vub, if ObjectsToInstance(i) is empty (Nothing or uninitialized in Microsoft Visual Basic), entry i will cause ObjectsToInstance(j) to be instanced again, where j is the largest value < i such that ObjectsToInstance(j) isn't empty. If you want to make n instances of the same thing, only ObjectsToInstance(vlb) needs to be provided.

The xyArray() parameter should be a one-dimensional array of 2m doubles with lower bound xylb and upper bound xyub, where m >= n. The values in the array tell the DropMany method where to position the Shape objects it produces. ObjectsToInstance(vlb + ( i - 1)) is dropped at (xy[(i - 1)2 + xylb],xy[(i - 1)2 + xylb + 1]) for 1 <= i <=n.

Note that m > n is allowed. For n < i <= m, the i'th thing instanced is the same thing as the n'th thing instanced. Thus to make m >= 1 instances of the same thing, you can pass an ObjectsToInstance() array with one entry and an m entry xyArray() array.

If the entity being instanced is a master, the pin of the new Shape object is positioned at the given xy. Otherwise, the center of the Shape objects is positioned at the given xy.

The value returned by the DropMany method is the number of xy entries in xyArray() that the DropMany method successfully processed. If all entries were processed successfully, m is returned. If some entries are successfully processed prior to an error occurring, the produced Shape objects are not deleted and this raises an exception but still returns a positive value.

Presuming all mxy entries are processed correctly, the number of new Shape objects produced by the DropMany method is usually equal to m. In rare cases (for example, if a Selection object gets instanced), more than m Shape objects may be produced. The caller can determine the number of produced Shape objects by comparing the number of shapes in the target object before and after the DropMany method is executed. The caller can assert the new Shape objects are those with the highest indices in the target object's Shapes collection.

If the DropMany method returns zero (0), IDArray() returns null (Nothing). Otherwise, it returns a one-dimensional array of m integers indexed from 0 to m - 1. IDArray() is an out parameter that is allocated by the DropMany method and ownership is passed to the program that called the DropMany method. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.)

If IDArray() returns non-null (not Nothing), IDArray(i - 1), 1 <= i <= intReturned, returns the ID of the Shape object produced by the i'th xyArray() entry, provided the i'th xyArray() entry produced exactly one Shape object. If the i'th xyArray() entry produced multiple Shape objects, -1 is returned in the entry. All entries i, intReturned <= i < m, return -1.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the DropMany method to drop more than one shape when you are using local names to identify the shapes. Use the DropManyU method to drop more than one shape when you are using universal names to identify the shapes.

Example

The following example shows how to use the DropMany method. It drops one instance of every master in the document stencil of the macro's Document object onto Page1 of the macro's Document object. Before running this macro, make sure there is at least one master in the document stencil.

VBA Copy code Copy code

Public Sub DropMany_Example()

 On Error GoTo HandleError

 Dim vsoMasters As Visio.Masters
 Dim intMasterCount As Integer
 Set vsoMasters = ThisDocument.Masters
 intMasterCount = vsoMasters.Count

 ReDim varObjectsToInstance(1 To intMasterCount) As Variant
 ReDim adblXYArray(1 To intMasterCount * 2) As Double
 Dim intCounter As Integer
 For intCounter = 1 To intMasterCount

 'Pass name of object to drop to DropMany.
 varObjectsToInstance(intCounter) = vsoMasters.Item(intCounter).Name

 'Set x components of where to drop to 2,4,6,2,4,6,2,4,6,...
 adblXYArray (intCounter * 2 - 1) = (((intCounter - 1) Mod 3) + 1) * 2

 'Set y components to 2,2,2,4,4,4,6,6,6,...
 adblXYArray (intCounter * 2) = Int((intCounter + 2) / 3) * 2

 Next intCounter

 Dim aintIDArray() As Integer
 Dim intProcessed As Integer

 intProcessed = ThisDocument.Pages(1).DropMany(varObjectsToInstance, _
 adblXYArray, aintIDArray)
 Debug.Print intProcessed

 For intCounter = LBound(aintIDArray) To UBound(aintIDArray)
 Debug.Print intCounter; aintIDArray(intCounter)
 Next intCounter

 Exit Sub

 HandleError:
 MsgBox "Error"

 Exit Sub

End Sub


Master.DropManyU Method (Visio)

 Copy code hover
[image]

Master.DropManyU Method (Visio)
Send feedback

Published: July 16, 2012

Creates one or more new Shape objects on a page, in a master, or in a group. It returns an array of the IDs of the Shape objects it produces.

Version Information

Version Added: Visio 4.5

Syntax

expression .DropManyU(ObjectsToInstance(), xyArray(), IDArray())

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectsToInstance() | Required | Variant | An array that identifies masters or other objects from which to make shapes by their universal names.
xyArray() | Required | Double | An array of alternating x and y values specifying the positions for the new shapes.
IDArray() | Required | Integer | Out parameter. An array that returns the IDs of the created shapes.

Return Value

Integer

Remarks

Using the DropManyU method is like using the Page, Master, or Shape object's Drop method, except you can use the DropManyU method to create many new Shape objects at once, rather than one per method call. The DropManyU method creates new Shape objects on the page, in the master, or in the group shape to which it is applied (this shape is called the "target object" in the following discussion).

You can identify which master to drop by passing the DropManyU method a Master object or the master's index or the master's name. When you pass an object, DropManyU isn't constrained to just dropping a master from the document stencil of the document onto which it is being dropped. The object can be a master from another document or another type of object.

Passing integers (master indices) or strings (master names) to DropManyU is faster than passing objects, but integers or strings can identify only masters in the document stencil of the document onto which it is being dropped. Hence your program has to somehow get the masters in question into the document stencil in the first place, provided they weren't there already.

ObjectsToInstance() should be a one-dimensional array of n >= 1 variants. Its entries identify objects from which you want to make new Shape objects. An entry often refers to a Microsoft Visio application Master object. It might also refer to a Visio application Shape object, Selection object, or even an object from another application. The application doesn't care what the lower and upper array bounds of the ObjectsToInstance() entries are. Call these vlb and vub, respectively.

  • If ObjectsToInstance(i) is the integer j, an instance of the Master object in the document stencil of the target object's document whose 1-based index is j is made. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to trigger.

  • If ObjectsToInstance(i) is the string s (or a reference to the string s), an instance of the Master object with name s in the document stencil of the target object's document is made; s can equal either the Master object's UniqueID or NameU property. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to be triggered.

  • For vlb < i <= vub, if ObjectsToInstance(i) is empty (Nothing or uninitialized in Microsoft Visual Basic), entry i will cause ObjectsToInstance(j) to be instanced again, where j is the largest value < i such that ObjectsToInstance(j) isn't empty. If you want to make n instances of the same thing, only ObjectsToInstance(vlb) needs to be provided.

The xyArray() parameter should be a one-dimensional array of 2m doubles with lower bound xylb and upper bound xyub, where m >= n. The values in the array tell the DropManyU method where to position the Shape objects it produces. ObjectsToInstance(vlb + ( i - 1)) is dropped at (xy[(i - 1)2 + xylb],xy[(i - 1)2 + xylb + 1]) for 1 <= i <=n.

Note that m > n is allowed. For n < i <= m, the i'th thing instanced is the same thing as the n'th thing instanced. Thus to make m >= 1 instances of the same thing, you can pass an ObjectsToInstance() array with one entry and an m entry xyArray() array.

If the entity being instanced is a master, the pin of the new Shape object is positioned at the given xy. Otherwise, the center of the Shape objects is positioned at the given xy.

The Integer value returned by the DropManyU method is the number of xy entries in xyArray() that the DropManyU method successfully processed. If all entries were processed successfully, m is returned. If some entries are successfully processed prior to an error occurring, the produced Shape objects are not deleted and this raises an exception but still returns a positive integer.

Presuming all mxy entries are processed correctly, the number of new Shape objects produced by the DropManyU method is usually equal to m. In rare cases (for example, if a Selection object gets instanced), more than m Shape objects may be produced. The caller can determine the number of produced Shape objects by comparing the number of shapes in the target object before and after the DropManyU method is executed. The caller can assert the new Shape objects are those with the highest indices in the target object's Shapes collection.

If the DropManyU method returns zero (0), IDArray() returns null (Nothing). Otherwise, it returns a one-dimensional array of m integers indexed from 0 to m - 1. IDArray() is an out parameter that is allocated by the DropManyU method and ownership is passed to the program that called the DropManyU method. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.)

If IDArray() returns non-null (not Nothing), IDArray(i - 1), 1 <= i <= intReturned, returns the ID of the Shape object produced by the i'th xyArray() entry, provided the i'th xyArray() entry produced exactly one Shape object. If the i'th xyArray() entry produced multiple Shape objects, -1 is returned in the entry. All entries i, intReturned <= i < m, return -1.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the DropMany method to drop more than one shape when you are using local names to identify the shapes. Use the DropManyU method to drop more than one shape when you are using universal names to identify the shapes.

Example

The following example shows how to use the DropManyU method. It drops one instance of every master in the document stencil of the macro's Document object onto Page1 of the macro's Document object. Before running this macro, make sure there is at least one master in the document stencil.

VBA Copy code Copy code

Public Sub DropManyU_Example()

 On Error GoTo HandleError

 Dim vsoMasters As Visio.Masters
 Dim intMasterCount As Integer
 Set vsoMasters = ThisDocument.Masters
 intMasterCount = vsoMasters.Count

 ReDim varObjectsToInstance(1 To intMasterCount) As Variant
 ReDim adblXYArray(1 To (intMasterCount * 2)) As Double
 Dim intCounter As Integer
 For intCounter = 1 To intMasterCount

 'Pass universal name of object to drop to DropManyU.
 varObjectsToInstance(intCounter) = vsoMasters.ItemU(intCounter).NameU

 'Set x components of where to drop to 2,4,6,2,4,6,2,4,6,...
 adblXYArray (intCounter * 2 - 1) = (((intCounter - 1) Mod 3) + 1) * 2

 'Set y components to 2,2,2,4,4,4,6,6,6,...
 adblXYArray (intCounter * 2) = Int((intCounter + 2) / 3) * 2

 Next intCounter

 Dim aintIDArray() As Integer
 Dim intProcessed As Integer

 intProcessed = ThisDocument.Pages(1).DropManyU(varObjectsToInstance, _
 adblXYArray, aintIDArray)
 Debug.Print intProcessed

 For intCounter = LBound(aintIDArray) To UBound(aintIDArray)
 Debug.Print intCounter; aintIDArray(intCounter)
 Next intCounter

 Exit Sub

 HandleError:
 MsgBox "Error"

 Exit Sub

End Sub


Master.Export Method (Visio)

 Copy code hover
[image]

Master.Export Method (Visio)
Send feedback

Published: July 16, 2012

Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.

Version Information

Version Added: Visio 3.0

Syntax

expression .Export(FileName)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The fully qualified path and name of the file to receive the exported object.

Return Value

Nothing

Remarks

The file name extension indicates which export filter to use. If the filter is not installed, the Export method returns a compiler error in your Visual Basic or VBA project. The Export method uses the default preference settings for the specified filter and does not prompt the user for non-default arguments.

The Export method of a Page object supports saving to HTML file format using the extension .htm or .html. When pages are exported, Visio uses the settings that were last selected in the Save As dialog box.

If the specified file already exists, Visio replaces it without prompting the user.

You can use various properties and methods of the ApplicationSettings object that relate to raster images to configure settings for export to .bmp, .gif, .jpg, .png, and .tif file types.

Example

This example shows how to export a Visio page as a bitmap (.bmp) file. It assumes a drawing page is open and active in Microsoft Visio.

VBA Copy code Copy code
Public Sub Export_Example()
 Dim vsoPage As Visio.Page
 Set vsoPage = ActivePage
 vsoPage.Export ("C:\\myExportedPage.bmp")
End Sub


Master.ExportIcon Method (Visio)

 Copy code hover
[image]

Master.ExportIcon Method (Visio)
Send feedback

Published: July 16, 2012

Exports the icon for a Master object to a named file or the Clipboard.

Version Information

Version Added: Visio 4.5

Syntax

expression .ExportIcon(FileName, Flags, [TransparentRGB])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The file to which to export the icon.
Flags | Required | Integer | The format in which to write the exported file.
TransparentRGB | Optional | Variant | The color to substitute for any transparent areas of the exported icon image.

Return Value

Nothing

Remarks

If FileName is empty, the master's icon is copied to the Clipboard.

If the value of Flags is visIconFormatVisio (0), the icon is exported in the application internal icon format. The ImportIcon method accepts files written in this format.

If the value of Flags is visIconFormatBMP (2), the icon is exported in bitmap (.bmp) file format.

Starting with Microsoft Visio 2000, you can use the TransparentRGB argument with the ExportIcon method. If TransparentRGB is omitted, the color defaults to black, which simulates Visio 5.0 behavior.


Master.GetFormulas Method (Visio)

 Copy code hover
[image]

Master.GetFormulas Method (Visio)
Send feedback

Published: July 16, 2012

Returns the formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetFormulas(SID_SRCStream(), formulaArray())

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | A stream that identifies cells to be queried.
formulaArray() | Required | Variant | Out paramter. An array that receives formulas of queried cells.

Return Value

Nothing

Remarks

The GetFormulas method is like the Formula property of a Cell object, except you can use it to obtain the formulas of many cells at once rather than one cell at a time. The GetFormulas method is a specialization of the GetResults method, which can be used to obtain cell formulas or results. Setting up a call to the GetFormulas method involves slightly less work than setting up the GetResults method.

For Master objects, you can use the GetFormulas method to get formulas of any set of cells in any set of shapes of the page or master.

SID_SRCStream() is an array of 2-byte integers. For Master objects, SID_SRCStream() should be a one-dimensional array of 4n 2-byte integers for n >= 1. The GetFormulas method interprets SID_SRCStream() as:

VBA Copy code Copy code
{sheetID, sectionIdx, rowIdx, cellIdx}n

where sheetID is the ID property of the Shape object on the page or master whose cell formula is desired.

Note Note

If the sheetID in an entry is visInvalShapeID (-1) or if the bottom byte of sectionIdx is visSectionInval (255), the entry will be ignored and an empty variant will be returned in the corresponding results array entry. This is because the same SID_SRCStream() array can be used on several calls to GetFormulas, SetFormulas, and similar methods with the caller only needing to make minor changes to the stream between calls.

If the GetFormulas method succeeds, formulaArray() returns a one-dimensional array of n variants indexed from 0 to n - 1. Each variant returns a formula as a string. formulaArray() is an out parameter that is allocated by the GetFormulas method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetFormulas method returns. (Microsoft Visual Basic and Microsoft Visual Basic for Applications (VBA) take care of this for you.) The GetFormulas method fails if formulaArray() is Null.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetFormulas method to get more than one formula when you are using local syntax. Use the GetFormulasU method to get more than one formula when you are using universal syntax.

Example

The following VBA macro shows how to use the GetFormulas method. It assumes that there is an active Microsoft Visio page that has at least three shapes on it. It uses GetFormulas to get the width of shape 1, the height of shape 2, and the angle of shape 3.

This example uses the GetFormulas method of the Page object to get three cell formulas. The input array has four slots for each cell, as it also would for Master objects. For Shape or Style objects, only three slots would be needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub GetFormulas_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer

 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Return the formulas of the cells.
 Dim avarFormulaArray() As Variant
 ActivePage.GetFormulas aintSheetSectionRowColumn, avarFormulaArray

 Debug.Print "Shape 1 width is "; avarFormulaArray(0)
 Debug.Print "Shape 2 height is "; avarFormulaArray(1)
 Debug.Print "Shape 3 angle is "; avarFormulaArray(2)

Exit Sub

HandleError:
 MsgBox "Error"
Exit Sub

End Sub


Master.GetFormulasU Method (Visio)

 Copy code hover
[image]

Master.GetFormulasU Method (Visio)
Send feedback

Published: July 16, 2012

Returns the formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetFormulasU(SID_SRCStream(), formulaArray())

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | A stream that identifies cells to be queried.
formulaArray() | Required | Variant | Out parameter. An array that receives formulas of queried cells.

Return Value

Nothing

Remarks

The GetFormulasU method is like the FormulaU property of a Cell object, except you can use it to obtain the formulas of many cells at once, rather than one cell at a time. The GetFormulasU method is a specialization of the GetResults method, which can be used to obtain cell formulas or results. Setting up a call to the GetFormulasU method involves slightly less work than setting up the GetResults method.

You can use the GetFormulasU method to get formulas in universal syntax of any set of cells in any set of shapes of the page or master.

SID_SRCStream() is an array of 2-byte integers. SID_SRCStream() should be a one-dimensional array of 4n 2-byte integers for n >= 1. The GetFormulasU method interprets SID_SRCStream() as:

VBA Copy code Copy code
{sheetID, sectionIdx, rowIdx, cellIdx}n

where sheetID is the ID property of the Shape object on the page or master whose cell formula is desired.

Note Note

If the sheetID in an entry is visInvalShapeID (-1) or if the bottom byte of sectionIdx is visSectionInval (255), the entry will be ignored and an empty variant will be returned in the corresponding results array entry. The reason for this is that the same SID_SRCStream() array can be used on several calls to GetFormulasU, SetFormulas, and similar methods with the caller only needing to make minor changes to the stream between calls.

If the GetFormulasU method succeeds, formulaArray() returns a one-dimensional array of n variants indexed from 0 to n - 1. Each variant returns a formula as a string. formulaArray() is an out parameter that is allocated by the GetFormulasU method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetFormulasU method returns. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.) The GetFormulasU method fails if formulaArray() is Null.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetFormulas method to get more than one formula when you are using local syntax. Use the GetFormulasU method to get more than one formula when you are using universal syntax.


Master.GetResults Method (Visio)

 Copy code hover
[image]

Master.GetResults Method (Visio)
Send feedback

Published: July 16, 2012

Gets the results or formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetResults(SID_SRCStream(), Flags, UnitsNamesOrCodes(), resultArray())

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | An array that identifies cells to be queried.
Flags | Required | Integer | Flags that influence the type of entries returned in results.
UnitsNamesOrCodes() | Required | Variant | An array of measurement units that results are to be returned in.
resultArray() | Required | Variant | Out parameter. An array that receives results or formulas of queried cells.

Return Value

Nothing

Remarks

The GetResults method is like the Result property for the Cell object, except that it can be used to get the results (values) of many cells at once, rather than one cell at a time.

For a Master object, you can use the GetResults method to get results of any set of cells in any set of shapes of the master.

SID_SRCStream() is an array of 2-byte integers. For Master objects, SID_SRCStream() should be a one-dimensional array of 4n 2-byte integers for n >= 1. The GetResults method interprets SID_SRCStream() as:

VBA Copy code Copy code
{sheetID, sectionIdx, rowIdx, cellIdx }n

where sheetID is the ID property of the Shape object on the master whose cell result is desired.

Note Note

If the sheetID in an entry is visInvalShapeID (-1) or if the bottom byte of sectionIdx is visSectionInval (255), the entry will be ignored and an empty variant will be returned in the corresponding results array entry. The reason for this is that the same SID_SRCStream() array can be used on several calls to GetResults, SetResults, and similar methods with the caller only needing to make minor changes to the stream between calls.

The Flags parameter indicates what data type the returned results should be expressed in. Its value should be one of the following.

Constant | Value | Description
visGetFloats | 0 | Results returned as doubles (VT_R8).
visGetTruncatedInts | 1 | Results returned as truncated long integers (VT_I4).
visGetRoundedInts | 2 | Results returned as rounded long integers (VT_I4).
visGetStrings | 3 | Results returned as strings (VT_BSTR).
visGetFormulas | 4 | Formulas returned as strings (VT_BSTR).
visGetFormulasU | 5 | Formulas returned in universal syntax (VT_BSTR).

The UnitsNamesOrCodes() parameter is an array that controls what measurement units individual results are returned in. Each entry in the array can be a string such as "inches", "inch", "in.", or "i". Strings may be used for all supported Visio units such as centimeters, meters, miles, and so on. You can also indicate desired units with integer constants (visCentimeters, visInches, etc.) declared by the Visio type library. Note that the values specified in the UnitsNamesOrCodes() array have no effect if Flags is visGetFormulas.

If UnitsNamesOrCodes() is not null, the application expects it to be a one-dimensional array of 1 <= u Variants. Each entry can be a string or integer code, or empty (nothing). If the i'th entry is empty, the i'th returned result is returned in the units designated by UnitsNamesOrCodes(j), where j is the index of the most recent prior non-empty entry. Thus if you want all returned values to be in the same units, you need only pass a UnitsNamesOrCodes() array with one entry. If there is no prior non-empty entry, or if no UnitsNameOrCodes() array is supplied, visNumber (0x20) is used. This causes internal units (like the ResultIU property of a Cell object) to be returned.

If the GetResults method succeeds, results returns a one-dimensional array of n variants indexed from zero (0) to n - 1. The type of the returned variants is a function of Flags. The resultArray() parameter is an out parameter that is allocated by the GetResults method, which passes ownership back to the caller. The caller should eventually perform SafeArrayDestroy on the returned array. Note that SafeArrayDestroy has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetResults method returns. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.)

Example

The following example shows how to use the GetResults method. This example assumes there is an active page that has at least 3 shapes on it. It uses the GetResults method to get the width of shape 1, the height of shape 2, and the angle of shape 3.

This example uses the GetResults method of the Page object to get 3 cell formulas. The input array has 4 slots for each cell, as it also would for Master objects. For Shape or Style objects, only 3 slots would be needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub GetResults_Example()

 On Error GoTo HandleError

 Dim intCounter As Integer
 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer

 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Get first two values in inches. The second element in
 'the units array is left uninitialized (empty) because we
 'want the second result in the same units as the first
 'result. The third result is initialized in degrees. Note that
 'units can be expressed as a string or an integer constant.
 Dim avarUnits(1 To 3) As Variant
 avarUnits(1) = "in."
 avarUnits(3) = visDegrees

 'Return results of cells as an array of floating point numbers.
 Dim avarResults() As Variant
 ActivePage.GetResults aintSheetSectionRowColumn, visGetFloats, _
 avarUnits, avarResults

 For intCounter = 0 To 3
 Debug.Print avarResults(intCounter)
 Next

 Exit Sub

HandleError:
 MsgBox "Error"
 Exit Sub

End Sub


Master.Import Method (Visio)

 Copy code hover
[image]

Master.Import Method (Visio)
Send feedback

Published: July 16, 2012

Imports a file into the current document.

Version Information

Version Added: Visio 3.0

Syntax

expression .Import(FileName)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file to import; must be a fully qualified path.

Return Value

Shape

Remarks

The Import method imports the file specified by FileName onto a page, or into a master or group.

The file name extension indicates which import filter to use. If the filter is not installed, the Import method returns an error. The Import method uses the default preference settings for the specified filter and does not prompt the user for non-default arguments.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Import method to import a bitmap image onto the drawing page. This example assumes that there is a file with the name sampleImage.bmp on drive C of your computer.

VBA Copy code Copy code
Public Sub Import_Example()

 ActivePage.Import ("C:\sampleImage.bmp")

End Sub


Master.ImportIcon Method (Visio)

 Copy code hover
[image]

Master.ImportIcon Method (Visio)
Send feedback

Published: July 16, 2012

Imports the icon for a Master object from a named file.

Version Information

Version Added: Visio 4.5

Syntax

expression .ImportIcon(FileName)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file to import.

Return Value

Nothing

Remarks

The ImportIcon method can only import files that were produced by exporting a master icon in the application's internal icon format (visIconFormatVisio)—it does not accept icons in other file formats.


Master.InsertFromFile Method (Visio)

 Copy code hover
[image]

Master.InsertFromFile Method (Visio)
Send feedback

Published: July 16, 2012

Adds a linked or embedded object to a page, master, or group.

Version Information

Version Added: Visio 4.1

Syntax

expression .InsertFromFile(FileName, Flags)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file that contains the object to link or embed.
Flags | Required | Integer | Flags that influence how the object is inserted.

Return Value

Shape

Remarks

The InsertFromFile method creates a new shape that represents a linked or embedded OLE object.

The Flags argument is a bitmask that should be a combination of the following values.

Constant | Value | Description
visInsertLink | &H8 | If set, the new shape represents an OLE link to the named file. Otherwise, the InsertFromFile method produces an OLE object from the contents of the named file and embeds it in the document that contains the page, master, or group.
visInsertIcon | &H10 | Displays the new shape as an icon.

Security Use caution when you are adding ActiveX controls to your application. ActiveX controls may be designed in such a way that their use could pose a security risk. We recommend that you use controls from trusted sources only.


Master.InsertObject Method (Visio)

 Copy code hover
[image]

Master.InsertObject Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new embedded object or ActiveX control to a page, master, or group.

Version Information

Version Added: Visio 4.1

Syntax

expression .InsertObject(ClassOrProgID, Flags)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
ClassOrProgID | Required | String | Identifies the type of object or control to create.
Flags | Required | Integer | Flags that influence the operation.

Return Value

Shape

Remarks

ClassOrProgID is a string that identifies the kind of object or control to create. It can be either the object or control's class ID (GUID) in string form or the object or control's program ID of the handler for the class.

  • If ClassOrProgID is a string representing a class ID, it looks like "{D3E34B21-9D75-101A-8C3D-00AA001A1652}."

  • If ClassOrProgID is a string representing a program ID, it looks like "paint.picture" or "forms.combobox.1".

See vendor-specific documentation or browse the registry to determine which class IDs and program IDs are associated with objects and controls provided by other applications.

The Flags argument is a bitmask that can include one of the following values.

Constant | Value | Description
visInsertIcon | &H10 | Displays the new shape as an icon.
visInsertDontShow | &H1000 | Does not execute the new object's show verb.

If both visInsertIcon and visInsertDontShow are specified, the InsertObject method fails. If you want to insert an object that is displayed as an icon, you must allow the application to execute the object's show verb.

The Flags argument can also include one of the following values.

Constant | Value
visInsertAsControl | &H2000
visInsertAsEmbed | &H4000

Values in visInsertAsControl and visInsertAsEmbed only have an effect if the class identified by ClassOrProgID is identified in the registry as a control that can be inserted. If neither visInsertAsControl nor visInsertAsEmbed is specified and the object can be either a control or an embedded object, the application inserts it as a control.

In rare cases, Visio 5.0 or later versions may insert a control whereas earlier versions of Visio would have responded to the same call by inserting an embedded object. If a control is inserted, this method places the document in design mode, causing any code executing in the document to halt until the document is returned to run mode.

Security Use caution when you are adding ActiveX controls to your application. ActiveX controls may be designed in such a way that their use could pose a security risk. We recommend that you use controls from trusted sources only. Sign any controls you author.

Caution note Caution

Modifying the registry in any manner, whether through the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).


Master.Layout Method (Visio)

 Copy code hover
[image]

Master.Layout Method (Visio)
Send feedback

Published: July 16, 2012

Lays out the shapes and/or reroutes the connectors for the page, master, group, or selection.

Version Information

Version Added: Visio 4.5

Syntax

expression .Layout

expression A variable that represents a Master object.

Return Value

Nothing

Remarks

Using the Layout method is equivalent to clicking Re-Layout Page in the Layout group on the Design tab and then clicking More Layout Options and configuring options in the Configure Layout dialog box.

Behavior of the Layout method can be influenced by setting the formulas or results of cells in the Page Layout and Shape Layout ShapeSheet sections of the page, master, or group to be laid out. You can infer how these cells influence the behavior of the Layout method by examining the effect of various Configure Layout dialog box options on the values of these cells.

To lay out a subset of the shapes of a page, master, or group, establish a Selection object in which the shapes to be laid out are selected, and then call the Layout method. If the Layout method is performed on a Selection object and the object has no shapes selected, all shapes in the page, master, or group of the selection are laid out.


Master.Open Method (Visio)

 Copy code hover
[image]

Master.Open Method (Visio)
Send feedback

Published: July 16, 2012

Opens an existing master so that it can be edited.

Version Information

Version Added: Visio 4.1

Syntax

expression .Open

expression A variable that represents a Master object.

Return Value

Master

Remarks

You can use the Open method for a Master object in conjunction with the Close method to reliably edit the shapes and cells of a master. In some previous versions of Visio, you could edit a Master object's shapes and cells, but the changes were not pushed to instances of the master, and alignment box information displayed when instancing the edited master was not correct.

To edit the shapes and cells of a Master object from a program

  1. Open the Master object for editing by using masterObjCopy = masterObj.Open. This code fails if there is a drawing window open into masterObj or if other programs already have masterObj open. If the Open method succeeds, masterObjCopy is a copy of masterObj.

  2. Change any shapes and cells in masterObjCopy, not masterObj.

  3. Close the Master object by using masterObjCopy.Close. The Close method fails if masterObjCopy isn't a Master object that resulted from a prior masterObj.Open call. Otherwise, the Close method merges the changes made in step 2 from masterObjCopy back into masterObj. It also updates all instances of masterObj to reflect the changes and update information cached in masterObj. If masterObj.IconUpdate isn't visManual (0), the Close method updates the icon shown in the stencil window for masterObj to depict an image of masterObjCopy.

If you change the shapes and cells of a master directly, as opposed to opening and closing the master as described in the procedure above, the effects listed in step 3 don't occur.

A program that creates a copy of a masterObj for editing should both close and release the copy. Microsoft Visual Basic typically releases it automatically. However, when you are coding in C or C++, you must explicitly release the copy, just as you would for any other object.

Note Note

Starting with Microsoft Office Visio 2003, only user-created stencils are editable. By default, Visio stencils are not editable.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to open a Master object for editing. It opens a copy of a master from the document stencil and changes the fill foreground color of the master and all shapes in the drawing derived from the master.

Before running this macro, close all open Visio documents. Then, click the File tab, click New, and then click Create to open a new document based on no template. Click the Rectangle tool, and draw a rectangle on the drawing page. Open the document stencil (in the Shapes window, click More Shapes, click Show Document Stencil), and then drag the rectangle shape onto the document stencil to create a master. Finally, drag several copies of the rectangle master onto the drawing page.

VBA Copy code Copy code

Public Sub OpenMaster_Example()

    Dim vsoMaster As Visio.Master
    Dim vsoMasterCopy As Visio.Master
    Dim vsoShape As Visio.Shape
    Dim vsoCell As Visio.Cell

    Set vsoMaster = Visio.Documents.Masters(1)
    Set vsoMasterCopy = vsoMaster.Open

    Set vsoShape = vsoMasterCopy.Shapes.Item(1)

    Set vsoCell = vsoShape.CellsU("FillForegnd")
    vsoCell.Formula = 9

    vsoMasterCopy.Close

End Sub


Master.OpenDrawWindow Method (Visio)

 Copy code hover
[image]

Master.OpenDrawWindow Method (Visio)
Send feedback

Published: July 16, 2012

Opens a new drawing window that displays a master.

Version Information

Version Added: Visio 4.1

Syntax

expression .OpenDrawWindow

expression A variable that represents a Master object.

Return Value

Window

Remarks

The OpenDrawWindow method opens a new drawing window, even if the master is already displayed in a drawing window.


Master.OpenIconWindow Method (Visio)

 Copy code hover
[image]

Master.OpenIconWindow Method (Visio)
Send feedback

Published: July 16, 2012

Opens an icon window that shows a master's icon.

Version Information

Version Added: Visio 4.1

Syntax

expression .OpenIconWindow

expression A variable that represents a Master object.

Return Value

Window

Remarks

If the master's icon is already displayed in an icon window, the OpenIconWindow method activates that window rather than opening another window.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the OpenIconWindow method to open an icon editing window.

VBA Copy code Copy code

Public Sub OpenIconWindow_Example()

 Dim vsoMaster As Visio.Master
 Dim vsoIconWindow As Visio.Window

 'Add a master to the document stencil and open its icon editing window.
 Set vsoMaster = ThisDocument.Masters.Add
 Set vsoIconWindow = vsoMaster.OpenIconWindow

End Sub


Master.Paste Method (Visio)

 Copy code hover
[image]

Master.Paste Method (Visio)
Send feedback

Published: July 16, 2012

Pastes the contents of the Clipboard into an object.

Version Information

Version Added: Visio 2002

Syntax

expression .Paste(Flags)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Optional | Variant | Determines how shapes are translated during the paste operation.

Return Value

Nothing

Remarks

The Paste method works only with Shape objects that are group shapes. Use the Type property of a shape to determine whether it is a group.

Possible values for Flags are declared by the Visio type library in VisCutCopyPasteCodes, and are described in the following table.

Flag | Value | Description
visCopyPasteNormal | &H0 | Follow default copying behavior.
visCopyPasteNoTranslate | &H1 | Copy shapes to their original coordinate locations.
visCopyPasteCenter | &H2 | Copy shapes to the center of the page.
visCopyPasteNoHealConnectors | &H4 | Do not clean up connectors attached to cut shapes.
visCopyPasteNoContainerMembers | &H8 | Do not cut and copy unselected members of containers or lists.
visCopyPasteNoAssociatedCallouts | &H16 | Do not cut and copy unselected callouts associated with shapes.
visCopyPasteDontAddToContainers | &H32 | Do not add pasted shapes to any underlying containers.
visCopyPasteNoCascade | &H64 | Do not offset shapes on copy.

Setting Flags to visCopyPasteNormal is the equivalent of the behavior in the user interface. You should use visCopyPasteNormal and the other flags consistently. For example, if you use the value visCopyPasteNoTranslate to copy, you should also use that value to paste, because that is the only way to ensure that shapes are pasted to their original coordinate location.

If you need to control the format of the pasted information and (optionally) establish a link to a source file (for example, a Microsoft Word document), use the PasteSpecial method.


Master.PasteSpecial Method (Visio)

 Copy code hover
[image]

Master.PasteSpecial Method (Visio)
Send feedback

Published: July 16, 2012

Inserts the contents of the Clipboard, allowing you to control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Word document).

Version Information

Version Added: Visio 2002

Syntax

expression .PasteSpecial(Format, Link, DisplayAsIcon)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Format | Required | Long | The internal Clipboard format.
Link | Optional | Variant | True to establish a link to the source of the pasted data; otherwise, False (the default). Ignored if the source data is not suitable for, or does not support, linking.
DisplayAsIcon | Optional | Variant | True to display the pasted data as an icon; otherwise, False (the default).

Return Value

Nothing

Remarks

To simply paste the contents of the Clipboard into an object, use the Paste method.

The value of the Format argument can be any of the following:

  • A value from VisPasteSpecialCodes (see the following table).

  • Any of the standard Clipboard formats, for example, CF_TEXT. For details, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network Web site.

  • Any value returned from a call to the RegisterClipboardFormat function. For details, see the Microsoft Platform SDK on MSDN.

Note Note

Before calling Microsoft Windows functions, you should understand how arguments and data types are handled by the Windows API DLLs. Incorrectly calling Windows functions may result in invalid page faults or other unexpected behaviors. For more information on calling Windows functions, search for "Windows API" on MSDN.

Possible values for Format declared by the Visio type library in VisPasteSpecialCodes are described in the following table.

Constant | Value | Description
visPasteBitmap | 2 | Paste bitmap.
visPasteDIB | 8 | Paste device-independent bitmap.
visPasteEMF | 14 | Paste enhanced metafile.
visPasteHyperlink | 65538 | Paste hyperlink.
visPasteInk | 65544 | Paste Ink data.
visPasteMetafile | 3 | Paste metafile.
visPasteOEMText | 7 | Paste OEM text.
visPasteOLEObject | 65536 | Paste OLE object.
visPasteRichText | 65537 | Paste rich text.
visPasteText | 1 | Paste ANSI text.
visPasteURL | 65539 | Paste Uniform Resource Locator (URL).
visPasteVisioIcon | 65543 | Paste Visio icon.
visPasteVisioMastersXML | 65546 | Paste Visio masters XML.
visPasteVisioMasters | 65541 | Paste Visio masters.
visPasteVisioShapesXML | 65545 | Paste Visio shapes XML.
visPasteVisioShapesWithoutDataLinks | 65548 | Paste Visio drawing data without internal data links.
visPasteVisioShapes | 65540 | Paste Visio shapes.
visPasteVisioText | 65542 | Paste Visio text.


Master.PasteToLocation Method (Visio)

 Copy code hover
[image]

Master.PasteToLocation Method (Visio)
Send feedback

Published: July 16, 2012

Pastes a shape to the specified location.

Version Information

Version Added: Visio 2010

Syntax

expression .PasteToLocation(xPos, yPos, Flags)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
xPos | Required | Double | The x-coordinate at which to place the center of the object's width or PinX, in inches.
yPos | Required | Double | The y-coordinate at which to place the center of the object's height or PinY, in inches.
Flags | Required | Long | The default is zero.

Return Value

Nothing


Master.ResizeToFitContents Method (Visio)

 Copy code hover
[image]

Master.ResizeToFitContents Method (Visio)
Send feedback

Published: July 16, 2012

Resizes the page, or the master's page, to fit tightly around the shapes or master that are on it.

Version Information

Version Added: Visio 2002

Syntax

expression .ResizeToFitContents

expression A variable that represents a Master object.

Return Value

Nothing

Remarks

After the page is resized, the page height and width and the PinX and PinY values of the shapes or master are typically changed.

Calling the ResizeToFitContents method is the equivalent of selecting Let Visio expand the page as needed on the Page Size tab in the Page Setup dialog box (on the Design tab, click Size, and then click More Page Sizes).


Master.SetFormulas Method (Visio)

 Copy code hover
[image]

Master.SetFormulas Method (Visio)
Send feedback

Published: July 16, 2012

Sets the formulas of one or more cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .SetFormulas(SID_SRCStream(), formulaArray(), Flags)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | A stream identifying cells to be modified.
formulaArray() | Required | Variant | Formulas to be assigned to identified cells.
Flags | Required | Integer | Flags that influence the behavior of SetFormulas.

Return Value

Integer

Remarks

The SetFormulas method behaves like the Formula property except that you can use it to set the formulas of many cells at once, rather than one cell at a time.

For Master objects, you can use the SetFormulas method to set results of any set of cells in any set of shapes of the page or master. You tell the SetFormulas method which cells you want to set by passing an array of integers in SID_SRCStream(). SID_SRCStream() is a one-dimensional array of 2-byte integers.

For Master objects SID_SRCStream() should be a one-dimensional array of 4n 2-byte integers for n >= 1. The SetFormulas method interprets the stream as:

VBA Copy code Copy code
{sheetID, sectionIdx, rowIdx, cellIdx }n

where sheetID is the ID property of the Shape object on the page or master whose cell result is to be modified.

If the sheetID in an entry is visInvalShapeID (-1) or if the bottom byte of sectionIdx is visSectionInval (255), the entry is ignored by the SetResults method. This is because the same SID_SRCStream array can be used on several calls to SetFormulas, GetFormulas, and similar methods with the caller only needing to make minor changes to the stream between calls.

The formulaArray() parameter should be a one-dimensional array of 1 <= m variants. Each Variant should be a String, a reference to a String, or Empty. If formulaArray(i) is empty, the i'th cell will be set to the formula in formulaArray(j), where j is the index of the most recent prior entry that is not empty. If there is no prior entry that is not empty, the corresponding cell is not altered. If fewer formulas than cells are specified (m < n), the i'th cell, i > m, will be set to the same formula as was chosen to set the m'th cell to. Thus to set many cells to the same formula, you need pass only one copy of the formula.

The Flags argument should be a bitmask of the following values.

Constant | Value | Description
visSetBlastGuards | &H2 | Override present cell values even if they're guarded.
visSetTestCircular | &H4 | Test for establishment of circular cell references.
visSetUniversalSyntax | &H8 | Formulas are in universal syntax.

The value returned by the SetFormulas method is the number of entries in SID_SRCStream() that were successfully processed. If i < n entries process correctly, but an error occurs on the i + 1st entry, the SetFormulas method raises an exception and returns i. Otherwise, n is returned.

Example

The following macro shows how to use the SetFormulas method. It assumes that there is an active Microsoft Office Visio page that has at least three shapes on it. It uses the GetFormulas method to get the width of shape 1, the height of shape 2, and the angle of shape 3. It then uses SetFormulas to set the width of shape 1 to the height of shape 2 and the height of shape 2 to the width of shape 1. The angle of shape 3 is left unaltered.

This example uses the GetFormulas method of the Page object to get three cell formulas and the SetFormulas method of the same object to set the formulas. The input array has four slots for each cell, as it also would for Master objects. For Shape or Style objects, only three slots are needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub SetFormulas_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To 3 * 4) As Integer
 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Return the formulas of the cells.
 Dim avarFormulaArray() As Variant
 ActivePage.GetFormulas aintSheetSectionRowColumn, avarFormulaArray

 'Use SetFormulas to:
 ' - Set the width of shape 1 to height of shape 2.
 ' - Set height of shape 2 to width of shape 1.
 ' Note: avarFormulaArray() is indexed from 0 to 2.
 Dim varTemp As variant
 varTemp = avarFormulaArray(0)
 avarFormulaArray(0) = avarFormulaArray(1)
 avarFormulaArray(1) = varTemp

 'Pass the same array back to SetFormulas that we
 'just passed to GetFormulas, leaving angle alone. By setting
 'the sheet ID entry in the third slot of the
 'aintSheetSectionRowColumn array to visInvalShapeID,
 'we tell SetFormulas to ignore that slot.
 aintSheetSectionRowColumn (9) = visInvalShapeID

 'Tell Microsoft Visio to set the formulas of the cells.
 ActivePage.SetFormulas aintSheetSectionRowColumn, avarFormulaArray, 0

 Exit Sub

HandleError:

 MsgBox "Error"

 Exit Sub

End Sub


Master.SetResults Method (Visio)

 Copy code hover
[image]

Master.SetResults Method (Visio)
Send feedback

Published: July 16, 2012

Sets the results or formulas of one or more cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .SetResults(SID_SRCStream(), UnitsNamesOrCodes(), resultArray(), Flags)

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | An array identifying cells to be modified.
UnitsNamesOrCodes() | Required | Variant | Measurement units to be attributed to entries in results array.
resultArray() | Required | Variant | Results or formulas to be assigned to identified cells.
Flags | Required | Integer | Flags that influence the behavior of SetResults.

Return Value

Integer

Remarks

The SetResults method is like the Result method of a Cell object, except that it can be used to set the results (values) of many cells at once, rather than one cell at a time.

For Master objects, you can use the SetResults method to set results of any set of cells in any set of shapes of the page or master. You tell the SetResults method which cells you want to set by passing an array of integers in SID_SRCStream(). SID_SRCStream() is a one-dimensional array of 2-byte integers.

For Master objects, SID_SRCStream() should be a one-dimensional array of 4n 2-byte integers for n >= 1. The SetResults method interprets the stream as:

VBA Copy code Copy code
{sheetID, sectionIdx, rowIdx, cellIdx }n

where sheetID is the ID property of the Shape object on the page or master whose cell result is to be modified.

If the sheetID in an entry is visInvalShapeID (-1) or if the bottom byte of sectionIdx is visSectionInval (255), the entry is ignored by the SetResults method. The motivation for this is that the same SID_SRCStream() array can be used on several calls to SetResults, GetResults, and similar methods with the caller only needing to make minor changes to the stream between calls.

The UnitsNamesOrCodes() array controls what measurement units individual entries in results are in. Each entry in the array can be a string such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Office Visio units such as centimeters, meters, miles, and so on. You can also indicate desired units with integer constants (visCentimeters, visInches, and so on) declared by the Visio type library in VisUnitCodes. For a list of constants used for units of measure, see About Units of Measure. Note that the values specified in the UnitsNamesOrCodes() array have no effect if visSetFormulas is set in Flags.

If UnitsNamesOrCodes() is not empty, we expect it to be a one-dimensional array of 1 <= u variants. Each entry can be a string or integer code, or empty (nothing). If the i'th entry is empty, the i'th entry in resultArray() is in the units designated by UnitsNamesOrCodes(j), where j is the most recent prior entry that is not empty. Thus, if you want all entries in resultArray() to be interpreted in the same units, you need only pass a UnitsNamesOrCodes() array that has one entry. If there is no prior entry that is not empty, or if no UnitsNamesOrCodes() array is supplied, visNumber (0x20) will be used. This causes the application to default to internal units (as does the ResultIU property of a Cell object).

The resultArray() parameter should be a one-dimensional array of 1 <= m variants. A result can be passed as Double, Integer, String, or a reference to a String. Strings are accepted only if visSetFormulas is set in Flags, in which case strings are interpreted as formulas. If resultArray(i) is empty, the i'th cell will be set to the value in resultArray(j), where j is the index of the most recent prior entry that is not empty. If there is no prior entry that is not empty, the corresponding cell is not altered. If fewer results than cells are specified (if m < n), the i'th cell, i < m, will be set to the same value as the m'th cell. Thus, to set many cells to the same value, you need only pass one copy of the value.

The Flags parameter should be a bitmask of the following values.

Constant | Value | Description
visSetFormulas | &H1 | Treat strings in results as formulas.
visSetBlastGuards | &H2 | Override present cell values even if they're guarded.
visSetTestCircular | &H4 | Test for establishment of circular cell references.
visSetUniversalSyntax | &H8 | Formulas are in universal syntax

The value returned by the SetResults method is the number of entries in SID_SRCStream() that were successfully processed. If i < n entries are processed correctly, but an error occurs on the i + 1st entry, the SetResults method raises an exception and returns i. Otherwise, n is returned.

Example

The following example shows how to use the SetResults method. This example assumes there is an active page that has at least 3 shapes on it. It uses the GetResults method to get the width of shape 1, the height of shape 2, and the angle of shape 3. It then uses SetResults to set the width of shape 1 to the height of shape 2 and the height of shape 2 to the width of shape 1.The angle of shape 3 is left unaltered.

This example uses the GetResults method of the Page object to get 3 cell formulas and the SetResults method of the same object to set the formulas. The input array has 4 slots for each cell, as it also would for Master objects. For Shape or Style objects, only 3 slots are needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub Set Results_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer
 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Get the first two values in inches. The second element in
 'the units array is left uninitialized (empty) because we
 'want the second result in the same units as the first
 'result. The third result is initialized in degrees. Note that
 'units can be expressed as a string or an integer constant.
 Dim avarUnits(1 To 3) As Variant
 avarUnits(1) = "in."
 avarUnits(3) = visDegrees

 'Return results of cells as an array of floating point numbers.
 Dim avarResults() As Variant
 ActivePage.GetResults aintSheetSectionRowColumn, visGetFloats, _
 avarUnits, avarResults

 'Use SetResults to:
 ' - Set the width of shape 1 to the height of shape 2.
 ' - Set the height of shape 2 to the width of shape 1.
 'NOTE: avarResults() is indexed from 0 to 2.
 Dim varTemp As variant
 varTemp = avarResults(0)
 avarResults(0) = avarResults(1)
 avarResults(1) = varTemp

 'Pass the same array back to SetResults that we
 'just passed to GetResults, but leave the angle
 'alone. By setting the sheet ID entry in the third
 'slot of the aintSheetSectionRowColumn array to
 'visInvalShapeID, we tell SetResults to ignore that slot.
 aintSheetSectionRowColumn(9) = visInvalShapeID

 'Set the results of the cells.
 ActivePage.SetResults aintSheetSectionRowColumn, avarUnits, avarResults, 0

 Exit Sub

HandleError:

 MsgBox "Error"

 Exit Sub

End Sub


Master Events (Visio)

 Copy code hover
[image]

Master Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.


Master.BeforeMasterDelete Event (Visio)

 Copy code hover
[image]

Master.BeforeMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a master is deleted from a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.BeforeSelectionDelete Event (Visio)

 Copy code hover
[image]

Master.BeforeSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before selected objects are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selected objects that are going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. To find out if a shape is locked against deletion, check the value of its LockDelete cell.

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.BeforeShapeDelete Event (Visio)

 Copy code hover
[image]

Master.BeforeShapeDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is deleted.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeShapeDelete(ByVal Shape As [IVSHAPE])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeShapeDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use the VBA WithEvents keyword to sink the BeforeShapeDelete event.

For performance considerations, the Document object's event set does not include the BeforeShapeDelete event. To sink the BeforeShapeDelete event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Master.BeforeShapeTextEdit Event (Visio)

 Copy code hover
[image]

Master.BeforeShapeTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is opened for text editing in the user interface.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _BeforeShapeTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be opened for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.CellChanged Event (Visio)

 Copy code hover
[image]

Master.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


Master.ConnectionsAdded Event (Visio)

 Copy code hover
[image]

Master.ConnectionsAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections have been established between shapes.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsAdded(ByVal Connects As [IVCONNECTS])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that were established.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsAdded event. To sink the ConnectionsAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Master.ConnectionsDeleted Event (Visio)

 Copy code hover
[image]

Master.ConnectionsDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections between shapes have been removed.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsDeleted(ByVal Connects As [IVCONNECTS])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that have been removed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsDeleted event. To sink the ConnectionsDeleted event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Master.ConvertToGroupCanceled Event (Visio)

 Copy code hover
[image]

Master.ConvertToGroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ConvertToGroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.FormulaChanged Event (Visio)

 Copy code hover
[image]

Master.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Master.GroupCanceled Event (Visio)

 Copy code hover
[image]

Master.GroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _GroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.MasterChanged Event (Visio)

 Copy code hover
[image]

Master.MasterChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after properties of a master are changed and propagated to its instances.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterChanged(ByVal Master As [IVMASTER])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master whose properties changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.MasterDeleteCanceled Event (Visio)

 Copy code hover
[image]

Master.MasterDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _MasterDeleteCanceled(ByVal Master As [IVMASTER])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.QueryCancelConvertToGroup Event (Visio)

 Copy code hover
[image]

Master.QueryCancelConvertToGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelConvertToGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be converted to a group.

Remarks

A Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • If all handlers return False (don't cancel), the conversion is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.QueryCancelGroup Event (Visio)

 Copy code hover
[image]

Master.QueryCancelGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be grouped.

Remarks

A Microsoft Visio instance fires QueryCancelGroup after the user has directed the instance to group a selection of shapes.

  • If any event handler returns True (cancel), the instance fires GroupCanceled and does not group the shapes.

  • If all handlers return False (do not cancel), the grouping is performed.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you use Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.QueryCancelMasterDelete Event (Visio)

 Copy code hover
[image]

Master.QueryCancelMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelMasterDelete after the user has directed the instance to delete a master.

  • If any event handler returns True (cancel), the instance fires MasterDeleteCanceled and does not delete the master.

  • If all handlers return False (don't cancel), the instance fires BeforeMasterDelete and then deletes the master.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.QueryCancelSelectionDelete Event (Visio)

 Copy code hover
[image]

Master.QueryCancelSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelSelectionDelete after the user has directed the instance to delete one or more shapes.

  • If any event handler returns True (cancel), the instance fires SelectionDeleteCanceled and does not delete the shapes.

  • If all handlers returnFalse (don't cancel), the instance fires BeforeSelectionDelete and BeforeShapeDelete and then deletes the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.QueryCancelUngroup Event (Visio)

 Copy code hover
[image]

Master.QueryCancelUngroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelUngroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be ungrouped.

Remarks

A Microsoft Visio instance fires QueryCancelUngroup after the user has directed the instance to ungroup one or more shapes.

  • If any event handler returns True (cancel), the instance fires UngroupCanceled and does not ungroup the shapes.

  • If all handlers return False (don't cancel), the instance fires ShapeParentChanged, BeforeSelectionDelete, and BeforeShapeDelete, and then ungroups the shapes.

While a Visio instance is firing a query or cancel event, it respondsto inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.SelectionAdded Event (Visio)

 Copy code hover
[image]

Master.SelectionAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionAdded(ByVal Selection As [IVSELECTION])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the SelectionAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the SelectionAdded event.

For performance considerations, the Document object's event set does not include the SelectionAdded event. To sink the SelectionAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Master.SelectionDeleteCanceled Event (Visio)

 Copy code hover
[image]

Master.SelectionDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _SelectionDeleteCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.ShapeAdded Event (Visio)

 Copy code hover
[image]

Master.ShapeAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _ShapeAdded(ByVal Shape As [IVSHAPE])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape or group of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the ShapeAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

To determine if a ShapeAdded event was triggered by a new shape or group of shapes being added to the page, by a set of existing shapes being grouped, or by a paste action, you can use the Application.IsInScope property. If IsInScope returns True when passed visCmdObjectGroup, the ShapeAdded event was triggered by a grouping action. If IsInScope returns True when passed visCmdUFEditPaste or visCmdEditPasteSpecial, the ShapeAdded event was triggered by a paste operation. If IsInScope returns False when passed all of these arguments, the event must have been triggered by new shapes being added to the page.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square. Paste the code into the active document's project in Visio.

The DocumentSaved event handler runs when the active document is saved. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentSaved(ByVal vsoDocument As Visio.IVDocument)

 'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 'the shape was created locally.
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Master.ShapeChanged Event (Visio)

 Copy code hover
[image]

Master.ShapeChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a property of a shape that is not stored in a cell is changed in a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _ShapeChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose property changed.

Remarks

To determine which properties have changed when ShapeChanged fires, use the EventInfo property. The string returned by the EventInfo property contains a list of substrings that identify the properties that changed.

Changes to the following shape properties cause the ShapeChanged event to fire:

  • Name (the EventInfo property contains "/name")

  • Data1 (the EventInfo property contains "/data1")

  • Data2 (the EventInfo property contains "/data2")

  • Data3 (the EventInfo property contains "/data3")

  • UniqueID (the EventInfo property contains "/uniqueid")

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection that was created by using AddAdvise, the varMoreInfo argument to VisEventProc contains the string: "/doc=1 /page=1 /shape=Sheet.3"

Note Note

You can use VBA WithEvents variables to sink the ShapeChanged event.

For performance considerations, the Document object's event set does not include the ShapeChanged event. To sink the ShapeChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Master.ShapeDataGraphicChanged Event (Visio)

 Copy code hover
[image]

Master.ShapeDataGraphicChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a data graphic is applied to or deleted from a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeDataGraphicChanged(ByVal Shape As IVSHAPE)

expression An expression that returns a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape to which the data graphic was applied or from which it was deleted.

Remarks

A data graphic is a Master object of type visTypeDataGraphic. When the same master that is already applied to a shape is re-applied to the shape, the ShapeDataGraphicChanged event does not fire, even if the master has been modified since it was applied originally. If, however, a different data graphic master is applied to the shape, the event does fire.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.ShapeExitedTextEdit Event (Visio)

 Copy code hover
[image]

Master.ShapeExitedTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is no longer open for interactive text editing.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeExitedTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that was closed for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.ShapeParentChanged Event (Visio)

 Copy code hover
[image]

Master.ShapeParentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after shapes are grouped or a group is ungrouped.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeParentChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose parent changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Master.TextChanged Event (Visio)

 Copy code hover
[image]

Master.TextChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the text of a shape is changed in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _TextChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose text changed.

Remarks

The TextChanged event is fired when the raw text of a shape changes, such as when the characters Microsoft Visio stores for the shape change. If a shape's characters change because a user is typing, the TextChanged event does not fire until the text editing session terminates.

When a field is added to or removed from a shape's text, its raw text changes; hence, a TextChanged event fires. However, no TextChanged event fires when the text in a field changes. For example, a shape has a text field that shows its width. A TextChanged event does not fire when the shape's width changes, because the raw text stored for the shape has not changed, even though the apparent (expanded) text of the shape does change. Use the CellChanged event for one of the cells in the Text Fields section to detect when the text in a text field changes.

To access a shape's raw text, use the Text property. To access the text of a shape in which text fields have been expanded, use the Characters.Text property. You can determine the location and properties of text fields in a shape's text by using the Shape.Characters object.

In Visio 5.0 and earlier versions, the raw characters reported by the Text property for a field included four characters, the first being the escape character. Starting with Visio 2000, only a single escape character is present in the raw text stream.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the TextChanged event.

For performance considerations, the Document object's event set does not include the TextChanged event. To sink the TextChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Master.UngroupCanceled Event (Visio)

 Copy code hover
[image]

Master.UngroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _UngroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Master object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be ungrouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters Object (Visio)

 Copy code hover
[image]

Masters Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Master object for each master in a document's stencil.

Remarks

To retrieve a Masters collection, use the Masters property of a Document object.

The default property of a Masters collection is Item.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this collection maps to the following types:

  • Microsoft.Office.Interop.Visio.IVMasters


Masters Members (Visio)

 Copy code hover
[image]

Masters Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Master object for each master in a document's stencil.

Events

Name | Description
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
MasterAdded | Occurs after a new master is added to a document.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Methods

Name | Description
Add | Adds a new object to a collection.
AddEx | Adds a new Master object of the specified type to the Masters collection of a Microsoft Visio document.
Drop | Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.
GetNames | Returns the names of all items in a collection.
GetNamesU | Returns the universal names of all items in a collection.
Paste | Pastes the contents of the Clipboard into an object.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Stat | Returns status information for an object. Read-only.


Masters Properties (Visio)

 Copy code hover
[image]

Masters Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Stat | Returns status information for an object. Read-only.


Masters.Application Property (Visio)

 Copy code hover
[image]

Masters.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Masters object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Masters.Count Property (Visio)

 Copy code hover
[image]

Masters.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Masters object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Masters.Document Property (Visio)

 Copy code hover
[image]

Masters.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Masters object.

Return Value

Document


Masters.EventList Property (Visio)

 Copy code hover
[image]

Masters.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Masters object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Masters.Item Property (Visio)

 Copy code hover
[image]

Masters.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameUIDOrIndex)

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
NameUIDOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

Master

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

You can also pass the unique ID string of a Master or Shape object to the Item property. For example:

VBA Copy code Copy code
objRet = vsoShapes.Item("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

If such a string is passed to the Item property of a Shapes collection, all the shapes contained in the collection are searched. Shapes within the group shapes in the containing shape are not searched.

To search all shapes in the collection, plus the shapes inside groups and the containing shape of the collection, prefix the unique ID string with an asterisk (*). For example:

VBA Copy code Copy code
objRet = vsoShapes.Item("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVMasters.this[object]


Masters.ItemFromID Property (Visio)

 Copy code hover
[image]

Masters.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item of a collection using the ID of the item. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemFromID(nID)

expression A variable that represents a Masters collection.

Parameters

Name | Required/Optional | Data Type | Description
nID | Required | Long | The ID of the object to retrieve.

Return Value

Master

Remarks

The ID of a Shape object uniquely identifies the shape within its page or master.

The ID of a Style object uniquely identifies the style within its document.

The ID of a Font object corresponds to the number stored in the Font cell of a row in a shape's Character Properties section. The ID associated with a particular font varies between systems or as fonts are installed on and removed from a given system.

The ID of an Event object uniquely identifies an event in its EventList collection for the life of the collection.


Masters.ItemU Property (Visio)

 Copy code hover
[image]

Masters.ItemU Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ItemU(NameUIDOrIndex)

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the universal name, unique ID, or index of the object to retrieve.

Return Value

Master

Remarks

You can retrieve an object in an Addons, Hyperlinks, Layers, Masters, MasterShortcuts, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

If you retrieve a Shape object by name, the ItemU property searches all shapes in the Shapes collection's containing page or containing master, in addition to the collection's containing shape. Therefore, the Shape object returned by the ItemU property can be a shape that is not in the Shapes collection.

You can also pass the unique ID string of a Master or Shape object to the ItemU property. For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

If such a string is passed to the ItemU property of a Shapes collection, all the shapes contained in the collection are searched. Shapes within the group shapes in the containing shape are not searched.

To search all shapes in the collection, plus the shapes inside groups and the containing shape of the collection, prefix the unique ID string with an asterisk (*). For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")
Note Note

  • In Visio 2000 only, vsoShapes.ItemU("{guid}") examined the Shapes collection's containing shape and all descendants, and vsoShapes.ItemU("*{guid}") examined all shapes in the Shapes collection's containing page or containing master.

  • Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

    As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

Example

This Microsoft Visual Basic macro shows how to use the ItemU property of the Pages collection to get the Shapes collection. Then it uses the ItemU property of the Shapes collection to print the universal names of all shapes on Page-1 in the Immediate window.

To run this macro, make sure the active document has shapes on Page-1.

VBA Copy code Copy code

Public Sub ItemU_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.ItemU(1).Shapes

    Debug.Print "Shapes in Document: "; ActiveDocument.Name
    Debug.Print "          on  Page: "; ActiveDocument.Pages.ItemU(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then

        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.ItemU(intCounter).Name
        Next intCounter

    Else

        Debug.Print " No Shapes On Page"

    End If

End Sub


Masters.ObjectType Property (Visio)

 Copy code hover
[image]

Masters.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Masters object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Masters.PersistsEvents Property (Visio)

 Copy code hover
[image]

Masters.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Masters object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Masters.Stat Property (Visio)

 Copy code hover
[image]

Masters.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Masters object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Masters Methods (Visio)

 Copy code hover
[image]

Masters Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.
AddEx | Adds a new Master object of the specified type to the Masters collection of a Microsoft Visio document.
Drop | Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.
GetNames | Returns the names of all items in a collection.
GetNamesU | Returns the universal names of all items in a collection.
Paste | Pastes the contents of the Clipboard into an object.


Masters.Add Method (Visio)

 Copy code hover
[image]

Masters.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents a Masters object.

Return Value

Master

Remarks

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.

Example

The following macro shows how to add Master objects to the Masters collection and Page objects to the Pages collection. It also shows how to add documents, layers, styles, events, and add-ons to their corresponding collections.

Before running this macro, replace Myfile.vsd with a valid .vsd file and references to path\filename and filename with a valid path and/or file name to an execuatable add-on (EXE) in your Visio project. The add-on should take no arguments.

VBA Copy code Copy code
Public Sub Add_Example()

 Dim vsoMasters As Visio.Masters
 Dim vsoAddons As Visio.Addons
 Dim vsoPages As Visio.Pages
 Dim vsoEventList As Visio.EventList
 Dim vsoLayers As Visio.Layers
 Dim vsoLayer As Visio.Layer
 Dim vsoStyles As Visio.Styles

 Dim vsoDocument As Visio.Document
 Dim vsoEvent As Visio.Event
 Dim vsoMaster As Visio.Master
 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoStyle As Visio.Style
 Dim vsoAddon As Visio.Addon

 'Add a document based on the Basic Diagram template.
 Set vsoDocument = Documents.Add("Basic Diagram.vst")

 'Add a document based on a drawing (creates a copy of the drawing).
 Set vsoDocument = Documents.Add("Myfile.vsd")

 'Add a document based on a stencil (creates a copy of the stencil).
 Set vsoDocument = Documents.Add("Basic Shapes.vss")

 'Add a document object based on no template.
 Set vsoDocument = Documents.Add("")

 'Get the Pages collection and add a page to the collection.
 Set vsoPages = vsoDocument.Pages
 Set vsoPage = vsoPages.Add

 'Get the Masters collection and add a master to the collection.
 Set vsoMasters = vsoDocument.Masters
 Set vsoMaster = vsoMasters.Add

 'Get the Layers collection and add a layer named "MyLayer"
 'to the collection.
 Set vsoLayers = vsoPage.Layers
 Set vsoLayer = vsoLayers.Add("MyLayer")

 'Draw a rectangle.
 Set vsoShape = vsoPage.DrawRectangle(3, 3, 5, 6)

 'Add this shape to MyLayer. The second argument is required but has
 'no effect, because vsoShape is not a group shape.
 vsoLayer.Add vsoShape, 0

 'Add a style named "My FillStyle" to the Styles collection.
 'This style is based on the Basic style and includes
 'only a Fill style.
 Set vsoStyles = vsoDocument.Styles
 Set vsoStyle = vsoStyles.Add("My FillStyle", "Basic", False, False, True)

 'Add a style named "My NoStyle" to the Styles collection.
 'This style is based on no style and includes
 'Text, Line, and Fill styles.
 Set vsoStyle = vsoStyles.Add("My NoStyle", "", True, True, True)

 'Add an add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add("path\filename")

 'Add a BeforeDeleteSelection event to the EventList collection
 'of the document. The event will start your add-on, which
 'takes no arguments.
 Set vsoEventList = vsoDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtCodeBefSelDel, visActCodeRunAddon, _
 "filename", "")

End Sub


Masters.AddEx Method (Visio)

 Copy code hover
[image]

Masters.AddEx Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new Master object of the specified type to the Masters collection of a Microsoft Visio document.

Version Information

Version Added: Visio 2007

Syntax

expression .AddEx(Type)

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | VisMasterTypes | A master type from the VisMasterTypes enumeration. See Remarks for possible values.

Return Value

Master

Remarks

For the Type parameter, pass one of the following members of VisMasterTypes, which is declared in the Visio type library.

Constant | Value | Description
visTypeMaster | 1 | Creates a shape master.
visTypeFillPattern | 2 | Creates a fill-pattern master.
visTypeLinePattern | 3 | Creates a line-pattern master.
visTypeLineEnd | 4 | Creates a line-end master.
visTypeDataGraphic | 5 | Creates a data graphic master.
visTypeThemeColors | 6 | Creates a theme-colors master.
visTypeThemeEffects | 7 | Creates a theme-effects master.

The AddEx method returns the Master object added.

If the master added is of type visTypeDataGraphic, Visio names it "Data Graphic", and if it is not the first data graphic in the Masters collection of the document, Visio appends the index number of the master in the collection to the name. For example, if there were already 5 objects in the Masters collection, one of which was a data graphic, the next data graphic added would be named "Data Graphic.6".

Naming of masters of type visTypeThemeColors and visTypeThemeEffects follows the same pattern, and the resulting new masters are named "Theme Colors.x" and "Theme Effects.x" respectively, where x is the index number in the collection. Masters of all other types are simply named "Master.x".

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AddEx method to add a new Master object of type visTypeDataGraphic to the Masters collection of the active document.

VBA Copy code Copy code
Public Sub AddEx_Example()

    Dim vsoMaster As Visio.Master

    Set vsoMaster = Visio.ActiveDocument.Masters.AddEx(visTypeDataGraphic)

    Debug.Print vsoMaster.Name

End Sub


Masters.Drop Method (Visio)

 Copy code hover
[image]

Masters.Drop Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Drop(ObjectToDrop, xPos, yPos)

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | [UNKNOWN] | The object to drop. While this is typically a Visio object such as a Master, Shape, or Selection object, it can be any OLE object that provides an IDataObject interface.
xPos | Required | Integer | The x-coordinate at which to place the center of the shape's width or PinX.
yPos | Required | Integer | The y-coordinate at which to place the center of the shape's height or PinY.

Return Value

Master

Remarks

Using the Drop method is similar to moving a shape with the mouse. The object dropped (ObjectToDrop) can be a master or a shape on the drawing page.

If ObjectToDrop is a Master, the pin of the master is dropped at the specified coordinates. A master's pin is often, but not necessarily, at its center of rotation.


Masters.GetNames Method (Visio)

 Copy code hover
[image]

Masters.GetNames Method (Visio)
Send feedback

Published: July 16, 2012

Returns the names of all items in a collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNames(localeSpecificNameArray())

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
localeSpecificNameArray() | Required | STring | Out parameter. An array that receives names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNames method succeeds, localeSpecificNameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. localeSpecificNameArray() is an out parameter that is allocated by the GetNames method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Microsoft Visual Basic for Applications (VBA) take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.

Example

The following VBA macro shows how to use the GetNames method to get the names of all the Master objects in the Masters collection of the active document and print them in the Immediate window.

VBA Copy code Copy code

Public Sub GetNames_Example()

 Dim strMasterNames() As String
 Dim intLowerBound As Integer
 Dim intUpperBound As Integer

 ActiveDocument.Masters.GetNames strMasterNames
 intLowerBound = LBound(strMasterNames)
 intUpperBound = UBound(strMasterNames)
 Debug.Print ActiveDocument; " Lower bound:"; intLowerBound; "Upper bound:"; intUpperBound

 While intLowerBound <= intUpperBound

 Debug.Print strMasterNames (intLowerBound)
 intLowerBound = intLowerBound + 1

 Wend

End Sub


Masters.GetNamesU Method (Visio)

 Copy code hover
[image]

Masters.GetNamesU Method (Visio)
Send feedback

Published: July 16, 2012

Returns the universal names of all items in a collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNamesU(localeIndependentNameArray())

expression A variable that represents a Masters collection.

Parameters

Name | Required/Optional | Data Type | Description
localeIndependentNameArray() | Required | String | Out parameter. An array that receives the names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNamesU method succeeds, localeIndependentNameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. The localeIndependentNameArray() parameter is an out parameter that is allocated by the GetNamesU method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Microsoft Visual Basic for Applications (VBA) take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.

Example

The following VBA macro shows how to use the GetNamesU method to get the names of all the Master objects in the Masters collection of the active document and print them in the Immediate window.

VBA Copy code Copy code

Public Sub GetNamesU_Example()

 Dim strMasterNames() As String
 Dim intLowerBound As Integer
 Dim intUpperBound As Integer

 ActiveDocument.Masters.GetNamesU strMasterNames
 intLowerBound = LBound(strMasterNames)
 intUpperBound = UBound(strMasterNames)
 Debug.Print ActiveDocument; " Lower bound:"; intLowerBound; "Upper bound:"; intUpperBound

 While intLowerBound <= intUpperBound

 Debug.Print strMasterNames (intLowerBound)
 intLowerBound = intLowerBound + 1

 Wend

End Sub


Masters.Paste Method (Visio)

 Copy code hover
[image]

Masters.Paste Method (Visio)
Send feedback

Published: July 16, 2012

Pastes the contents of the Clipboard into an object.

Version Information

Version Added: Visio 2002

Syntax

expression .Paste(Flags)

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Optional | Variant | Determines how shapes are translated during the paste operation.

Return Value

Nothing

Remarks

The Paste method works only with Shape objects that are group shapes. Use the Type property of a shape to determine whether it is a group.

Possible values for Flags are declared by the Visio type library in VisCutCopyPasteCodes, and are described in the following table.

Flag | Value | Description
visCopyPasteNormal | &H0 | Follow default copying behavior.
visCopyPasteNoTranslate | &H1 | Copy shapes to their original coordinate locations.
visCopyPasteCenter | &H2 | Copy shapes to the center of the page.
visCopyPasteNoHealConnectors | &H4 | Do not clean up connectors attached to cut shapes.
visCopyPasteNoContainerMembers | &H8 | Do not cut and copy unselected members of containers or lists.
visCopyPasteNoAssociatedCallouts | &H16 | Do not cut and copy unselected callouts associated with shapes.
visCopyPasteDontAddToContainers | &H32 | Do not add pasted shapes to any underlying containers.
visCopyPasteNoCascade | &H64 | Do not offset shapes on copy.

Setting Flags to visCopyPasteNormal is the equivalent of the behavior in the user interface. You should use visCopyPasteNormal and the other flags consistently. For example, if you use the value visCopyPasteNoTranslate to copy, you should also use that value to paste, because that is the only way to ensure that shapes are pasted to their original coordinate location.

If you need to control the format of the pasted information and (optionally) establish a link to a source file (for example, a Microsoft Word document), use the PasteSpecial method.


Masters Events (Visio)

 Copy code hover
[image]

Masters Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
BeforeMasterDelete | Occurs before a master is deleted from a document.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
MasterAdded | Occurs after a new master is added to a document.
MasterChanged | Occurs after properties of a master are changed and propagated to its instances.
MasterDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelMasterDelete | Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.


Masters.BeforeMasterDelete Event (Visio)

 Copy code hover
[image]

Masters.BeforeMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a master is deleted from a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.BeforeSelectionDelete Event (Visio)

 Copy code hover
[image]

Masters.BeforeSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before selected objects are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selected objects that are going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. To find out if a shape is locked against deletion, check the value of its LockDelete cell.

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.BeforeShapeDelete Event (Visio)

 Copy code hover
[image]

Masters.BeforeShapeDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is deleted.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeShapeDelete(ByVal Shape As [IVSHAPE])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeShapeDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use the VBA WithEvents keyword to sink the BeforeShapeDelete event.

For performance considerations, the Document object's event set does not include the BeforeShapeDelete event. To sink the BeforeShapeDelete event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Masters.BeforeShapeTextEdit Event (Visio)

 Copy code hover
[image]

Masters.BeforeShapeTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is opened for text editing in the user interface.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _BeforeShapeTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be opened for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.CellChanged Event (Visio)

 Copy code hover
[image]

Masters.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


Masters.ConnectionsAdded Event (Visio)

 Copy code hover
[image]

Masters.ConnectionsAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections have been established between shapes.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsAdded(ByVal Connects As [IVCONNECTS])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that were established.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsAdded event. To sink the ConnectionsAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Masters.ConnectionsDeleted Event (Visio)

 Copy code hover
[image]

Masters.ConnectionsDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections between shapes have been removed.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsDeleted(ByVal Connects As [IVCONNECTS])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that have been removed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsDeleted event. To sink the ConnectionsDeleted event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Masters.ConvertToGroupCanceled Event (Visio)

 Copy code hover
[image]

Masters.ConvertToGroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ConvertToGroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.FormulaChanged Event (Visio)

 Copy code hover
[image]

Masters.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Masters.GroupCanceled Event (Visio)

 Copy code hover
[image]

Masters.GroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _GroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.MasterAdded Event (Visio)

 Copy code hover
[image]

Masters.MasterAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new master is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterAdded(ByVal Master As [IVMASTER])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.MasterChanged Event (Visio)

 Copy code hover
[image]

Masters.MasterChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after properties of a master are changed and propagated to its instances.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _MasterChanged(ByVal Master As [IVMASTER])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master whose properties changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.MasterDeleteCanceled Event (Visio)

 Copy code hover
[image]

Masters.MasterDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _MasterDeleteCanceled(ByVal Master As [IVMASTER])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.QueryCancelConvertToGroup Event (Visio)

 Copy code hover
[image]

Masters.QueryCancelConvertToGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelConvertToGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be converted to a group.

Remarks

A Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • If all handlers return False (don't cancel), the conversion is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.QueryCancelGroup Event (Visio)

 Copy code hover
[image]

Masters.QueryCancelGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be grouped.

Remarks

A Microsoft Visio instance fires QueryCancelGroup after the user has directed the instance to group a selection of shapes.

  • If any event handler returns True (cancel), the instance fires GroupCanceled and does not group the shapes.

  • If all handlers return False (do not cancel), the grouping is performed.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you use Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.QueryCancelMasterDelete Event (Visio)

 Copy code hover
[image]

Masters.QueryCancelMasterDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelMasterDelete(ByVal Master As [IVMASTER])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Master | Required | [IVMASTER] | The master that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelMasterDelete after the user has directed the instance to delete a master.

  • If any event handler returns True (cancel), the instance fires MasterDeleteCanceled and does not delete the master.

  • If all handlers return False (don't cancel), the instance fires BeforeMasterDelete and then deletes the master.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.QueryCancelSelectionDelete Event (Visio)

 Copy code hover
[image]

Masters.QueryCancelSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelSelectionDelete after the user has directed the instance to delete one or more shapes.

  • If any event handler returns True (cancel), the instance fires SelectionDeleteCanceled and does not delete the shapes.

  • If all handlers returnFalse (don't cancel), the instance fires BeforeSelectionDelete and BeforeShapeDelete and then deletes the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.QueryCancelUngroup Event (Visio)

 Copy code hover
[image]

Masters.QueryCancelUngroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelUngroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be ungrouped.

Remarks

A Microsoft Visio instance fires QueryCancelUngroup after the user has directed the instance to ungroup one or more shapes.

  • If any event handler returns True (cancel), the instance fires UngroupCanceled and does not ungroup the shapes.

  • If all handlers return False (don't cancel), the instance fires ShapeParentChanged, BeforeSelectionDelete, and BeforeShapeDelete, and then ungroups the shapes.

While a Visio instance is firing a query or cancel event, it respondsto inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.SelectionAdded Event (Visio)

 Copy code hover
[image]

Masters.SelectionAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionAdded(ByVal Selection As [IVSELECTION])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the SelectionAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the SelectionAdded event.

For performance considerations, the Document object's event set does not include the SelectionAdded event. To sink the SelectionAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Masters.SelectionDeleteCanceled Event (Visio)

 Copy code hover
[image]

Masters.SelectionDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _SelectionDeleteCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.ShapeAdded Event (Visio)

 Copy code hover
[image]

Masters.ShapeAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _ShapeAdded(ByVal Shape As [IVSHAPE])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape or group of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the ShapeAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

To determine if a ShapeAdded event was triggered by a new shape or group of shapes being added to the page, by a set of existing shapes being grouped, or by a paste action, you can use the Application.IsInScope property. If IsInScope returns True when passed visCmdObjectGroup, the ShapeAdded event was triggered by a grouping action. If IsInScope returns True when passed visCmdUFEditPaste or visCmdEditPasteSpecial, the ShapeAdded event was triggered by a paste operation. If IsInScope returns False when passed all of these arguments, the event must have been triggered by new shapes being added to the page.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square. Paste the code into the active document's project in Visio.

The DocumentSaved event handler runs when the active document is saved. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentSaved(ByVal vsoDocument As Visio.IVDocument)

 'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 'the shape was created locally.
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Masters.ShapeChanged Event (Visio)

 Copy code hover
[image]

Masters.ShapeChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a property of a shape that is not stored in a cell is changed in a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _ShapeChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose property changed.

Remarks

To determine which properties have changed when ShapeChanged fires, use the EventInfo property. The string returned by the EventInfo property contains a list of substrings that identify the properties that changed.

Changes to the following shape properties cause the ShapeChanged event to fire:

  • Name (the EventInfo property contains "/name")

  • Data1 (the EventInfo property contains "/data1")

  • Data2 (the EventInfo property contains "/data2")

  • Data3 (the EventInfo property contains "/data3")

  • UniqueID (the EventInfo property contains "/uniqueid")

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection that was created by using AddAdvise, the varMoreInfo argument to VisEventProc contains the string: "/doc=1 /page=1 /shape=Sheet.3"

Note Note

You can use VBA WithEvents variables to sink the ShapeChanged event.

For performance considerations, the Document object's event set does not include the ShapeChanged event. To sink the ShapeChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Masters.ShapeDataGraphicChanged Event (Visio)

 Copy code hover
[image]

Masters.ShapeDataGraphicChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a data graphic is applied to or deleted from a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeDataGraphicChanged(ByVal Shape As IVSHAPE)

expression An expression that returns a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape to which the data graphic was applied or from which it was deleted.

Remarks

A data graphic is a Master object of type visTypeDataGraphic. When the same master that is already applied to a shape is re-applied to the shape, the ShapeDataGraphicChanged event does not fire, even if the master has been modified since it was applied originally. If, however, a different data graphic master is applied to the shape, the event does fire.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.ShapeExitedTextEdit Event (Visio)

 Copy code hover
[image]

Masters.ShapeExitedTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is no longer open for interactive text editing.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeExitedTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that was closed for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.ShapeParentChanged Event (Visio)

 Copy code hover
[image]

Masters.ShapeParentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after shapes are grouped or a group is ungrouped.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeParentChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose parent changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Masters.TextChanged Event (Visio)

 Copy code hover
[image]

Masters.TextChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the text of a shape is changed in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _TextChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose text changed.

Remarks

The TextChanged event is fired when the raw text of a shape changes, such as when the characters Microsoft Visio stores for the shape change. If a shape's characters change because a user is typing, the TextChanged event does not fire until the text editing session terminates.

When a field is added to or removed from a shape's text, its raw text changes; hence, a TextChanged event fires. However, no TextChanged event fires when the text in a field changes. For example, a shape has a text field that shows its width. A TextChanged event does not fire when the shape's width changes, because the raw text stored for the shape has not changed, even though the apparent (expanded) text of the shape does change. Use the CellChanged event for one of the cells in the Text Fields section to detect when the text in a text field changes.

To access a shape's raw text, use the Text property. To access the text of a shape in which text fields have been expanded, use the Characters.Text property. You can determine the location and properties of text fields in a shape's text by using the Shape.Characters object.

In Visio 5.0 and earlier versions, the raw characters reported by the Text property for a field included four characters, the first being the escape character. Starting with Visio 2000, only a single escape character is present in the raw text stream.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the TextChanged event.

For performance considerations, the Document object's event set does not include the TextChanged event. To sink the TextChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Masters.UngroupCanceled Event (Visio)

 Copy code hover
[image]

Masters.UngroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _UngroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Masters object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be ungrouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


MasterShortcut Object (Visio)

 Copy code hover
[image]

MasterShortcut Object (Visio)
Send feedback

Published: July 16, 2012

Represents a master shortcut in a stencil. A master shortcut references a master in a stencil.

Version Information

Version Added: Visio 2000

Remarks

The default property of a MasterShortcut object is Name.


MasterShortcut Members (Visio)

 Copy code hover
[image]

MasterShortcut Members (Visio)
Send feedback

Published: July 16, 2012

Represents a master shortcut in a stencil. A master shortcut references a master in a stencil.

Methods

Name | Description
Delete | Deletes an object.
ExportIcon | Exports the icon for a Master object to a named file or the Clipboard.
ImportIcon | Imports the icon for a Master object from a named file.
OpenIconWindow | Opens an icon window that shows a master's icon.

Properties

Name | Description
AlignName | Gets or sets the position of a master name in a stencil window. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
DropActions | Defines special actions to be performed on shapes created by using a master shortcut. Read/write.
Icon | Returns the icon contained in a master shortcut. Read/write.
IconSize | Gets or sets the size of a master icon. Read/write.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a MasterShortcut object in the MasterShortcuts collection. Read-only.
IndexInStencil | Gets or sets the index of a master or master shortcut object within its stencil. Read/write.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a MasterShortcut object. Read/write.
ObjectType | Returns an object's type. Read-only.
Prompt | Gets or sets the prompt string for a master or master shortcut. Read/write.
ShapeHelp | Gets or sets the help string used when the user clicks Help on the shortcut menu of a master shortcut. Read/write.
Stat | Returns status information for an object. Read-only.
TargetDocumentName | Gets and sets the path and file name of a Microsoft Visio document (usually a stencil) that contains the master to which a master shortcut refers. Read/write.
TargetMasterName | Gets or sets the name of the master to which the master shortcut refers. Read/write.


MasterShortcut Properties (Visio)

 Copy code hover
[image]

MasterShortcut Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlignName | Gets or sets the position of a master name in a stencil window. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
DropActions | Defines special actions to be performed on shapes created by using a master shortcut. Read/write.
Icon | Returns the icon contained in a master shortcut. Read/write.
IconSize | Gets or sets the size of a master icon. Read/write.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a MasterShortcut object in the MasterShortcuts collection. Read-only.
IndexInStencil | Gets or sets the index of a master or master shortcut object within its stencil. Read/write.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a MasterShortcut object. Read/write.
ObjectType | Returns an object's type. Read-only.
Prompt | Gets or sets the prompt string for a master or master shortcut. Read/write.
ShapeHelp | Gets or sets the help string used when the user clicks Help on the shortcut menu of a master shortcut. Read/write.
Stat | Returns status information for an object. Read-only.
TargetDocumentName | Gets and sets the path and file name of a Microsoft Visio document (usually a stencil) that contains the master to which a master shortcut refers. Read/write.
TargetMasterName | Gets or sets the name of the master to which the master shortcut refers. Read/write.


MasterShortcut.AlignName Property (Visio)

 Copy code hover
[image]

MasterShortcut.AlignName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the position of a master name in a stencil window. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .AlignName

expression A variable that represents a MasterShortcut object.

Return Value

Integer

Remarks

Only user-created stencils are editable. By default, Visio stencils are not editable.

The following constants declared by the Visio type library show the possible alignment values.

Constant | Value
visLeft | 1
visCenter | 2
visRight | 3


MasterShortcut.Application Property (Visio)

 Copy code hover
[image]

MasterShortcut.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a MasterShortcut object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


MasterShortcut.Document Property (Visio)

 Copy code hover
[image]

MasterShortcut.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a MasterShortcut object.

Return Value

Document


MasterShortcut.DropActions Property (Visio)

 Copy code hover
[image]

MasterShortcut.DropActions Property (Visio)
Send feedback

Published: July 16, 2012

Defines special actions to be performed on shapes created by using a master shortcut. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .DropActions

expression A variable that represents a MasterShortcut object.

Return Value

String

Remarks

When you drag a master shortcut onto a drawing page, Microsoft Visio applies any drop actions in the shortcut to the newly created shape. Each drop action defines a particular value or formula to be assigned to a particular cell in the new shape.

Because drop actions are defined by the shortcut, not the target master, it is possible to create several shortcuts that refer to the same target master, but which produce very different effects when dropped onto the drawing page.

The DropActions property can be blank, or it can define a series of one or more individual drop actions. Actions are separated by semicolons (;). Each action consists of the name of the cell to change, followed by the formula to apply to that cell, separated by an equals sign (=). For example:

VBA Copy code Copy code
Angle=45; FillForegnd=7; Width=(ThePage!PageWidth / 2 - 4cm)

The application does not validate drop actions until they are applied to a new shape. If the DropActions property contains syntax errors or invalid cell names, the offending actions are ignored. However, if the application is running in developer mode, an error message is displayed that identifies the invalid action and the cause of the error. When using shortcut drop actions in your code, always test your shortcuts in developer mode to make sure the drop actions do not contain errors.


MasterShortcut.Icon Property (Visio)

 Copy code hover
[image]

MasterShortcut.Icon Property (Visio)
Send feedback

Published: July 16, 2012

Returns the icon contained in a master shortcut. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .Icon

expression A variable that represents a MasterShortcut object.

Return Value

IPictureDisp

Remarks

The Icon property returns and accepts only HICON files. Microsoft Visio raises an exception if the object returned is a non-HICON file.

COM provides a standard implementation of a picture object that has the IPictureDisp interface on top of the underlying system picture support. The IPictureDisp interface exposes a picture object's properties and is implemented in the stdole type library as a StdPicture object creatable within Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic for Applications (VBA) projects in Visio.

To get information about the StdPicture object that supports the IPictureDisp interface:

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click stdole.

  4. Under Classes, examine the class named StdPicture.

For details about the IPictureDisp interface, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.

Currently, only in-process solutions can use the Icon property because the IPictureDisp interface cannot be marshaled.


MasterShortcut.IconSize Property (Visio)

 Copy code hover
[image]

MasterShortcut.IconSize Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the size of a master icon. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .IconSize

expression A variable that represents a MasterShortcut object.

Return Value

Integer

Remarks

The following constants declared by the Visio type library in VisMasterProperties show the possible values for the IconSize property.

Constant | Value
visNormal | 1
visTall | 2
visWide | 3
visDouble | 4


MasterShortcut.ID Property (Visio)

 Copy code hover
[image]

MasterShortcut.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ID of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ID

expression A variable that represents a MasterShortcut object.

Return Value

Long

Remarks

The ID of a shape is unique only within the scope of the page or master. The ID of a page, master, or style is unique within the scope of the document.

If a shape, page, master, or style is deleted, future objects in the same scope may be assigned the same ID. Therefore, persisting shape or style IDs in separate data stores is generally not as sound as persisting unique IDs using the UniqueID property.


MasterShortcut.Index Property (Visio)

 Copy code hover
[image]

MasterShortcut.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a MasterShortcut object in the MasterShortcuts collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a MasterShortcut object.

Return Value

Integer

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


MasterShortcut.IndexInStencil Property (Visio)

 Copy code hover
[image]

MasterShortcut.IndexInStencil Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the index of a master or master shortcut object within its stencil. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .IndexInStencil

expression A variable that represents a MasterShortcut object.

Return Value

Integer

Remarks

Beginning with Visio 2000, the document stencil window shows all Master and MasterShortcut objects in a Visio document. The Visio object model exposes the Master and MasterShortcut objects in a Document object as two distinct collections. The index returned by a Master object is its index with respect to other Master objects in its Document object and is unrelated to the presence or absence of MasterShortcut objects in the document. The index returned by a MasterShortcut object is its index with respect to other MasterShortcut objects in its Document object and is unrelated to the presence or absence of Master objects in the document.

Use the IndexInStencil property to maintain the relative order of Master and MasterShortcut objects when considered as a single collection.

Note Note

Beginning with Microsoft Office Visio 2003, only user-created stencils are editable. By default, Visio stencils are not editable.


MasterShortcut.Name Property (Visio)

 Copy code hover
[image]

MasterShortcut.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a MasterShortcut object.

Return Value

String

Remarks

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


MasterShortcut.NameU Property (Visio)

 Copy code hover
[image]

MasterShortcut.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of a MasterShortcut object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .NameU

expression A variable that represents a MasterShortcut object.

Return Value

String

Remarks

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


MasterShortcut.ObjectType Property (Visio)

 Copy code hover
[image]

MasterShortcut.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a MasterShortcut object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


MasterShortcut.Prompt Property (Visio)

 Copy code hover
[image]

MasterShortcut.Prompt Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the prompt string for a master or master shortcut. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Prompt

expression A variable that represents a MasterShortcut object.

Return Value

String


MasterShortcut.ShapeHelp Property (Visio)

 Copy code hover
[image]

MasterShortcut.ShapeHelp Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the help string used when the user clicks Help on the shortcut menu of a master shortcut. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .ShapeHelp

expression A variable that represents a MasterShortcut object.

Return Value

String

Remarks

If the help string is blank, the Help command uses the help string defined by the shortcut's target master, determined by the Help property of that master's top-level shape.


MasterShortcut.Stat Property (Visio)

 Copy code hover
[image]

MasterShortcut.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a MasterShortcut object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


MasterShortcut.TargetDocumentName Property (Visio)

 Copy code hover
[image]

MasterShortcut.TargetDocumentName Property (Visio)
Send feedback

Published: July 16, 2012

Gets and sets the path and file name of a Microsoft Visio document (usually a stencil) that contains the master to which a master shortcut refers. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .TargetDocumentName

expression A variable that represents a MasterShortcut object.

Return Value

String

Remarks

If the target document is moved, deleted, or renamed, or if the property is set to the path of a nonexistent file, the application will not be able to access the shortcut's target master. As a result, the end user will not be able to use the shortcut to drop shapes onto their drawing.

If the TargetDocumentName property contains a file name but no path, the application looks for the target document in the file path set in the File Locations dialog box (click the File tab, click Options, click Advanced, and then, under General, click File Locations). The name may refer either to the document's file name or to one of its alternate file names. To set an alternate name for a document, use the AlternateNames property.

The TargetDocumentName property does not support file names that have relative paths.


MasterShortcut.TargetMasterName Property (Visio)

 Copy code hover
[image]

MasterShortcut.TargetMasterName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of the master to which the master shortcut refers. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .TargetMasterName

expression A variable that represents a MasterShortcut object.

Return Value

String

Remarks

The name specified by this property must be the target master's universal name, not its localized name. For a given master, the universal name is specified by the master's NameU property, and the local name by its Name property.

When the user drops a master shortcut onto a drawing page, the application first locates the document identified by the shortcut's TargetDocumentName property, and then it searches that document for a master whose universal name matches the shortcut's TargetMasterName property. Once located, the target master (not the shortcut) is used to create the new shape instance on the drawing page.


MasterShortcut Methods (Visio)

 Copy code hover
[image]

MasterShortcut Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.
ExportIcon | Exports the icon for a Master object to a named file or the Clipboard.
ImportIcon | Imports the icon for a Master object from a named file.
OpenIconWindow | Opens an icon window that shows a master's icon.


MasterShortcut.Delete Method (Visio)

 Copy code hover
[image]

MasterShortcut.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a MasterShortcut object.

Return Value

Nothing


MasterShortcut.ExportIcon Method (Visio)

 Copy code hover
[image]

MasterShortcut.ExportIcon Method (Visio)
Send feedback

Published: July 16, 2012

Exports the icon for a Master object to a named file or the Clipboard.

Version Information

Version Added: Visio 4.5

Syntax

expression .ExportIcon(FileName, Flags, TransparentRGB)

expression A variable that represents a MasterShortcut object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The file to which to export the icon.
Flags | Required | Integer | The format in which to write the exported file.
TransparentRGB | Optional | Variant | The color to substitute for any transparent areas of the exported icon image.

Return Value

Nothing

Remarks

If FileName is empty, the master's icon is copied to the Clipboard.

If the value of Flags is visIconFormatVisio (0), the icon is exported in the application internal icon format. The ImportIcon method accepts files written in this format.

If the value of Flags is visIconFormatBMP (2), the icon is exported in bitmap (.bmp) file format.

Starting with Microsoft Visio 2000, you can use the TransparentRGB argument with the ExportIcon method. If TransparentRGB is omitted, the color defaults to black, which simulates Visio 5.0 behavior.


MasterShortcut.ImportIcon Method (Visio)

 Copy code hover
[image]

MasterShortcut.ImportIcon Method (Visio)
Send feedback

Published: July 16, 2012

Imports the icon for a Master object from a named file.

Version Information

Version Added: Visio 4.5

Syntax

expression .ImportIcon(FileName)

expression A variable that represents a MasterShortcut object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file to import.

Return Value

Nothing

Remarks

The ImportIcon method can only import files that were produced by exporting a master icon in the application's internal icon format (visIconFormatVisio)—it does not accept icons in other file formats.


MasterShortcut.OpenIconWindow Method (Visio)

 Copy code hover
[image]

MasterShortcut.OpenIconWindow Method (Visio)
Send feedback

Published: July 16, 2012

Opens an icon window that shows a master's icon.

Version Information

Version Added: Visio 4.1

Syntax

expression .OpenIconWindow

expression A variable that represents a MasterShortcut object.

Return Value

Window

Remarks

If the master's icon is already displayed in an icon window, the OpenIconWindow method activates that window rather than opening another window.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the OpenIconWindow method to open an icon editing window.

VBA Copy code Copy code

Public Sub OpenIconWindow_Example()

 Dim vsoMaster As Visio.Master
 Dim vsoIconWindow As Visio.Window

 'Add a master to the document stencil and open its icon editing window.
 Set vsoMaster = ThisDocument.Masters.Add
 Set vsoIconWindow = vsoMaster.OpenIconWindow

End Sub


MasterShortcuts Object (Visio)

 Copy code hover
[image]

MasterShortcuts Object (Visio)
Send feedback

Published: July 16, 2012

Includes MasterShortcut objects.

Version Information

Version Added: Visio 2000

Remarks

To retrieve a MasterShortcuts collection, use the MasterShortcuts property of a Document object.

The default property of a MasterShortcuts collection is Item.


MasterShortcuts Members (Visio)

 Copy code hover
[image]

MasterShortcuts Members (Visio)
Send feedback

Published: July 16, 2012

Includes MasterShortcut objects.

Methods

Name | Description
Drop | Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.
GetNames | Returns the names of all items in a collection.
GetNamesU | Returns the universal names of all items in a collection.
Paste | Pastes the contents of the Clipboard into an object.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.


MasterShortcuts Properties (Visio)

 Copy code hover
[image]

MasterShortcuts Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.


MasterShortcuts.Application Property (Visio)

 Copy code hover
[image]

MasterShortcuts.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a MasterShortcuts object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


MasterShortcuts.Count Property (Visio)

 Copy code hover
[image]

MasterShortcuts.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a MasterShortcuts object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


MasterShortcuts.Document Property (Visio)

 Copy code hover
[image]

MasterShortcuts.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a MasterShortcuts object.

Return Value

Document


MasterShortcuts.Item Property (Visio)

 Copy code hover
[image]

MasterShortcuts.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameOrIndex)

expression A variable that represents a MasterShortcuts collection.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

MasterShortcut

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.


MasterShortcuts.ItemFromID Property (Visio)

 Copy code hover
[image]

MasterShortcuts.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item of a collection using the ID of the item. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemFromID(nID)

expression A variable that represents a MasterShortcuts collection.

Parameters

Name | Required/Optional | Data Type | Description
nID | Required | Long | The ID of the object to retrieve.

Return Value

MasterShortcut

Remarks

The ID of a Shape object uniquely identifies the shape within its page or master.

The ID of a Style object uniquely identifies the style within its document.

The ID of a Font object corresponds to the number stored in the Font cell of a row in a shape's Character Properties section. The ID associated with a particular font varies between systems or as fonts are installed on and removed from a given system.

The ID of an Event object uniquely identifies an event in its EventList collection for the life of the collection.


MasterShortcuts.ItemU Property (Visio)

 Copy code hover
[image]

MasterShortcuts.ItemU Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ItemU(NameOrIndex)

expression A variable that represents a MasterShortcuts object.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the universal name, unique ID, or index of the object to retrieve.

Return Value

MasterShortcut

Remarks

You can retrieve an object in an Addons, Hyperlinks, Layers, Masters, MasterShortcuts, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

If you retrieve a Shape object by name, the ItemU property searches all shapes in the Shapes collection's containing page or containing master, in addition to the collection's containing shape. Therefore, the Shape object returned by the ItemU property can be a shape that is not in the Shapes collection.

You can also pass the unique ID string of a Master or Shape object to the ItemU property. For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

If such a string is passed to the ItemU property of a Shapes collection, all the shapes contained in the collection are searched. Shapes within the group shapes in the containing shape are not searched.

To search all shapes in the collection, plus the shapes inside groups and the containing shape of the collection, prefix the unique ID string with an asterisk (*). For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")
Note Note

  • In Visio 2000 only, vsoShapes.ItemU("{guid}") examined the Shapes collection's containing shape and all descendants, and vsoShapes.ItemU("*{guid}") examined all shapes in the Shapes collection's containing page or containing master.

  • Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

    As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

Example

This Microsoft Visual Basic macro shows how to use the ItemU property of the Pages collection to get the Shapes collection. Then it uses the ItemU property of the Shapes collection to print the universal names of all shapes on Page-1 in the Immediate window.

To run this macro, make sure the active document has shapes on Page-1.

VBA Copy code Copy code
Public Sub ItemU_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.ItemU(1).Shapes

    Debug.Print "Shapes in Document: "; ActiveDocument.Name
    Debug.Print "          on  Page: "; ActiveDocument.Pages.ItemU(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then

        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.ItemU(intCounter).Name
        Next intCounter

    Else

        Debug.Print "No Shapes On Page"

    End If

End Sub


MasterShortcuts.ObjectType Property (Visio)

 Copy code hover
[image]

MasterShortcuts.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a MasterShortcuts object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


MasterShortcuts.Stat Property (Visio)

 Copy code hover
[image]

MasterShortcuts.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a MasterShortcuts object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


MasterShortcuts Methods (Visio)

 Copy code hover
[image]

MasterShortcuts Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Drop | Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.
GetNames | Returns the names of all items in a collection.
GetNamesU | Returns the universal names of all items in a collection.
Paste | Pastes the contents of the Clipboard into an object.


MasterShortcuts.Drop Method (Visio)

 Copy code hover
[image]

MasterShortcuts.Drop Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Drop(ObjectToDrop, xPos, yPos)

expression A variable that represents a MasterShortcuts object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | [UNKNOWN] | The object to drop. While this is typically a Visio object such as a Master, Shape, or Selection object, it can be any OLE object that provides an IDataObject interface.
xPos | Required | Integer | The x-coordinate at which to place the center of the shape's width or PinX.
yPos | Required | Integer | The y-coordinate at which to place the center of the shape's height or PinY.

Return Value

Master

Remarks

Using the Drop method is similar to moving a shape with the mouse. The object dropped (ObjectToDrop) can be a master or a shape on the drawing page.

If ObjectToDrop is a Master, the pin of the master is dropped at the specified coordinates. A master's pin is often, but not necessarily, at its center of rotation.


MasterShortcuts.GetNames Method (Visio)

 Copy code hover
[image]

MasterShortcuts.GetNames Method (Visio)
Send feedback

Published: July 16, 2012

Returns the names of all items in a collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNames(localeSpecificNameArray())

expression A variable that represents a MasterShortcuts object.

Parameters

Name | Required/Optional | Data Type | Description
localeSpecificNameArray() | Required | String | Out parameter. An array that receives names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNames method succeeds, localeSpecificNameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. localeSpecificNameArray() is an out parameter that is allocated by the GetNames method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.


MasterShortcuts.GetNamesU Method (Visio)

 Copy code hover
[image]

MasterShortcuts.GetNamesU Method (Visio)
Send feedback

Published: July 16, 2012

Returns the universal names of all items in a collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNamesU(localeIndependentNameArray())

expression A variable that represents a MasterShortcuts collection.

Parameters

Name | Required/Optional | Data Type | Description
localeIndependentNameArray() | Required | String | Out parameter. An array that receives the names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNamesU method succeeds, localeIndependentNameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. The localeIndependentNameArray() parameter is an out parameter that is allocated by the GetNamesU method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.


MasterShortcuts.Paste Method (Visio)

 Copy code hover
[image]

MasterShortcuts.Paste Method (Visio)
Send feedback

Published: July 16, 2012

Pastes the contents of the Clipboard into an object.

Version Information

Version Added: Visio 2002

Syntax

expression .Paste(Flags)

expression A variable that represents a MasterShortcuts object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Optional | Variant | Determines how shapes are translated during the paste operation.

Return Value

Nothing

Remarks

The Paste method works only with Shape objects that are group shapes. Use the Type property of a shape to determine whether it is a group.

Possible values for Flags are declared by the Visio type library in VisCutCopyPasteCodes, and are described in the following table.

Flag | Value | Description
visCopyPasteNormal | &H0 | Follow default copying behavior.
visCopyPasteNoTranslate | &H1 | Copy shapes to their original coordinate locations.
visCopyPasteCenter | &H2 | Copy shapes to the center of the page.
visCopyPasteNoHealConnectors | &H4 | Do not clean up connectors attached to cut shapes.
visCopyPasteNoContainerMembers | &H8 | Do not cut and copy unselected members of containers or lists.
visCopyPasteNoAssociatedCallouts | &H16 | Do not cut and copy unselected callouts associated with shapes.
visCopyPasteDontAddToContainers | &H32 | Do not add pasted shapes to any underlying containers.
visCopyPasteNoCascade | &H64 | Do not offset shapes on copy.

Setting Flags to visCopyPasteNormal is the equivalent of the behavior in the user interface. You should use visCopyPasteNormal and the other flags consistently. For example, if you use the value visCopyPasteNoTranslate to copy, you should also use that value to paste, because that is the only way to ensure that shapes are pasted to their original coordinate location.

If you need to control the format of the pasted information and (optionally) establish a link to a source file (for example, a Microsoft Word document), use the PasteSpecial method.


Menu Object (Visio)

 Copy code hover
[image]

Menu Object (Visio)
Send feedback

Published: July 16, 2012

Represents a single menu on a Microsoft Visio menu bar.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The index of a Menu object within the Menus collection corresponds to the menu's position from left to right on the menu bar, starting with zero (0) for the menu farthest to the left if the menus are arranged horizontally.


Menu Members (Visio)

 Copy code hover
[image]

Menu Members (Visio)
Send feedback

Published: July 16, 2012

Represents a single menu on a Microsoft Visio menu bar.

Methods

Name | Description
Delete | Deletes an object.
IconFileName | Sets a custom icon file for a menu or toolbar item.

Properties

Name | Description
ActionText | Gets or sets the action text for a menu. Read/write.
AddOnArgs | Gets or sets the argument string that you send to the add-on associated with a particular menu. Read/write.
AddOnName | Gets or sets the name of an add-on or procedure that is run when its associated menu is selected. Read/write.
BuiltIn | Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.
Caption | Gets or sets the caption for a menu. Read/write.
CmdNum | Gets or sets the command ID associated with a menu. Read/write.
CntrlType | Gets or sets the control type of a menu. Read/write.
Enabled | Determines whether or not an object is currently enabled. Read/write.
FaceID | Gets or sets the icon for an item. Read/write.
Index | Gets the ordinal position of a Menu object in a Menus collection. Read-only.
IsHierarchical | Indicates whether a menu is hierarchical; that is, whether it contains a drop-down menu that contains more items, which can in turn be accessed by iterating through the MenuItems collection of the menu. Read-only.
MDIWindowMenu | Determines whether this menu can be used by the MDI window manager to list the currently open MDI windows. Read/write.
MenuItems | Returns the MenuItems collection of a Menu object. Read-only.
PaletteWidth | Gets or sets the width of a palette in pixels. Read/write.
Parent | Determines the parent of an object. Read-only.
State | Determines a menu's state, pressed or not pressed. Read/write.
Style | Determines whether a menu shows an icon, a caption, or some combination. Read/write.
TypeSpecific1 | Gets or sets the type of a menu. Read/write.
TypeSpecific2 | Gets or sets the type of a menu. Read/write.
Visible | Determines whether an object is visible. Read/write.
Width | Gets the width of a menu in pixels. Read/write.


Menu Properties (Visio)

 Copy code hover
[image]

Menu Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActionText | Gets or sets the action text for a menu. Read/write.
AddOnArgs | Gets or sets the argument string that you send to the add-on associated with a particular menu. Read/write.
AddOnName | Gets or sets the name of an add-on or procedure that is run when its associated menu is selected. Read/write.
BuiltIn | Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.
Caption | Gets or sets the caption for a menu. Read/write.
CmdNum | Gets or sets the command ID associated with a menu. Read/write.
CntrlType | Gets or sets the control type of a menu. Read/write.
Enabled | Determines whether or not an object is currently enabled. Read/write.
FaceID | Gets or sets the icon for an item. Read/write.
Index | Gets the ordinal position of a Menu object in a Menus collection. Read-only.
IsHierarchical | Indicates whether a menu is hierarchical; that is, whether it contains a drop-down menu that contains more items, which can in turn be accessed by iterating through the MenuItems collection of the menu. Read-only.
MDIWindowMenu | Determines whether this menu can be used by the MDI window manager to list the currently open MDI windows. Read/write.
MenuItems | Returns the MenuItems collection of a Menu object. Read-only.
PaletteWidth | Gets or sets the width of a palette in pixels. Read/write.
Parent | Determines the parent of an object. Read-only.
State | Determines a menu's state, pressed or not pressed. Read/write.
Style | Determines whether a menu shows an icon, a caption, or some combination. Read/write.
TypeSpecific1 | Gets or sets the type of a menu. Read/write.
TypeSpecific2 | Gets or sets the type of a menu. Read/write.
Visible | Determines whether an object is visible. Read/write.
Width | Gets the width of a menu in pixels. Read/write.


Menu.ActionText Property (Visio)

 Copy code hover
[image]

Menu.ActionText Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the action text for a menu. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .ActionText

expression A variable that represents a Menu object.

Return Value

String

Remarks

Action text is a string that describes the action on the Undo, Redo, and Repeat menu items on the Quick Access toolbar.

If the ActionText property is empty and the object's CmdNum property is set to one of the Microsoft Visio built-in command IDs, the item uses the default action text from the built-in Visio user interface.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.


Menu.AddOnArgs Property (Visio)

 Copy code hover
[image]

Menu.AddOnArgs Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the argument string that you send to the add-on associated with a particular menu. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddOnArgs

expression A variable that represents a Menu object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

An argument's string can be anything appropriate for the add-on. However, the arguments are packaged together with other information into a command string, which cannot exceed 127 characters. For best results, limit arguments to 50 characters.

An object's AddOnName property indicates the name of the add-on to which the arguments are sent.

Beginning with Visio 2002, the AddOnName property used in the following example cannot execute a string that contains arbitrary Microsoft Visual Basic code. To call code that in previous versions of Visio you would have passed to the AddOnName property, move it to a procedure in a document's Visual Basic project that is called from the AddOnName property, as shown in the following example.


Menu.AddOnName Property (Visio)

 Copy code hover
[image]

Menu.AddOnName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of an add-on or procedure that is run when its associated menu is selected. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddOnName

expression A variable that represents a Menu object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Assuming that the name of the add-on in the Addons collection is string, if the project of the currently active document (or another project if it is referenced) does not have a procedure named string, or if the arguments passed in string do not match those specified in the procedure, Microsoft Visio runs the add-on named string. If no add-on named string can be found, Visio does nothing and reports no error. (You can use the TraceFlags property to monitor the procedures and add-ons that Visio attempts to run.)

If string is an add-on, use the AddOnArgs property to specify arguments to send to the add-on when it is run.

If string is a procedure, specify arguments using procname(arguments) or procname arguments.

When calling a procedure in a standard module it is recommended that you prefix the string with the module name that contains the procedure (for example, moduleName.procName) because more than one module can have a procedure with the same name.

To call a procedure in a project other than the project of the active document, use the syntax projName.modName.procName (you must have explicitly set a reference to projName in your Visual Basic project).

If the AddOnName property is set, Visio ignores the object's CmdNum property.

Note Note

Beginning with Visio 2002, the AddOnName property cannot execute a string that contains arbitrary VBA code. To call code that in previous versions of Visio you would have passed to the AddOnName property, move the code to a procedure in a document's VBA project that is called from the AddOnName property.


Menu.BuiltIn Property (Visio)

 Copy code hover
[image]

Menu.BuiltIn Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .BuiltIn

expression A variable that represents a Menu object.

Return Value

Boolean


Menu.Caption Property (Visio)

 Copy code hover
[image]

Menu.Caption Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the caption for a menu. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Caption

expression A variable that represents a Menu object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

  • Use an ampersand (&) in the string to cause the next character in the string to become the shortcut key for that menu or menu item. For example, the string "F&ormat" causes o to become the shortcut key for that menu item in that one menu.

  • Use "" in the string to display a double quotation mark on the menu.

  • Use && in the string to display an ampersand on the menu.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Caption property. It adds a menu and menu item to the Add-ins tab and sets the menu and menu item's Caption properties.

To restore the built-in user interface in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub Caption_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Microsoft Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a new menu before the Window menu.
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "MyNewMenu"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the Caption property for the new menu item.
 vsoMenuItem.Caption = "&MyNewMenuItem"

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


Menu.CmdNum Property (Visio)

 Copy code hover
[image]

Menu.CmdNum Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the command ID associated with a menu. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CmdNum

expression A variable that represents a Menu object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Valid command IDs are declared by the Visio type library in VisUICmds. They have the prefix visCmd.


Menu.CntrlType Property (Visio)

 Copy code hover
[image]

Menu.CntrlType Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the control type of a menu. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CntrlType

expression A variable that represents a Menu object.

Return Value

Integer


Menu.Enabled Property (Visio)

 Copy code hover
[image]

Menu.Enabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether or not an object is currently enabled. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Enabled

expression A variable that represents a Menu object.

Return Value

Boolean


Menu.FaceID Property (Visio)

 Copy code hover
[image]

Menu.FaceID Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the icon for an item. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .FaceID

expression A variable that represents a Menu object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You can use any of the constants prefixed with visIconIX that are declared by the Visio type library in VisUIIconIDs.

The FaceID property is the same as the TypeSpecific1 property when the CtrlType property is type visCtrlTypeBUTTON, which is declared in the Visio type library in VisUICtrlTypes.


Menu.Index Property (Visio)

 Copy code hover
[image]

Menu.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Menu object in a Menus collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Menu object.

Return Value

Long

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.

There are some exceptions. The Colors collection is indexed starting with 0.

These collections are also indexed starting with 0: AccelItems, AccelTables, MenuSets, MenuItems, Menus, ToolbarItems, Toolbars, and ToolbarSets.


Menu.IsHierarchical Property (Visio)

 Copy code hover
[image]

Menu.IsHierarchical Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether a menu is hierarchical; that is, whether it contains a drop-down menu that contains more items, which can in turn be accessed by iterating through the MenuItems collection of the menu. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .IsHierarchical

expression A variable that represents a Menu object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The value of the CmdNum property of a MenuItem object that represents a hierarchical menu should be zero (0). This corresponds to the Microsoft Visio constant visCmdHierarchical.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the IsHierarchical property to delete a hierarchical menu.

To restore Visio's built-in menus after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub IsHierarchical_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem
 Dim vsoHierarchicalMenuItems As Visio.MenuItems
 Dim vsoHierarchicalMenuItem As Visio.MenuItem

 'True if variable represents a hierarchical menu item.
 Dim blsHierarchicalState As Boolean

 Dim intCounterOuter As Integer
 Dim intCounterInner As Integer

 'Get the UIOject object for the copy of the built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Set vsoMenuSet to the drawing menu set.
 Set vsoMenuSet = vsoUIObject.MenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Tools menu. Because you got the built-in
 'menus, you know that you can find the Tools menu by its
 'position. If you had retrieved a custom UI, you would have
 'to loop through the menus checking the caption to find
 'the Tools menu. When you use a custom menu, there is no
 'guarantee that you will find a Tools menu, because it
 'could have been deleted.
 Set vsoMenu = vsoMenuSet.Menus(5)

 'Get the MenuItems collection for the Tools menu.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Locate the Macros menu item. Because you got the
 'built-in menus, you know you will find it. If you had
 'started from a custom menu, you would need to handle
 'the case of not finding the menu item.
 For intCounterOuter = 0 To vsoMenuItems.Count - 1

 'Retrieve the current menu item from the collection.
 Set vsoMenuItem = vsoMenuItems(intCounterOuter)

 'Check CmdNum to see if it is Macro.
 If vsoMenuItem.CmdNum = visCmdHierarchical And _
 vsoMenuItem.Caption = "&Macros" Then

 'The value of blsHierarchicalState is True.
 blsHierarchicalState = vsoMenuItem.IsHierarchical

 'Get the MenuItems collection for the
 'hierarchical menu.
 Set vsoHierarchicalMenuItems = vsoMenuItem.MenuItems

 'Locate the Visual Basic Editor menu item.
 'As with the Macros menu item, you know you will
 'find the Visual Basic Editor menu item
 'because you started with a copy of
 'the built-in menus.
 For intCounterInner = 0 To vsoHierarchicalMenuItems.Count - 1

 'Retrieve menu item from collection.
 Set vsoHierarchicalMenuItem = vsoHierarchicalMenuItems(intCounterInner)

 'Check CmdNum.
 If vsoHierarchicalMenuItem.CmdNum = visCmdToolsRunVBE Then

 'Delete the Visual Basic Editor menu item.
 vsoHierarchicalMenuItem.Delete

 'Exit the inner For loop.
 Exit For

 End If

 Next intCounterInner

 'Exit the outer For loop.
 Exit For

 End If

 Next intCounterOuter

 'Tell Microsoft Visio to use the custom user interface 'while the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


Menu.MDIWindowMenu Property (Visio)

 Copy code hover
[image]

Menu.MDIWindowMenu Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether this menu can be used by the MDI window manager to list the currently open MDI windows. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .MDIWindowMenu

expression A variable that represents a Menu object.

Return Value

Integer

Remarks

The MDIWindowMenu property usually refers to the Window menu.


Menu.MenuItems Property (Visio)

 Copy code hover
[image]

Menu.MenuItems Property (Visio)
Send feedback

Published: July 16, 2012

Returns the MenuItems collection of a Menu object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .MenuItems

expression A variable that represents a Menu object.

Return Value

MenuItems

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If a Menu object represents a hierarchical menu, its MenuItems collection contains submenu items. Otherwise, its MenuItems collection is empty.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Menus property to get the Menus collection of a MenuSet object. It adds a menu and menu item to the user interface and sets the Caption property of the menu and menu item.

To restore the built-in user interface in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub Menus_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Microsoft Office Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtId(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a new menu before the Window menu.
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "MyNewMenu"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the Caption property for the new menu item.
 vsoMenuItem.Caption = "&MyNewMenuItem"

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


Menu.PaletteWidth Property (Visio)

 Copy code hover
[image]

Menu.PaletteWidth Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the width of a palette in pixels. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .PaletteWidth

expression A variable that represents a Menu object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

A palette, like a toolbar, is organized horizontally, and items wrap to a new row if there is not enough horizontal space available. By default, only the icons of the items are shown.


Menu.Parent Property (Visio)

 Copy code hover
[image]

Menu.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a Menu object.

Return Value

Menus

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it. For example, the parent of a Menu object is the Menus collection that contains the Menu object.


Menu.State Property (Visio)

 Copy code hover
[image]

Menu.State Property (Visio)
Send feedback

Published: July 16, 2012

Determines a menu's state, pressed or not pressed. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .State

expression A variable that represents a Menu object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The State property can be one of the following constants declared by the Visio type library in VisUIButtonState.

Constant | Value | Description
visButtonUp | 0 | Button is not pressed
visButtonDown | -1 | Button is pressed


Menu.Style Property (Visio)

 Copy code hover
[image]

Menu.Style Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a menu shows an icon, a caption, or some combination. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Style

expression A variable that represents a Menu object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Possible values for the Style property are listed in the following table. These constants are declared by the Visio type library in VisUIButtonStyle.

Constant | Value
visButtonAutomatic | 0
visButtonCaption | 1
visButtonIcon | 2
visButtonIconandCaption | 3


Menu.TypeSpecific1 Property (Visio)

 Copy code hover
[image]

Menu.TypeSpecific1 Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the type of a menu. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TypeSpecific1

expression A variable that represents a Menu object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The value of an object's TypeSpecific1 property depends on the value of its CntrlType property.

CntrlType value | TypeSpecific1 value
visCtrlTypeBUTTON | Any constant prefixed with visIconIX that is declared by the Visio type library.
visCtrlTypeCOMBOBOX | Zero (0).
visCtrlTypeEDITBOX | Zero (0).
visCtrlTypeLABEL | The TypeSpecific1 property is not used.


Menu.TypeSpecific2 Property (Visio)

 Copy code hover
[image]

Menu.TypeSpecific2 Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the type of a menu. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TypeSpecific2

expression A variable that represents a Menu object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The value of an object's TypeSpecific2 property depends on the value of its CntrlType property.

CntrlType value | TypeSpecific1 value
visCtrlTypeBUTTON | The TypeSpecific2 property is not used.
visCtrlTypeCOMBOBOX | The current width of the control expressed in pixels.
visCtrlTypeEDITBOX | The current width of the control expressed in pixels.
visCtrlTypeLABEL | The TypeSpecific2 property is not used.


Menu.Visible Property (Visio)

 Copy code hover
[image]

Menu.Visible Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is visible. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Visible

expression A variable that represents a Menu object.

Return Value

Boolean


Menu.Width Property (Visio)

 Copy code hover
[image]

Menu.Width Property (Visio)
Send feedback

Published: July 16, 2012

Gets the width of a menu in pixels. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Width

expression A variable that represents a Menu object.

Return Value

Integer


Menu Methods (Visio)

 Copy code hover
[image]

Menu Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.
IconFileName | Sets a custom icon file for a menu or toolbar item.


Menu.Delete Method (Visio)

 Copy code hover
[image]

Menu.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a Menu object.

Return Value

Nothing


Menu.IconFileName Method (Visio)

 Copy code hover
[image]

Menu.IconFileName Method (Visio)
Send feedback

Published: July 16, 2012

Sets a custom icon file for a menu or toolbar item.

Version Information

Version Added: Visio 4.0

Syntax

expression .IconFileName(IconFileName)

expression A variable that represents a Menu object.

Parameters

Name | Required/Optional | Data Type | Description
IconFileName | Required | String | The path and name of the ICO, EXE, DLL, or VSL file to load.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The IconFileName method loads the file that contains the icon, saves the bits, and discards the file name.

If the icon contains multiple images, Microsoft Visio chooses the best icon, based on both icon size and color depth.

Unless IconFileName is a fully qualified path, the application searches for the ICO, EXE, DLL, or VSL file in the folders indicated by the Application object's AddonPaths property (assuming that the UIObject object is in the Visio process).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how use the IconFileName method to set the icon for a toolbar button. It retrieves a copy of the built-in Visio toolbars, adds a toolbar button, and sets the button icon.

Before running this code, replace path\filename with the full path to and name of a valid icon (.ico file) on your computer.

To restore the built-in Visio user interface after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code
Public Sub IconFileName_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = 1

 vsoToolbarItem.IconFileName "path\filename"

 'Use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


MenuItem Object (Visio)

 Copy code hover
[image]

MenuItem Object (Visio)
Send feedback

Published: July 16, 2012

Represents a single menu item on a Microsoft Visio menu.

Version Information

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Remarks

Note Note

The default property of MenuItem is Caption.

A MenuItem object contains all the information it needs to display the menu item and launch the appropriate Visio command or add-on. It also contains text for the Undo, Redo, and Repeat menu items and error messages.

The index of a MenuItem object within the MenuItems collection corresponds to the menu item's position from top to bottom on the menu or submenu, starting with zero (0).

If the menu item displays a submenu, the MenuItem object has a MenuItems collection that represents items on the submenu. The MenuItem object's Caption property contains the submenu title. Most of the other properties of the MenuItem object are ignored, because this object serves much the same role as a Menu object.


MenuItem Members (Visio)

 Copy code hover
[image]

MenuItem Members (Visio)
Send feedback

Published: July 16, 2012

Represents a single menu item on a Microsoft Visio menu.

Methods

Name | Description
Delete | Deletes an object.
IconFileName | Sets a custom icon file for a menu or toolbar item.

Properties

Name | Description
ActionText | Gets or sets the action text for a menu item. Read/write.
AddOnArgs | Gets or sets the argument string that you send to the add-on associated with a particular menu item. Read/write.
AddOnName | Gets or sets the name of an add-on or procedure that is run when its associated menu item is selected. Read/write.
BeginGroup | Determines whether a menu item appears at the beginning of a group of items on the menu. Read/write.
BuiltIn | Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.
Caption | Gets or sets the caption for a menu item. Read/write.
CmdNum | Gets or sets the command ID associated with a menu item. Read/write.
CntrlType | Gets or sets the control type of a menu item. Read/write.
Enabled | Determines whether or not an object is currently enabled. Read/write.
FaceID | Gets or sets the icon for an item. Read/write.
Index | Gets the ordinal position of a MenuItem object in the MenuItems collection. Read-only.
IsHierarchical | Indicates whether a menu item is hierarchical; that is, whether it contains a drop-down menu that contains more items, which can in turn be accessed by iterating through the MenuItems collection of the menu item. Read-only.
MenuItems | Returns the MenuItems collection of a MenuItem object. Read-only.
PaletteWidth | Gets or sets the width of a palette in pixels. Read/write.
Parent | Determines the parent of an object. Read-only.
State | Determines a menu item's state, pressed or not pressed. Read/write.
Style | Determines whether a menu item shows an icon, a caption, or some combination. Read/write.
TypeSpecific1 | Gets or sets the type of a menu item. Read/write.
TypeSpecific2 | Gets or sets the type of a menu item. Read/write.
Visible | Determines whether an object is visible. Read/write.
Width | Gets the width of an object in pixels. Read/write.


MenuItem Properties (Visio)

 Copy code hover
[image]

MenuItem Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActionText | Gets or sets the action text for a menu item. Read/write.
AddOnArgs | Gets or sets the argument string that you send to the add-on associated with a particular menu item. Read/write.
AddOnName | Gets or sets the name of an add-on or procedure that is run when its associated menu item is selected. Read/write.
BeginGroup | Determines whether a menu item appears at the beginning of a group of items on the menu. Read/write.
BuiltIn | Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.
Caption | Gets or sets the caption for a menu item. Read/write.
CmdNum | Gets or sets the command ID associated with a menu item. Read/write.
CntrlType | Gets or sets the control type of a menu item. Read/write.
Enabled | Determines whether or not an object is currently enabled. Read/write.
FaceID | Gets or sets the icon for an item. Read/write.
Index | Gets the ordinal position of a MenuItem object in the MenuItems collection. Read-only.
IsHierarchical | Indicates whether a menu item is hierarchical; that is, whether it contains a drop-down menu that contains more items, which can in turn be accessed by iterating through the MenuItems collection of the menu item. Read-only.
MenuItems | Returns the MenuItems collection of a MenuItem object. Read-only.
PaletteWidth | Gets or sets the width of a palette in pixels. Read/write.
Parent | Determines the parent of an object. Read-only.
State | Determines a menu item's state, pressed or not pressed. Read/write.
Style | Determines whether a menu item shows an icon, a caption, or some combination. Read/write.
TypeSpecific1 | Gets or sets the type of a menu item. Read/write.
TypeSpecific2 | Gets or sets the type of a menu item. Read/write.
Visible | Determines whether an object is visible. Read/write.
Width | Gets the width of an object in pixels. Read/write.


MenuItem.ActionText Property (Visio)

 Copy code hover
[image]

MenuItem.ActionText Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the action text for a menu item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .ActionText

expression A variable that represents a MenuItem object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Action text is a string that describes the action on the Undo, Redo, and Repeat menu items on the Quick Access toolbar.

If the ActionText property is empty and the object's CmdNum property is set to one of the Microsoft Visio built-in command IDs, the item uses the default action text from the built-in Visio user interface.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to set a menu item's ActionText property. It also shows how to add a menu and menu item to the drawing window menu set. This example assumes that you already have a macro in the current Visual Basic project. Before running this macro, replace macroname with the name of your macro.

Beginning with Microsoft Visio 2002, the AddOnName property used in this example cannot execute a string that contains arbitrary Microsoft Visual Basic code. To call code that in previous versions of Visio you would have passed to the AddOnName property, move it to a procedure in a document's Visual Basic project that is called from the AddOnName property, as shown in this example.

To restore the built-in user interface in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub ActionText_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Visio built-in menus
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a Demo menu before the Window menu
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "Demo"

 'Get the MenuItems collection
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new Demo menu
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the properties for the new menu item
 vsoMenuItem.Caption = "&macroname"
 vsoMenuItem.AddOnName = "ThisDocument.macroname"
 vsoMenuItem.AddOnArgs = "/Arg1 = True"
 vsoMenuItem.ActionText = "Run(macroname)"

 'Tell Visio to use the new UI when the document is active
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


MenuItem.AddOnArgs Property (Visio)

 Copy code hover
[image]

MenuItem.AddOnArgs Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the argument string that you send to the add-on associated with a particular menu item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddOnArgs

expression A variable that represents a MenuItem object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

An argument's string can be anything appropriate for the add-on. However, the arguments are packaged together with other information into a command string, which cannot exceed 127 characters. For best results, limit arguments to 50 characters.

An object's AddOnName property indicates the name of the add-on to which the arguments are sent.

Beginning with Visio 2002, the AddOnName property used in the following example cannot execute a string that contains arbitrary Microsoft Visual Basic code. To call code that in previous versions of Visio you would have passed to the AddOnName property, move it to a procedure in a document's Visual Basic project that is called from the AddOnName property, as shown in the following example.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to set the AddOnArgs property of a menu item. It also shows how to add a menu and menu item to the drawing window menu set and how to set some of the menu item's other properties, such as Caption, AddOnName, and ActionText.

This example assumes that you already have a macro in the current Visual Basic project, and that that macro takes one argument called "Arg1". Before running this example, replace macroname with the name of your macro.

To restore the built-in user interface after running this macro, use the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub AddOnArgs_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Visio built-in menus
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a Demo menu before the Window menu
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "Demo"

 'Get the MenuItems collection
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new Demo menu
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the properties for the new menu item
 vsoMenuItem.Caption = "&macroname"
 vsoMenuItem.AddOnName = "ThisDocument.macroname"
 vsoMenuItem.AddOnArgs = "/Arg1 = True"
 vsoMenuItem.ActionText = "Run(macroname)"

 'Tell Visio to use the new UI when the document is active
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


MenuItem.AddOnName Property (Visio)

 Copy code hover
[image]

MenuItem.AddOnName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of an add-on or procedure that is run when its associated menu item is selected. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddOnName

expression A variable that represents a MenuItem object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Assuming that the name of the add-on in the Addons collection is string, if the project of the currently active document (or another project if it is referenced) does not have a procedure named string, or if the arguments passed in string do not match those specified in the procedure, Microsoft Visio runs the add-on named string. If no add-on named string can be found, Visio does nothing and reports no error. (You can use the TraceFlags property to monitor the procedures and add-ons that Visio attempts to run.)

If string is an add-on, use the AddOnArgs property to specify arguments to send to the add-on when it is run.

If string is a procedure, specify arguments using procname(arguments) or procname arguments.

When calling a procedure in a standard module it is recommended that you prefix the string with the module name that contains the procedure (for example, moduleName.procName) because more than one module can have a procedure with the same name.

To call a procedure in a project other than the project of the active document, use the syntax projName.modName.procName (you must have explicitly set a reference to projName in your Visual Basic project).

If the AddOnName property is set, Visio ignores the object's CmdNum property.

Note Note

Beginning with Visio 2002, the AddOnName property cannot execute a string that contains arbitrary VBA code. To call code that in previous versions of Visio you would have passed to the AddOnName property, move the code to a procedure in a document's VBA project that is called from the AddOnName property.

Example

This VBA macro shows how to set the AddOnName property of a menu item. It also shows how to add a menu and menu item to the Add-ins tab, and how to set some of the menu item's other properties, such as Caption, AddOnArgs, and ActionText.

This example assumes that you already have a macro named macroname in the project of the active document, and that the macro takes an argument called "Arg1." Before running this example, replace macroname with the name of your macro.

To restore the built-in user interface in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub AddOnName_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Visio built-in menus
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a Demo menu before the Window menu
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "Demo"

 'Get the MenuItems collection
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new Demo menu
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the properties for the new menu item
 vsoMenuItem.Caption = "&macroname"
 vsoMenuItem.AddOnName = "ThisDocument.macroname"
 vsoMenuItem.AddOnArgs = "/Arg1 = True"
 vsoMenuItem.ActionText = "Run(macroname)"

 'Tell Visio to use the new UI when the document is active
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


MenuItem.BeginGroup Property (Visio)

 Copy code hover
[image]

MenuItem.BeginGroup Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a menu item appears at the beginning of a group of items on the menu. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .BeginGroup

expression A variable that represents a MenuItem object.

Return Value

Boolean

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If you set the BeginGroup property of a MenuItem or ToolbarItem object to True, a separator is inserted into the menu or a spacer is inserted into the toolbar preceding this item.

Note Note

In Microsoft Visio 2000, the only way to create a separator in a menu or a spacer in a toolbar was to add a dummy item with a CmdNum property of zero, a Caption property that contained "", and an empty MenuItems or ToolbarItems collection. This technique continues to work in later versions .


MenuItem.BuiltIn Property (Visio)

 Copy code hover
[image]

MenuItem.BuiltIn Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .BuiltIn

expression A variable that represents a MenuItem object.

Return Value

Boolean


MenuItem.Caption Property (Visio)

 Copy code hover
[image]

MenuItem.Caption Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the caption for a menu item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Caption

expression A variable that represents a MenuItem object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

  • Use an ampersand (&) in the string to cause the next character in the string to become the shortcut key for that menu item. For example, the string "F&ormat" causes o to become the shortcut key for that menu item in that one menu.

  • Use "" in the string to display a double quotation mark on the menu.

  • Use && in the string to display an ampersand on the menu.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Caption property. It adds a menu and menu item to the Add-ins tab and sets the menu and menu item's Caption properties.

To restore the built-in user interface in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub Caption_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Microsoft Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a new menu before the Window menu.
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "MyNewMenu"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the Caption property for the new menu item.
 vsoMenuItem.Caption = "&MyNewMenuItem"

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


MenuItem.CmdNum Property (Visio)

 Copy code hover
[image]

MenuItem.CmdNum Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the command ID associated with a menu item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CmdNum

expression A variable that represents a MenuItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

When the AddOnName property of a MenuItem object indicates an add-on to run, Microsoft Visio automatically assigns a CmdNum property.

To insert a separator in a menu preceding a MenuItem object, use the BeginGroup property.

Valid command IDs are declared by the Visio type library in VisUICmds. They have the prefix visCmd.


MenuItem.CntrlType Property (Visio)

 Copy code hover
[image]

MenuItem.CntrlType Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the control type of a menu item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CntrlType

expression A variable that represents a MenuItem object.

Return Value

Integer


MenuItem.Enabled Property (Visio)

 Copy code hover
[image]

MenuItem.Enabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether or not an object is currently enabled. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Enabled

expression A variable that represents a MenuItem object.

Return Value

Boolean


MenuItem.FaceID Property (Visio)

 Copy code hover
[image]

MenuItem.FaceID Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the icon for an item. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .FaceID

expression A variable that represents a MenuItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You can use any of the constants prefixed with visIconIX that are declared by the Visio type library in VisUIIconIDs.

The FaceID property determines a button's icon, but not its function. Use the CmdNum property of aMenuItem object to set a button's function.

The FaceID property is the same as the TypeSpecific1 property when the CtrlType property is type visCtrlTypeBUTTON, which is declared in the Visio type library in VisUICtrlTypes.


MenuItem.Index Property (Visio)

 Copy code hover
[image]

MenuItem.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a MenuItem object in the MenuItems collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a MenuItem object.

Return Value

Long

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.

There are some exceptions. The Colors collection is indexed starting with 0.

These collections are also indexed starting with 0: AccelItems, AccelTables, MenuSets, MenuItems, Menus, ToolbarItems, Toolbars, and ToolbarSets.


MenuItem.IsHierarchical Property (Visio)

 Copy code hover
[image]

MenuItem.IsHierarchical Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether a menu item is hierarchical; that is, whether it contains a drop-down menu that contains more items, which can in turn be accessed by iterating through the MenuItems collection of the menu item. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .IsHierarchical

expression A variable that represents a MenuItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The value of the CmdNum property of a MenuItem object that represents a hierarchical menu should be zero (0). This corresponds to the Microsoft Visio constant visCmdHierarchical.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the IsHierarchical property to delete a hierarchical menu.

To restore Visio's built-in menus after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub IsHierarchical_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem
 Dim vsoHierarchicalMenuItems As Visio.MenuItems
 Dim vsoHierarchicalMenuItem As Visio.MenuItem

 'True if variable represents a hierarchical menu item.
 Dim blsHierarchicalState As Boolean

 Dim intCounterOuter As Integer
 Dim intCounterInner As Integer

 'Get the UIOject object for the copy of the built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Set vsoMenuSet to the drawing menu set.
 Set vsoMenuSet = vsoUIObject.MenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Tools menu. Because you got the built-in
 'menus, you know that you can find the Tools menu by its
 'position. If you had retrieved a custom UI, you would have
 'to loop through the menus checking the caption to find
 'the Tools menu. When you use a custom menu, there is no
 'guarantee that you will find a Tools menu, because it
 'could have been deleted.
 Set vsoMenu = vsoMenuSet.Menus(5)

 'Get the MenuItems collection for the Tools menu.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Locate the Macros menu item. Because you got the
 'built-in menus, you know you will find it. If you had
 'started from a custom menu, you would need to handle
 'the case of not finding the menu item.
 For intCounterOuter = 0 To vsoMenuItems.Count - 1

 'Retrieve the current menu item from the collection.
 Set vsoMenuItem = vsoMenuItems(intCounterOuter)

 'Check CmdNum to see if it is Macro.
 If vsoMenuItem.CmdNum = visCmdHierarchical And _
 vsoMenuItem.Caption = "&Macros" Then

 'The value of blsHierarchicalState is True.
 blsHierarchicalState = vsoMenuItem.IsHierarchical

 'Get the MenuItems collection for the
 'hierarchical menu.
 Set vsoHierarchicalMenuItems = vsoMenuItem.MenuItems

 'Locate the Visual Basic Editor menu item.
 'As with the Macros menu item, you know you will
 'find the Visual Basic Editor menu item
 'because you started with a copy of
 'the built-in menus.
 For intCounterInner = 0 To vsoHierarchicalMenuItems.Count - 1

 'Retrieve menu item from collection.
 Set vsoHierarchicalMenuItem = vsoHierarchicalMenuItems(intCounterInner)

 'Check CmdNum.
 If vsoHierarchicalMenuItem.CmdNum = visCmdToolsRunVBE Then

 'Delete the Visual Basic Editor menu item.
 vsoHierarchicalMenuItem.Delete

 'Exit the inner For loop.
 Exit For

 End If

 Next intCounterInner

 'Exit the outer For loop.
 Exit For

 End If

 Next intCounterOuter

 'Tell Microsoft Visio to use the custom user interface 'while the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


MenuItem.MenuItems Property (Visio)

 Copy code hover
[image]

MenuItem.MenuItems Property (Visio)
Send feedback

Published: July 16, 2012

Returns the MenuItems collection of a MenuItem object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .MenuItems

expression A variable that represents a MenuItem object.

Return Value

MenuItems

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If a Menu object represents a hierarchical menu, its MenuItems collection contains submenu items. Otherwise, its MenuItems collection is empty.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Menus property to get the Menus collection of a MenuSet object. It adds a menu and menu item to the user interface and sets the Caption property of the menu and menu item.

To restore the built-in user interface in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub Menus_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Microsoft Office Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtId(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a new menu before the Window menu.
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "MyNewMenu"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the Caption property for the new menu item.
 vsoMenuItem.Caption = "&MyNewMenuItem"

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


MenuItem.PaletteWidth Property (Visio)

 Copy code hover
[image]

MenuItem.PaletteWidth Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the width of a palette in pixels. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .PaletteWidth

expression A variable that represents a MenuItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

A palette, like a toolbar, is organized horizontally, and items wrap to a new row if there is not enough horizontal space available. By default, only the icons of the items are shown.


MenuItem.Parent Property (Visio)

 Copy code hover
[image]

MenuItem.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a MenuItem object.

Return Value

MenuItems

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it. For example, the parent of a Menu object is the Menus collection that contains the Menu object.


MenuItem.State Property (Visio)

 Copy code hover
[image]

MenuItem.State Property (Visio)
Send feedback

Published: July 16, 2012

Determines a menu item's state, pressed or not pressed. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .State

expression A variable that represents a MenuItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The State property can be one of the following constants declared by the Visio type library in VisUIButtonState.

Constant | Value | Description
visButtonUp | 0 | Button is not pressed
visButtonDown | -1 | Button is pressed


MenuItem.Style Property (Visio)

 Copy code hover
[image]

MenuItem.Style Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a menu item shows an icon, a caption, or some combination. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Style

expression A variable that represents a MenuItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Possible values for the Style property are listed in the following table. These constants are declared by the Visio type library in VisUIButtonStyle.

Constant | Value
visButtonAutomatic | 0
visButtonCaption | 1
visButtonIcon | 2
visButtonIconandCaption | 3


MenuItem.TypeSpecific1 Property (Visio)

 Copy code hover
[image]

MenuItem.TypeSpecific1 Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the type of a menu item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TypeSpecific1

expression A variable that represents a MenuItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The value of an object's TypeSpecific1 property depends on the value of its CntrlType property.

CntrlType value | TypeSpecific1 value
visCtrlTypeBUTTON | Any constant prefixed with visIconIX that is declared by the Visio type library.
visCtrlTypeCOMBOBOX | Zero (0).
visCtrlTypeEDITBOX | Zero (0).
visCtrlTypeLABEL | The TypeSpecific1 property is not used.


MenuItem.TypeSpecific2 Property (Visio)

 Copy code hover
[image]

MenuItem.TypeSpecific2 Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the type of a menu item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TypeSpecific2

expression A variable that represents a MenuItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The value of an object's TypeSpecific2 property depends on the value of its CntrlType property.

CntrlType value | TypeSpecific1 value
visCtrlTypeBUTTON | The TypeSpecific2 property is not used.
visCtrlTypeCOMBOBOX | The current width of the control expressed in pixels.
visCtrlTypeEDITBOX | The current width of the control expressed in pixels.
visCtrlTypeLABEL | The TypeSpecific2 property is not used.


MenuItem.Visible Property (Visio)

 Copy code hover
[image]

MenuItem.Visible Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is visible. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Visible

expression A variable that represents a MenuItem object.

Return Value

Boolean


MenuItem.Width Property (Visio)

 Copy code hover
[image]

MenuItem.Width Property (Visio)
Send feedback

Published: July 16, 2012

Gets the width of an object in pixels. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Width

expression A variable that represents a MenuItem object.

Return Value

Integer


MenuItem Methods (Visio)

 Copy code hover
[image]

MenuItem Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.
IconFileName | Sets a custom icon file for a menu or toolbar item.


MenuItem.Delete Method (Visio)

 Copy code hover
[image]

MenuItem.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a MenuItem object.

Return Value

Nothing


MenuItem.IconFileName Method (Visio)

 Copy code hover
[image]

MenuItem.IconFileName Method (Visio)
Send feedback

Published: July 16, 2012

Sets a custom icon file for a menu or toolbar item.

Version Information

Version Added: Visio 4.0

Syntax

expression .IconFileName(IconFileName)

expression A variable that represents a MenuItem object.

Parameters

Name | Required/Optional | Data Type | Description
IconFileName | Required | String | The path and name of the ICO, EXE, DLL, or VSL file to load.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The IconFileName method loads the file that contains the icon, saves the bits, and discards the file name.

If the icon contains multiple images, Microsoft Visio chooses the best icon, based on both icon size and color depth.

Unless IconFileName is a fully qualified path, the application searches for the ICO, EXE, DLL, or VSL file in the folders indicated by the Application object's AddonPaths property (assuming that the UIObject object is in the Visio process).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how use the IconFileName method to set the icon for a toolbar button. It retrieves a copy of the built-in Visio toolbars, adds a toolbar button, and sets the button icon.

Before running this code, replace path\filename with the full path to and name of a valid icon (.ico file) on your computer.

To restore the built-in Visio user interface after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code
Public Sub IconFileName_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = 1

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


MenuItems Object (Visio)

 Copy code hover
[image]

MenuItems Object (Visio)
Send feedback

Published: July 16, 2012

Contains a MenuItem object for each command on a Microsoft Visio menu.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

To retrieve a MenuItems collection, use the MenuItems property of a Menu object or a MenuItem object.

The default property of a MenuItems collection is Item.

Unlike other Visio collections, the MenuItems collection is indexed starting with zero (0) rather than 1.


MenuItems Members (Visio)

 Copy code hover
[image]

MenuItems Members (Visio)
Send feedback

Published: July 16, 2012

Contains a MenuItem object for each command on a Microsoft Visio menu.

Methods

Name | Description
Add | Adds a new object to a collection.
AddAt | Creates a new MenuItem object at a specified index in the MenuItems collection.

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns a MenuItem object from the MenuItems collection. Read-only.
Parent | Determines the parent of an object. Read-only.
ParentItem | Returns the parent object of a hierarchical menu. Read-only.


MenuItems Properties (Visio)

 Copy code hover
[image]

MenuItems Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns a MenuItem object from the MenuItems collection. Read-only.
Parent | Determines the parent of an object. Read-only.
ParentItem | Returns the parent object of a hierarchical menu. Read-only.


MenuItems.Count Property (Visio)

 Copy code hover
[image]

MenuItems.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a MenuItems object.

Return Value

Long


MenuItems.Item Property (Visio)

 Copy code hover
[image]

MenuItems.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns a MenuItem object from the MenuItems collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(Index)

expression A variable that represents a MenuItems collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Contains the index of the object to retrieve.

Return Value

MenuItem

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


MenuItems.Parent Property (Visio)

 Copy code hover
[image]

MenuItems.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a MenuItems object.

Return Value

Menu

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it. For example, the parent of a Menu object is the Menus collection that contains the Menu object.


MenuItems.ParentItem Property (Visio)

 Copy code hover
[image]

MenuItems.ParentItem Property (Visio)
Send feedback

Published: July 16, 2012

Returns the parent object of a hierarchical menu. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .ParentItem

expression A variable that represents a MenuItems object.

Return Value

MenuItem


MenuItems Methods (Visio)

 Copy code hover
[image]

MenuItems Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.
AddAt | Creates a new MenuItem object at a specified index in the MenuItems collection.


MenuItems.Add Method (Visio)

 Copy code hover
[image]

MenuItems.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents a MenuItems collection.

Return Value

MenuItem

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.


MenuItems.AddAt Method (Visio)

 Copy code hover
[image]

MenuItems.AddAt Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new MenuItem object at a specified index in the MenuItems collection.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddAt(lIndex)

expression A variable that represents a MenuItems object.

Parameters

Name | Required/Optional | Data Type | Description
lIndex | Required | Long | The index at which to add the object.

Return Value

MenuItem

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the index is zero (0), the object is added at the beginning of the collection.

The beginning of a MenuItems collection is the topmost menu item.

Example

The following macro shows how to add a menu and menu item to the user interface.

This example assumes that you already have a macro called "MyMacro" in the Microsoft Visual Basic for Applications (VBA) project associated with the active Visio document.

VBA Copy code Copy code
Public Sub AddAt_Example()
 Dim vsoUI As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UI object that represents Visio built-in menus.
 Set vsoUI = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUI.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a Demo menu.
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "Demo"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new Demo menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the properties for the new menu item.
 vsoMenuItem.Caption = "Run &MyMacro"
 vsoMenuItem.AddOnName = "ThisDocument.MyMacro"
 vsoMenuItem.ActionText = "Run MyMacro"

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUI

End Sub


Menus Object (Visio)

 Copy code hover
[image]

Menus Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Menu object for each menu in a Microsoft Visio menu set.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

To retrieve a Menus collection, use the Menus property of a MenuSet object.

The default property of a Menus collection is Item.

Unlike other Visio collections, the Menus collection is indexed starting with zero (0) rather than 1.


Menus Members (Visio)

 Copy code hover
[image]

Menus Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Menu object for each menu in a Microsoft Visio menu set.

Methods

Name | Description
Add | Adds a new object to a collection.
AddAt | Creates a new Menu object at a specified index in the Menus collection.

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns a Menu object from the Menus collection. Read-only.
Parent | Determines the parent of an object. Read-only.


Menus Properties (Visio)

 Copy code hover
[image]

Menus Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns a Menu object from the Menus collection. Read-only.
Parent | Determines the parent of an object. Read-only.


Menus.Count Property (Visio)

 Copy code hover
[image]

Menus.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Menus object.

Return Value

Long


Menus.Item Property (Visio)

 Copy code hover
[image]

Menus.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Menu object from the Menus collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(lIndex)

expression A variable that represents a Menus collection.

Parameters

Name | Required/Optional | Data Type | Description
lIndex | Required | Long | The index of the object to retrieve.

Return Value

Menu

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


Menus.Parent Property (Visio)

 Copy code hover
[image]

Menus.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a Menus object.

Return Value

MenuSet

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it. For example, the parent of a Menu object is the Menus collection that contains the Menu object.


Menus Methods (Visio)

 Copy code hover
[image]

Menus Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.
AddAt | Creates a new Menu object at a specified index in the Menus collection.


Menus.Add Method (Visio)

 Copy code hover
[image]

Menus.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents a Menus collection.

Return Value

Menu

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.


Menus.AddAt Method (Visio)

 Copy code hover
[image]

Menus.AddAt Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new Menu object at a specified index in the Menus collection.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddAt(lIndex)

expression A variable that represents a Menus object.

Parameters

Name | Required/Optional | Data Type | Description
lIndex | Required | Long | The index at which to add the object.

Return Value

Menu

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the index is zero (0), the object is added at the beginning of the collection.

The beginning of a Menus collection is the leftmost menu when the menus are arranged horizontally.

Example

The following macro shows how to add a menu and menu item to the user interface.

This example assumes that you already have a macro called "MyMacro" in the Microsoft Visual Basic for Applications (VBA) project associated with the active Visio document.

VBA Copy code Copy code
Public Sub AddAt_Example()
 Dim vsoUI As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UI object that represents Visio built-in menus.
 Set vsoUI = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUI.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a Demo menu.
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "Demo"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new Demo menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the properties for the new menu item.
 vsoMenuItem.Caption = "Run &MyMacro"
 vsoMenuItem.AddOnName = "ThisDocument.MyMacro"
 vsoMenuItem.ActionText = "Run MyMacro"

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUI

End Sub


MenuSet Object (Visio)

 Copy code hover
[image]

MenuSet Object (Visio)
Send feedback

Published: July 16, 2012

Represents an entire menu set used by a Microsoft Visio window context.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

A shortcut menu (which appears when you click the right mouse button) is represented by a MenuSet object that has a single untitled Menu object in its Menus collection, which contains the contents of the shortcut menu in its MenuItems collection.


MenuSet Members (Visio)

 Copy code hover
[image]

MenuSet Members (Visio)
Send feedback

Published: July 16, 2012

Represents an entire menu set used by a Microsoft Visio window context.

Methods

Name | Description
Delete | Deletes an object.

Properties

Name | Description
BuiltIn | Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.
Caption | Gets or sets the caption for a menu set. Read/write.
Enabled | Determines whether or not an object is currently enabled. Read/write.
Height | Gets or sets the height of a menu set. Read/write.
Left | Gets the distance in pixels between the left edge of the object and the left side of the docking area. Sets the distance in pixels between the left edge of an object and the left edge of the screen. Read/write.
Menus | Returns the Menus collection of a MenuSet object. Read-only.
Parent | Determines the parent of an object. Read-only.
Position | Gets or sets the position of an object. Read/write.
Protection | Determines how a MenuSet object is protected from user customization. Read/write.
RowIndex | Gets or sets the docking order of a MenuSet object in relation to other items in the same docking area. Read/write.
SetID | Returns the set ID of a MenuSet object in its collection. Read-only.
Top | Gets the distance between the top of an object and the top of the docking area or the top of the screen if the object isn't docked; it sets the distance between the top of a Menu object and the top of the screen. Read/write.
Visible | Determines whether an object is visible. Read/write.
Width | Gets the width of an object in pixels. Read/write.


MenuSet Properties (Visio)

 Copy code hover
[image]

MenuSet Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
BuiltIn | Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.
Caption | Gets or sets the caption for a menu set. Read/write.
Enabled | Determines whether or not an object is currently enabled. Read/write.
Height | Gets or sets the height of a menu set. Read/write.
Left | Gets the distance in pixels between the left edge of the object and the left side of the docking area. Sets the distance in pixels between the left edge of an object and the left edge of the screen. Read/write.
Menus | Returns the Menus collection of a MenuSet object. Read-only.
Parent | Determines the parent of an object. Read-only.
Position | Gets or sets the position of an object. Read/write.
Protection | Determines how a MenuSet object is protected from user customization. Read/write.
RowIndex | Gets or sets the docking order of a MenuSet object in relation to other items in the same docking area. Read/write.
SetID | Returns the set ID of a MenuSet object in its collection. Read-only.
Top | Gets the distance between the top of an object and the top of the docking area or the top of the screen if the object isn't docked; it sets the distance between the top of a Menu object and the top of the screen. Read/write.
Visible | Determines whether an object is visible. Read/write.
Width | Gets the width of an object in pixels. Read/write.


MenuSet.BuiltIn Property (Visio)

 Copy code hover
[image]

MenuSet.BuiltIn Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .BuiltIn

expression A variable that represents a MenuSet object.

Return Value

Boolean


MenuSet.Caption Property (Visio)

 Copy code hover
[image]

MenuSet.Caption Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the caption for a menu set. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Caption

expression A variable that represents a MenuSet object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Visio does not use the Caption property of a MenuSet object.


MenuSet.Enabled Property (Visio)

 Copy code hover
[image]

MenuSet.Enabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether or not an object is currently enabled. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Enabled

expression A variable that represents a MenuSet object.

Return Value

Boolean


MenuSet.Height Property (Visio)

 Copy code hover
[image]

MenuSet.Height Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the height of a menu set. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Height

expression A variable that represents a MenuSet object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the object is docked or protected from resizing, the application returns an error.


MenuSet.Left Property (Visio)

 Copy code hover
[image]

MenuSet.Left Property (Visio)
Send feedback

Published: July 16, 2012

Gets the distance in pixels between the left edge of the object and the left side of the docking area. Sets the distance in pixels between the left edge of an object and the left edge of the screen. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Left

expression A variable that represents a MenuSet object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The value of Left must be greater than or equal to zero.


MenuSet.Menus Property (Visio)

 Copy code hover
[image]

MenuSet.Menus Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Menus collection of a MenuSet object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Menus

expression A variable that represents a MenuSet object.

Return Value

Menus

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

A Menu object's index within the Menus collection determines its left-to-right position on the menu bar.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Menus property to get the Menus collection of a MenuSet object. It adds a menu and menu item to the user interface and sets the Caption property of the menu and menu item.

To restore the built-in user interface in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub Menus_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Microsoft Office Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtId(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a new menu before the Window menu.
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "MyNewMenu"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the Caption property for the new menu item.
 vsoMenuItem.Caption = "&MyNewMenuItem"

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


MenuSet.Parent Property (Visio)

 Copy code hover
[image]

MenuSet.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a MenuSet object.

Return Value

MenuSets

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it. For example, the parent of a Menu object is the Menus collection that contains the Menu object.


MenuSet.Position Property (Visio)

 Copy code hover
[image]

MenuSet.Position Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the position of an object. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Position

expression A variable that represents a MenuSet object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constants that represent possible Position property values are listed below. They are also declared by the Visio type library in VisUIBarPosition.

Constant | Value
visBarLeft | 0
visBarTop | 1
visBarRight | 2
visBarBottom | 3
visBarFloating | 4
visBarPopup | 5
visBarMenu | 6


MenuSet.Protection Property (Visio)

 Copy code hover
[image]

MenuSet.Protection Property (Visio)
Send feedback

Published: July 16, 2012

Determines how a MenuSet object is protected from user customization. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Protection

expression A variable that represents a MenuSet object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The value of the Protection property can be one or a combination of the following constants declared by the Visio type library in VisUIBarProtection.

Constant | Value | Description
visBarNoProtection | 0 | No protection.
visBarNoCustomize | 1 | Cannot be customized.
visBarNoResize | 2 | Cannot be resized.
visBarNoMove | 4 | Cannot be moved.
visBarNoChangeDock | 16 | Cannot be docked or floating.
visBarNoVerticalDock | 32 | Cannot be docked vertically.
visBarNoHorizontalDock | 64 | Cannot be docked horizontally.


MenuSet.RowIndex Property (Visio)

 Copy code hover
[image]

MenuSet.RowIndex Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the docking order of a MenuSet object in relation to other items in the same docking area. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .RowIndex

expression A variable that represents a MenuSet object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Objects that have lower numbers are docked first. Several items can share the same row index. If two or more items share the same row index, the item most recently assigned is displayed first in its group.

Constants that represent the first and last positions (see the following table) are declared by the Visio type library in member VisUIBarRow.

Constant | Value
visBarRowFirst | 0
visBarRowLast | -1


MenuSet.SetID Property (Visio)

 Copy code hover
[image]

MenuSet.SetID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the set ID of a MenuSet object in its collection. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .SetID

expression A variable that represents a MenuSet object.

Return Value

Long

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Each MenuSet object has a set ID that corresponds to a Microsoft Visio window context. For MenuSet objects, set IDs also correspond to shortcut menu sets.

You can retrieve an object from its collection by passing the object's set ID to the ItemAtID property. You can also set the set ID of an object by using the AddAtID method.

Valid set ID values are declared by the Visio type library in VisUIObjSets.


MenuSet.Top Property (Visio)

 Copy code hover
[image]

MenuSet.Top Property (Visio)
Send feedback

Published: July 16, 2012

Gets the distance between the top of an object and the top of the docking area or the top of the screen if the object isn't docked; it sets the distance between the top of a Menu object and the top of the screen. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Top

expression A variable that represents a MenuSet object.

Return Value

Integer


MenuSet.Visible Property (Visio)

 Copy code hover
[image]

MenuSet.Visible Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is visible. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Visible

expression A variable that represents a MenuSet object.

Return Value

Boolean


MenuSet.Width Property (Visio)

 Copy code hover
[image]

MenuSet.Width Property (Visio)
Send feedback

Published: July 16, 2012

Gets the width of an object in pixels. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Width

expression A variable that represents a MenuSet object.

Return Value

Integer


MenuSet Methods (Visio)

 Copy code hover
[image]

MenuSet Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.


MenuSet.Delete Method (Visio)

 Copy code hover
[image]

MenuSet.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a MenuSet object.

Return Value

Nothing


MenuSets Object (Visio)

 Copy code hover
[image]

MenuSets Object (Visio)
Send feedback

Published: July 16, 2012

Includes a MenuSet object for each Microsoft Visio window context that has menus.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

To retrieve a MenuSets collection, use the MenuSets property of a UIObject object.

The default property of a MenuSets collection is Item.

Unlike other Visio collections, the MenuSets collection is indexed starting with zero (0) rather than 1.

A MenuSet object is identified in the MenuSets collection by its SetID property, which corresponds to a Visio window context. For a list of SetID values for MenuSet objects, see the SetID property.


MenuSets Members (Visio)

 Copy code hover
[image]

MenuSets Members (Visio)
Send feedback

Published: July 16, 2012

Includes a MenuSet object for each Microsoft Visio window context that has menus.

Methods

Name | Description
Add | Adds a new object to a collection.
AddAtID | Creates a new object with a specified ID in a collection.

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns a MenuSet object from the MenuSets collection. Read-only.
ItemAtID | Returns the MenuSet object with the specified ID within the MenuSets collection. Read-only.
Parent | Determines the parent of an object. Read-only.


MenuSets Properties (Visio)

 Copy code hover
[image]

MenuSets Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns a MenuSet object from the MenuSets collection. Read-only.
ItemAtID | Returns the MenuSet object with the specified ID within the MenuSets collection. Read-only.
Parent | Determines the parent of an object. Read-only.


MenuSets.Count Property (Visio)

 Copy code hover
[image]

MenuSets.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a MenuSets object.

Return Value

Long


MenuSets.Item Property (Visio)

 Copy code hover
[image]

MenuSets.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns a MenuSet object from the MenuSets collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(lIndex)

expression A variable that represents a MenuSets collection.

Parameters

Name | Required/Optional | Data Type | Description
lIndex | Required | Long | Contains the index of the object to retrieve.

Return Value

MenuSet

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


MenuSets.ItemAtID Property (Visio)

 Copy code hover
[image]

MenuSets.ItemAtID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the MenuSet object with the specified ID within the MenuSets collection. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemAtID(lID)

expression A variable that represents a MenuSets object.

Parameters

Name | Required/Optional | Data Type | Description
lID | Required | Long | The Visio context ID of the object to retrieve.

Return Value

MenuSet

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The ID corresponds to a window or context menu. Constants for IDs are prefixed with visUIObjectSet and are declared by the Visio type library in VisUIObjSets.


MenuSets.Parent Property (Visio)

 Copy code hover
[image]

MenuSets.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a MenuSets object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it. For example, the parent of a Menu object is the Menus collection that contains the Menu object.


MenuSets Methods (Visio)

 Copy code hover
[image]

MenuSets Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.
AddAtID | Creates a new object with a specified ID in a collection.


MenuSets.Add Method (Visio)

 Copy code hover
[image]

MenuSets.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents a MenuSets collection.

Return Value

MenuSet

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.


MenuSets.AddAtID Method (Visio)

 Copy code hover
[image]

MenuSets.AddAtID Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new object with a specified ID in a collection.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddAtID(lID)

expression A variable that represents a MenuSets object.

Parameters

Name | Required/Optional | Data Type | Description
lID | Required | Long | The window context for the new object.

Return Value

MenuSet

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The ID corresponds to a window or context menu. If the collection already contains an object at the specified ID, the AddAtID method returns an error.

Valid IDs are declared by the Visio type library in member VisUIObjSets. Not all collections include an object for every possible ID.


MouseEvent Object (Visio)

 Copy code hover
[image]

MouseEvent Object (Visio)
Send feedback

Published: July 16, 2012

The object passed to VisEventProc as the subject of MouseDown, MouseMove, and MouseUp events.

Version Information

Version Added: Visio 2003

Remarks

The default property of MouseEvent is ToString. The ToString property returns a string that represents the properties of the MouseEvent object and has the form

event code; Button property value; KeyButtonState property value; x property value; y property value; Window.Caption

where event code returns the code of the event that fired (MouseDown, MouseMove, or MouseUp) and Window.Caption returns the caption of the window that sourced the event. For example, if a user clicked the left mouse button near the middle of the drawing page while holding down the SHIFT key, in response to the MouseDown event, ToString might return

709;1;5;4.3750003+000;4.265000+000;Drawing1

Use the Application property of the MouseEvent object to determine the Microsoft Visio instance hosting the object, and use the Window property to determine the Visio window associated with a mouse event.


MouseEvent Members (Visio)

 Copy code hover
[image]

MouseEvent Members (Visio)
Send feedback

Published: July 16, 2012

The object passed to VisEventProc as the subject of MouseDown, MouseMove, and MouseUp events.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Button | Returns the mouse button that was clicked to fire a MouseDown or MouseUp event. Read-only.
DragState | Returns information about the state of mouse movement as it relates to dragging and dropping a shape. Read-only.
KeyButtonState | Returns the state of mouse buttons and the SHIFT and CTRL keys associated with a mouse event. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information. Read-only.
ToString | Returns a string that represents the properties of a KeyboardEvent or MouseEvent object. Read-only.
Window | Returns the window associated with a MouseEvent object. Read-only.
x | Returns the x-coordinate of the location in the Microsoft Visio window where a MouseDown, MouseMove, or MouseUp event fired. Read-only.
y | Returns the y-coordinate of the location in the Microsoft Visio window where a MouseDown, MouseMove, or MouseUp event fired. Read-only.


MouseEvent Properties (Visio)

 Copy code hover
[image]

MouseEvent Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Button | Returns the mouse button that was clicked to fire a MouseDown or MouseUp event. Read-only.
DragState | Returns information about the state of mouse movement as it relates to dragging and dropping a shape. Read-only.
KeyButtonState | Returns the state of mouse buttons and the SHIFT and CTRL keys associated with a mouse event. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information. Read-only.
ToString | Returns a string that represents the properties of a KeyboardEvent or MouseEvent object. Read-only.
Window | Returns the window associated with a MouseEvent object. Read-only.
x | Returns the x-coordinate of the location in the Microsoft Visio window where a MouseDown, MouseMove, or MouseUp event fired. Read-only.
y | Returns the y-coordinate of the location in the Microsoft Visio window where a MouseDown, MouseMove, or MouseUp event fired. Read-only.


MouseEvent.Application Property (Visio)

 Copy code hover
[image]

MouseEvent.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a MouseEvent object.

Return Value

Application


MouseEvent.Button Property (Visio)

 Copy code hover
[image]

MouseEvent.Button Property (Visio)
Send feedback

Published: July 16, 2012

Returns the mouse button that was clicked to fire a MouseDown or MouseUp event. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Button

expression An expression that returns a MouseEvent object.

Return Value

Long

Remarks

Possible values for the Button property can be any of the constants shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your Microsoft Visual Basic for Applications (VBA) project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "Button is: "; Button

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseDown event. In the Immediate window, the handler prints the value that represents the mouse button that was clicked to fire the event.


MouseEvent.DragState Property (Visio)

 Copy code hover
[image]

MouseEvent.DragState Property (Visio)
Send feedback

Published: July 16, 2012

Returns information about the state of mouse movement as it relates to dragging and dropping a shape. Read-only.

Version Information

Version Added: Visio 2007

Syntax

expression .DragState

expression An expression that returns a MouseEvent object.

Return Value

Long

Remarks

The DragState property extends the MouseMove event by returning detailed information about the state of mouse movements and actions throughout the course of a drag and drop operation. You can use the DragState property in conjunction with the EventList.AddAdvise method to determine whether a drag and drop operation is beginning, or whether the mouse is entering a drop-target window, moving over the window, dropping an object in the target window, or leaving the window.

Note Note

You can specify exactly which drag-states extensions you want to listen to by using the Event.SetFilterActions method.

To handle event notifications, create a class module that implements the VisEventProc method of the IVisEventProc interface and then create an instance of this class to pass as an argument to the AddAdvise method. Get the value of the DragState property of the pSubjectObj parameter of the VisEventProc function.

At any time you can return VisEventProc = False to cancel the drag and drop action, for example if you receive an event notification that the user is attempting to drop an object in an inappropriate target window.

The example that accompanies this topic provides sample code that shows how to get drag-state information.

Possible values returned by the DragState property are shown in the following table and declared in the VisMouseMoveDragStates enumeration, which is declared in the Microsoft Visio type library.

Constant | Value | Description
visMouseMoveDragStatesBegin | 1 | User is beginning to drag an object with the mouse.
visMouseMoveDragStatesDrop | 5 | User has dropped the dragged object in the drop-target window.
visMouseMoveDragStatesEnter | 2 | User is dragging an object into the drop-target window with the mouse.
visMouseMoveDragStatesLeave | 4 | User is moving the mouse out of the drop-target window.
visMouseMoveDragStatesNone | 0 | Either not a mouse movement or a mouse movement that is not a drag action.
visMouseMoveDragStatesOver | 3 | User is moving the dragged object within the drop-target window with the mouse.

When the DragState property returns visMouseMoveDragStatesBegin a drag and drop action is beginning. The DragState property returns visMouseMoveDragStatesBegin just once for each drag and drop action. At this point, you can cancel the drag and drop action entirely; if you do so, Visio fires no additional MouseMove events for any target windows.

When the DragState property returns visMouseMoveDragStatesEnter, an end-user is dragging an object into a drop-target window. This event is fired once per drop-target window. At this point, you can cancel the drag and drop action for that specific drop-target window.

When the DragState property returns visMouseMoveDragStatesOver, the user is dragging an object over a drop-target window. You can cancel the drag action, based on the type of window or on an x,y range within a window, as specified in your code. Canceling a drag action over the drop-target window prevents the end-user from completing the drag and drop action.

When the DragState property returns visMouseMoveDragStatesDrop, the drop-target window is receiving a drop. You can cancel the drop action, thus preventing the drop from occurring. When this occurs and you do not also cancel the drag action over the drop-target window, the end-user does not get any visual feedback to indicate that the drop action has been prevented.

When the DragState property returns visMouseMoveDragStatesLeave, the end-user is moving the mouse out of the drop-target window. There is no way for you to cancel this operation at this point, but there would also be no logical reason to do so.

Example

This example shows how to create a class module that implements the IVisEventProc interface to handle events fired by the MouseEvent object. The module consists of the function VisEventProc, which uses a Select Case block to determine if the event that fired was a MouseMove event. If so, the code uses an If...Else block and the DragState property to determine the particular MouseMove event extension that fired.

Events other than MouseMove fall under the default case (Case Else). In both cases, the Case block constructs a string (strMessage) that contains the name and event code of the event that fired, including the drag-state extension and the x- and y- values of the location where the event fired, derived from the values of the MouseEvent.X and MouseEvent.Y properties. Finally, the function displays the message in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use the event-sink module that follows to create an instance of the clsEventSink class and an Event object for the MouseMove event that sends notifications of event firings to the class instance.

VBA Copy code Copy code
Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
    ByVal nEventCode As Integer, _
    ByVal pSourceObj As Object, _
    ByVal nEventID As Long, _
    ByVal nEventSeqNum As Long, _
    ByVal pSubjectObj As Object, _
    ByVal vMoreInfo As Variant) As Variant

    Dim strMessage As String

    'Find out which event and event extension fired
    Select Case nEventCode
        Case visEvtCodeMouseMove
            Dim strInfo As String
            If (pSubjectObj.DragState = visMouseMoveDragStatesOver) Then
                strMessage = "MouseMove - dragOver (" + Str(pSubjectObj.x) + "," + Str(pSubjectObj.y) + ")"
            ElseIf (pSubjectObj.DragState = visMouseMoveDragStatesBegin) Then
               strMessage = "MouseMove - dragBegin (" + Str(pSubjectObj.x) + "," + Str(pSubjectObj.y) + ")"
               If (pSubjectObj.Window.Index <> 1) Then
                    IVisEventProc_VisEventProc = True       ' cancel for all windows except first one
               End If
            ElseIf (pSubjectObj.DragState = visMouseMoveDragStatesLeave) Then
                strMessage = "MouseMove - dragLeave"
            ElseIf (pSubjectObj.DragState = visMouseMoveDragStatesEnter) Then
                strMessage = "MouseMove - dragEnter*******************************************"
            ElseIf (pSubjectObj.DragState = visMouseMoveDragStatesDrop) Then
                strMessage = "MouseMove - dragDrop"
            End If
        Case Else
            strMessage = "Other (" & nEventCode & ")"
    End Select

    'Display the event name and the event code
    If (Len(strMessage)) Then
        Debug.Print strMessage
    End If

End Function

The following VBA module shows how to use the AddAdvise method to sink events. The module contains two public procedures.

The CreateEventObjects procedure creates an instance of a sink-object (event-handling) class named clsEventSink that gets passed to the AddAdvise method, and that receives notifications of events. In addition, the procedure creates a single Event object to send notifications of firings of the MouseMove event sourced by the Application object to the sink object.

The Initialize procedure calls the CreateEventObjects procedure to start listening to events.

The clsEventSink class implements the IVisEventProc interface.

VBA Copy code Copy code
Public Sub Initialize()

    CreateEventObjects

End Sub

Option Explicit

Private mEventSink As clsEventSink

Dim vsoApplicationEvents As Visio.EventList
Dim vsoMouseMoveEvent As Visio.Event

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Public Sub CreateEventObjects()

    'Create an instance of the clsEventSink class
    'to pass to the AddAdvise method.
    Set mEventSink = New clsEventSink

    'Get the EventList collection of the current instance of the Visio Application object
    Set vsoApplicationEvents = Application.EventList

   'Add an Event object that sends notifications of the MouseMove event.
    Set vsoMouseMoveEvent = vsoApplicationEvents.AddAdvise(visEvtCodeMouseMove, mEventSink, "", "Mouse moved...")

End Sub


MouseEvent.KeyButtonState Property (Visio)

 Copy code hover
[image]

MouseEvent.KeyButtonState Property (Visio)
Send feedback

Published: July 16, 2012

Returns the state of mouse buttons and the SHIFT and CTRL keys associated with a mouse event. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .KeyButtonState

expression A variable that represents a MouseEvent object.

Return Value

Long

Remarks

Possible values for KeyButtonState can be a combination of any of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains an event handler for the MouseDown event that prints to the Immediate window the state of the mouse buttons and CTRL and SHIFT keys when the event fired.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "KeyButtonState is"; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window (optionally, while pressing SHIFT and/or CTRL) to fire a MouseDown event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event. If you pressed either or both of the keys, the name of the key or keys you pressed will print as well.


MouseEvent.ObjectType Property (Visio)

 Copy code hover
[image]

MouseEvent.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a MouseEvent object.

Return Value

VisObjectType

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.


MouseEvent.Stat Property (Visio)

 Copy code hover
[image]

MouseEvent.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a MouseEvent object.

Return Value

VisStatCodes


MouseEvent.ToString Property (Visio)

 Copy code hover
[image]

MouseEvent.ToString Property (Visio)
Send feedback

Published: July 16, 2012

Returns a string that represents the properties of a KeyboardEvent or MouseEvent object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ToString

expression A variable that represents a MouseEvent object.

Return Value

String

Remarks

ToString is the default property of both KeyboardEvent and MouseEvent objects.

When a KeyDown, KeyPress, or KeyUp event fires, the ToString property returns a string that represents the properties of the KeyboardEvent object that gets passed to VisEventProc. The string has the following form:

event code; KeyCode property value; KeyButtonState property value; KeyAscii property value; Window.Caption

where event code returns the code of the event that fired and Window.Caption returns the caption of the window that sourced the event. For example, if a user pressed the "L" key while holding down the SHIFT key, in response to the KeyPress event, ToString might return

713;0;4;76;Drawing1

When a MouseDown, MouseMove, or MouseUp event fires, the ToString property returns a string that represents the properties of the MouseEvent object that gets passed to VisEventProc. The string has the following form:

event code; Button property value; KeyButtonState property value; x property value; y property value; Window.Caption

where event code returns the code of the event that fired and Window.Caption returns the caption of the window that sourced the event. For example, if a user clicked the left mouse button near the middle of the drawing page while holding down the SHIFT key, in response to the MouseDown event, ToString might return

709;1;5;4.3750003+000;4.265000+000;Drawing1

For more information about the possible values returned by each of the individual properties represented by the string returned by ToString, see the respective property topics in this Automation Reference.

Example

The following Microsoft Visual Basic for Applications (VBA) example shows how to use the AddAdvise method to create a Event object that will sink a MouseDown event. It uses the ToString property of the MouseEvent object to report the details of the event that fired.

The example contains a class module and two public procedures that are inserted into the ThisDocument project of the active Visio document:

  • The CreateEventObject procedure creates an instance of a sink-object (event-handling) class named clsEventSink that gets passed to the AddAdvise method, and that receives notifications of events. In addition, the procedure creates an Event object to send notifications of firings of the MouseDown event sourced by the Application object to the sink object.

  • The DeleteEventObject procedure deletes this Event object when your program is finished using it.

The clsEventSink class implements the IVisEventProc interface. The class module creates a class to handle events fired by the Visio Application object. The module consists of the function VisEventProc, which uses a Select Case block to check for the MouseDown event. When a MouseDown event fires, Visio passes a MouseEvent object to VisEventProc as pSubjectObj. The function then constructs a message that displays the string returned by the ToString property of the MouseEvent object passed to the function.

Other events fall under the default case (Case Else). The Case Else block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

The example assumes that there is an active document in the Visio application window. Copy the following code into the ThisDocument project in the Visual Basic Editor:

VBA Copy code Copy code
Option Explicit

Private mEventSink As clsEventSink

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Public Sub CreateMouseDownEventObject()

 Dim vsoApplicationEvents As Visio.EventList
 Dim vsoMouseDownEvent As Visio.Event

 'Create an instance of the clsEventSink class
 'to pass to the AddAdvise method.
 Set mEventSink = New clsEventSink

 'Get the EventList collection of the application
 Set vsoApplicationEvents = Application.EventList

 'Add an Event object for the MouseDown event
 'that will send notifications.
 Set vsoMouseDownEvent= vsoApplicationEvents.AddAdvise( _
 visEvtCodeMouseDown, mEventSink, "", "Mouse down...")

End Sub

Public Sub DeleteMouseDownEventObject()

 'Delete the Event object for the MouseDown event
 vsoMouseDownEvent.Delete
 Set vsoMouseDownEvent = Nothing

End Sub

Copy the following code into a new class module in VBA, naming the module clsEventSink.

VBA Copy code Copy code
Implements Visio.IVisEventProc

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String
 Dim vsoMouseDownEvent As Visio.MouseEvent

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeMouseDown
 Set vsoMouseEvent = pSubjectObj
 strMessage = "ToString is: " & vsoMouseEvent.ToString
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


MouseEvent.Window Property (Visio)

 Copy code hover
[image]

MouseEvent.Window Property (Visio)
Send feedback

Published: July 16, 2012

Returns the window associated with a MouseEvent object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .Window

expression A variable that represents a MouseEvent object.

Return Value

Window

Remarks

For the KeyboardEvent object, the Window property returns the window associated with the event represented by the object.


MouseEvent.x Property (Visio)

 Copy code hover
[image]

MouseEvent.x Property (Visio)
Send feedback

Published: July 16, 2012

Returns the x-coordinate of the location in the Microsoft Visio window where a MouseDown, MouseMove, or MouseUp event fired. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .x

expression A variable that represents a MouseEvent object.

Return Value

VisStatCodes

Remarks

The x property returns a value in internal drawing units.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your Microsoft Visual Basic for Applications (VBA) project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x is: "; x
 Debug.Print "y is: "; y

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseDown event. In the Immediate window, the handler prints the x and y coordinates of the location in the Visio window coordinate space where the mouse was clicked.


MouseEvent.y Property (Visio)

 Copy code hover
[image]

MouseEvent.y Property (Visio)
Send feedback

Published: July 16, 2012

Returns the y-coordinate of the location in the Microsoft Visio window where a MouseDown, MouseMove, or MouseUp event fired. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .y

expression A variable that represents a MouseEvent object.

Return Value

VisStatCodes

Remarks

The y property returns a value in internal drawing units.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your Microsoft Visual Basic for Applications (VBA) project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x is: "; x
 Debug.Print "y is: "; y

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseDown event. In the Immediate window, the handler prints the x and y coordinates of the location in the Visio window coordinate space where the mouse was clicked.


MovedSelectionEvent Object (Visio)

 Copy code hover
[image]

MovedSelectionEvent Object (Visio)
Send feedback

Published: July 16, 2012

Holds information about a selection that is moved from one location, such as a page or a document, to another.

Version Information

Version Added: Visio 2010

Remarks

When you move a selection of shapes to a sub-process page, Microsoft Visio fires the SelectionMovedToSubprocess event (AddAdvise-only), which returns a MovedSelectionEvent object that encapsulates information about the move.


MovedSelectionEvent Members (Visio)

 Copy code hover
[image]

MovedSelectionEvent Members (Visio)
Send feedback

Published: July 16, 2012

Holds information about a selection that is moved from one location, such as a page or a document, to another.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ObjectType | Returns visObjTypeMovedSelectionEvent, the type of this object. Read-only.
ReplacementShape | Returns a Shape object that represents the shape that is in the source page and that replaces the source-page shapes or selection being moved to a sub-process page. Read-only.
SelectionSource | Returns a Selection object that represents the set of selected shapes before they are moved to a sub-process page. Read-only.
SelectionTarget | Returns a Selection object that represents the set of selected shapes after they are moved to a new sub-process page. Read-only.
Stat | Returns status information for an object. Read-only.


MovedSelectionEvent Properties (Visio)

 Copy code hover
[image]

MovedSelectionEvent Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ObjectType | Returns visObjTypeMovedSelectionEvent, the type of this object. Read-only.
ReplacementShape | Returns a Shape object that represents the shape that is in the source page and that replaces the source-page shapes or selection being moved to a sub-process page. Read-only.
SelectionSource | Returns a Selection object that represents the set of selected shapes before they are moved to a sub-process page. Read-only.
SelectionTarget | Returns a Selection object that represents the set of selected shapes after they are moved to a new sub-process page. Read-only.
Stat | Returns status information for an object. Read-only.


MovedSelectionEvent.Application Property (Visio)

 Copy code hover
[image]

MovedSelectionEvent.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Application

expression A variable that represents a MovedSelectionEvent object.

Return Value

Application


MovedSelectionEvent.ObjectType Property (Visio)

 Copy code hover
[image]

MovedSelectionEvent.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeMovedSelectionEvent, the type of this object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression A variable that represents a MovedSelectionEvent object.

Return Value

visObjTypeMovedSelectionEvent

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


MovedSelectionEvent.ReplacementShape Property (Visio)

 Copy code hover
[image]

MovedSelectionEvent.ReplacementShape Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Shape object that represents the shape that is in the source page and that replaces the source-page shapes or selection being moved to a sub-process page. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ReplacementShape

expression A variable that represents a MovedSelectionEvent object.

Return Value

Shape


MovedSelectionEvent.SelectionSource Property (Visio)

 Copy code hover
[image]

MovedSelectionEvent.SelectionSource Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Selection object that represents the set of selected shapes before they are moved to a sub-process page. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .SelectionSource

expression A variable that represents a MovedSelectionEvent object.

Return Value

Selection


MovedSelectionEvent.SelectionTarget Property (Visio)

 Copy code hover
[image]

MovedSelectionEvent.SelectionTarget Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Selection object that represents the set of selected shapes after they are moved to a new sub-process page. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .SelectionTarget

expression A variable that represents a MovedSelectionEvent object.

Return Value

Selection


MovedSelectionEvent.Stat Property (Visio)

 Copy code hover
[image]

MovedSelectionEvent.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression A variable that represents a MovedSelectionEvent object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


MSGWrap Object (Visio)

 Copy code hover
[image]

MSGWrap Object (Visio)
Send feedback

Published: July 16, 2012

Passed as an argument with the OnKeystrokeMessageForAddon event. The MSGWrap object wraps the data contained in a message passed from Microsoft Windows to Microsoft Visio.

Version Information

Version Added: Visio 2002

Remarks

The properties of the MSGWrap object correspond to the fields in the MSG structure defined as part of the Windows operating system.

For details, search for "MSG structure" in your Windows documentation or on MSDN, the Microsoft Developer Network.


MSGWrap Members (Visio)

 Copy code hover
[image]

MSGWrap Members (Visio)
Send feedback

Published: July 16, 2012

Passed as an argument with the OnKeystrokeMessageForAddon event. The MSGWrap object wraps the data contained in a message passed from Microsoft Windows to Microsoft Visio.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
hwnd | Gets or sets the HWND member of the MSG structure being wrapped. Read/write.
lParam | Gets or sets the lParam member of the MSG structure being wrapped. Read/write.
message | Gets or sets the message member of the MSG structure being wrapped. Read/write.
ObjectType | Returns an object's type. Read-only.
posttime | Gets or sets the time member of the MSG structure being wrapped. Read/write.
ptx | Gets or sets the pt.x member of the MSG structure being wrapped. Read/write.
pty | Gets or sets the pt.y member of the MSG structure being wrapped. Read/write.
wParam | Gets or sets the wParam member of the MSG structure being wrapped. Read/write.


MSGWrap Properties (Visio)

 Copy code hover
[image]

MSGWrap Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
hwnd | Gets or sets the HWND member of the MSG structure being wrapped. Read/write.
lParam | Gets or sets the lParam member of the MSG structure being wrapped. Read/write.
message | Gets or sets the message member of the MSG structure being wrapped. Read/write.
ObjectType | Returns an object's type. Read-only.
posttime | Gets or sets the time member of the MSG structure being wrapped. Read/write.
ptx | Gets or sets the pt.x member of the MSG structure being wrapped. Read/write.
pty | Gets or sets the pt.y member of the MSG structure being wrapped. Read/write.
wParam | Gets or sets the wParam member of the MSG structure being wrapped. Read/write.


MSGWrap.Application Property (Visio)

 Copy code hover
[image]

MSGWrap.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a MSGWrap object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


MSGWrap.hwnd Property (Visio)

 Copy code hover
[image]

MSGWrap.hwnd Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the HWND member of the MSG structure being wrapped. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .hwnd

expression A variable that represents a MSGWrap object.

Return Value

Long

Remarks

The properties of the MSGWrap object correspond to the members of the MSG structure defined as part of the Microsoft Windows operating system.

For details, search for "MSG structure" on MSDN, the Microsoft Developer Network.


MSGWrap.lParam Property (Visio)

 Copy code hover
[image]

MSGWrap.lParam Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the lParam member of the MSG structure being wrapped. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .lParam

expression A variable that represents a MSGWrap object.

Return Value

Long

Remarks

The lParam property corresponds to the lParam member of the MSG structure defined as part of the Microsoft Windows operating system. If an event handler is handling the OnKeystrokeMessageForAddon event, Microsoft Visio passes a MSGWrap object as an argument when this event fires. A MSGWrap object is a wrapper around the Windows MSG structure.

For details, search for "MSG structure" on MSDN, the Microsoft Developer Network.


MSGWrap.message Property (Visio)

 Copy code hover
[image]

MSGWrap.message Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the message member of the MSG structure being wrapped. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .message

expression A variable that represents a MSGWrap object.

Return Value

Long

Remarks

The message property corresponds to the message member of the MSG structure defined as part of the Microsoft Windows operating system. If an event handler is handling the OnKeystrokeMessageForAddon event, Microsoft Visio passes a MSGWrap object as an argument when this event fires. A MSGWrap object is a wrapper around the Windows MSG structure.

The OnKeystrokeMessageForAddon event fires for messages in the following range:

WM_KEYDOWN | 0x0100
WM_KEYUP | 0x0101
WM_CHAR | 0x0102
WM_DEADCHAR | 0x0103
WM_SYSKEYDOWN | 0x0104
WM_SYSKEYUP | 0x0105
WM_SYSCHAR | 0x0106
WM_SYSDEADCHAR | 0x0107

For details, search for "MSG structure" on MSDN, the Microsoft Developer Network.


MSGWrap.ObjectType Property (Visio)

 Copy code hover
[image]

MSGWrap.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a MSGWrap object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


MSGWrap.posttime Property (Visio)

 Copy code hover
[image]

MSGWrap.posttime Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the time member of the MSG structure being wrapped. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .posttime

expression A variable that represents a MSGWrap object.

Return Value

Long

Remarks

The posttime property corresponds to the time member of the MSG structure defined as part of the Microsoft Windows operating system. If an event handler is handling the OnKeystrokeMessageForAddon event, Microsoft Visio passes a MSGWrap object as an argument when this event fires. A MSGWrap object is a wrapper around the Windows MSG structure.

For details, search for "MSG structure" on MSDN, the Microsoft Developer Network.


MSGWrap.ptx Property (Visio)

 Copy code hover
[image]

MSGWrap.ptx Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the pt.x member of the MSG structure being wrapped. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .ptx

expression A variable that represents a MSGWrap object.

Return Value

Long

Remarks

The ptx property corresponds to the pt.x member in the MSG structure defined as part of the Microsoft Windows operating system. If an event handler is handling the OnKeystrokeMessageForAddon event, Microsoft Visio passes a MSGWrap object as an argument when this event fires. A MSGWrap object is a wrapper around the Windows MSG structure.

For details, search for "MSG structure" on MSDN, the Microsoft Developer Network.


MSGWrap.pty Property (Visio)

 Copy code hover
[image]

MSGWrap.pty Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the pt.y member of the MSG structure being wrapped. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .pty

expression A variable that represents a MSGWrap object.

Return Value

Long

Remarks

The pty property corresponds to the pt.y member in the MSG structure defined as part of the Microsoft Windows operating system. If an event handler is handling the OnKeystrokeMessageForAddon event, Microsoft Visio passes a MSGWrap object as an argument when this event fires. A MSGWrap object is a wrapper around the Windows MSG structure.

For details, search for "MSG structure" on MSDN, the Microsoft Developer Network.


MSGWrap.wParam Property (Visio)

 Copy code hover
[image]

MSGWrap.wParam Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the wParam member of the MSG structure being wrapped. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .wParam

expression A variable that represents a MSGWrap object.

Return Value

Long

Remarks

The wParam property corresponds to the wParam member ofn the MSG structure defined as part of the Microsoft Windows operating system. If an event handler is handling the OnKeystrokeMessageForAddon event, Microsoft Visio passes a MSGWrap object as an argument when this event fires. A MSGWrap object is a wrapper around the Windows MSG structure.

For details, search for "MSG structure" on MSDN, the Microsoft Developer Network.


OLEObject Object (Visio)

 Copy code hover
[image]

OLEObject Object (Visio)
Send feedback

Published: July 16, 2012

Represents an OLE 2.0 linked or embedded object or an ActiveX control in a Microsoft Visio document, page, or master.

Version Information

Version Added: Visio 5.0

Remarks

The default property of OLEObject is Object.

To obtain the IDispatch interface on an ActiveX control or embedded or linked OLE 2.0 object represented by a shape, use the Object property of an OLEObject object.


OLEObject Members (Visio)

 Copy code hover
[image]

OLEObject Members (Visio)
Send feedback

Published: July 16, 2012

Represents an OLE 2.0 linked or embedded object or an ActiveX control in a Microsoft Visio document, page, or master.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ClassID | Returns the class ID string of a shape that represents an ActiveX control or an embedded or linked OLE object. Read-only.
ForeignType | Returns the subtype of a Shape object that represents a foreign object. Read-only.
Object | Returns an IDispatch interface on the ActiveX control or embedded or linked OLE 2.0 object represented by a Shape object or an OLEObject object. Read-only.
ObjectType | Returns an object's type. Read-only.
ProgID | Returns the programmatic identifier of a shape that represents an ActiveX control, an embedded object, or linked object. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.


OLEObject Properties (Visio)

 Copy code hover
[image]

OLEObject Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ClassID | Returns the class ID string of a shape that represents an ActiveX control or an embedded or linked OLE object. Read-only.
ForeignType | Returns the subtype of a Shape object that represents a foreign object. Read-only.
Object | Returns an IDispatch interface on the ActiveX control or embedded or linked OLE 2.0 object represented by a Shape object or an OLEObject object. Read-only.
ObjectType | Returns an object's type. Read-only.
ProgID | Returns the programmatic identifier of a shape that represents an ActiveX control, an embedded object, or linked object. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.


OLEObject.Application Property (Visio)

 Copy code hover
[image]

OLEObject.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents an OLEObject object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


OLEObject.ClassID Property (Visio)

 Copy code hover
[image]

OLEObject.ClassID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the class ID string of a shape that represents an ActiveX control or an embedded or linked OLE object. Read-only.

Version Information

Version Added: Visio 4.5

Syntax

expression .ClassID

expression A variable that represents an OLEObject object.

Return Value

String

Remarks

The ClassID property raises an exception if the shape doesn't represent an ActiveX control or an OLE 2.0 embedded or linked object. A shape represents an ActiveX control or an OLE 2.0 embedded or linked object if the visTypeIsOLE2 bit (&H8000) is set in the value returned by Shape.ForeignType.

ClassID returns a string of the form:

VBA Copy code Copy code
{2287DC42-B167-11CE-88E9-002AFDDD917}

This identifies the application that services the object. It might, for example, identify an embedded object on a Microsoft Visio page as a Microsoft Excel object.

After using a shape's Object property to obtain an Automation interface on the object the shape represents, you might want to obtain the shape's ClassID or ProgID property to determine the methods and properties provided by the interface.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to get the OLEObjects collection of an active page and print the ClassID for each OLEObject object in the Immediate window. This example assumes that the active page has at least one OLE 2.0 embedded or linked object or an ActiveX control.

VBA Copy code Copy code

Public Sub ClassID_Example()

 Dim intCounter As Integer
 Dim vsoOLEObjects As Visio.OLEObjects

 'Get the OLEObjects collection of the active page.
 Set vsoOLEObjects = ActivePage.OLEObjects

 'Step through the collection of OLEObjects on the page.
 For intCounter = 1 To vsoOLEObjects.Count
 Debug.Print vsoOLEObjects(intCounter).ClassID
 Next intCounter

End Sub


OLEObject.ForeignType Property (Visio)

 Copy code hover
[image]

OLEObject.ForeignType Property (Visio)
Send feedback

Published: July 16, 2012

Returns the subtype of a Shape object that represents a foreign object. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ForeignType

expression A variable that represents an OLEObject object.

Return Value

Integer

Remarks

If the Type property of a Shape object returns any value other than visTypeForeignObject, the ForeignType property returns the same value as the Shape object's Type property. If the Type property of a Shape object returns visTypeForeignObject, the ForeignType property returns a combination of the following values.

Constant | Value
visTypeMetafile | &H0010
visTypeBitmap | &H0020
visTypeIsLinked | &H0100
visTypeIsEmbedded | &H0200
visTypeIsControl | &H0400
visTypeIsOLE2 | &H8000

If the shape represents an OLE 2.0 embedded object, for example, its ForeignType property is &H8200.


OLEObject.Object Property (Visio)

 Copy code hover
[image]

OLEObject.Object Property (Visio)
Send feedback

Published: July 16, 2012

Returns an IDispatch interface on the ActiveX control or embedded or linked OLE 2.0 object represented by a Shape object or an OLEObject object. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .Object

expression A variable that represents an OLEObject object.

Return Value

Object

Remarks

The Object property raises an exception if the object doesn't represent an ActiveX control or an OLE 2.0 embedded or linked object. A shape represents an ActiveX control or an OLE 2.0 embedded or linked object if the visTypeIsOLE2 bit (&H8000) is set in the value returned by the ForeignType property.

If the Object property succeeds, it returns an IDispatch interface on the control or object. You owe an eventual release on the returned value (set it to Nothing or let it go out of scope if you're using Microsoft Visual Basic). You can determine the kind of object you've obtained an interface on by using the ClassID or ProgID property.

Beginning with Microsoft Visio 5.0, if the object returned by the Object property is embedded and the shape inherits the object from its master, the Object property severs the instance—that is, it copies the inherited data into the instance. Otherwise, if the client receiving the IDispatch interface from the Object property makes changes to the object, all instances of the master, not just the instance being queried, change. If the object returned by the Object property is linked, the Object property does not sever the instance because, by definition, there may be other entities referencing the link. The ObjectIsInherited property was added to Visio 5.0 so that client programs can know if a shape inherits its object and access the master's object(s).


OLEObject.ObjectType Property (Visio)

 Copy code hover
[image]

OLEObject.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents an OLEObject object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


OLEObject.ProgID Property (Visio)

 Copy code hover
[image]

OLEObject.ProgID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the programmatic identifier of a shape that represents an ActiveX control, an embedded object, or linked object. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .ProgID

expression A variable that represents an OLEObject object.

Return Value

String

Remarks

The ProgID property raises an exception if the shape doesn't represent an ActiveX control or OLE 2.0 embedded or linked object. A shape represents an ActiveX control, embedded object, or linked object if the ForeignType property returns visTypeIsOLE2 in the value.

Use the ProgID property of a Shape object or OLEObject to obtain the programmatic identifier of the object. Every OLE object class stores a programmatic identifier for itself in the registry. Typically this occurs when the program that services the object installs itself. Client programs use this identifier to identify the object. You are using the Microsoft Visio identifier when you execute a statement such as GetObject(,"Visio.Application") from a Microsoft Visual Basic program.

These are strings that the ProgID property might return:

Copy code Copy code

Visio.Drawing.5
MSGraph.Chart.5
Forms.CommandButton.1

After using a shape's Object property to obtain an IDispatch interface on the object the shape represents, you can obtain the shape's ClassID or ProgID property to determine the methods and properties provided by that interface.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the OLEObjects collection of an active page and print the ProgID for each OLEObject object in the Immediate window. This example assumes that the active page has at least one OLE 2.0 embedded or linked object or an ActiveX control.

VBA Copy code Copy code

Public Sub ProgID_Example()

 Dim intCounter As Integer
 Dim vsoOLEObjects As Visio.OLEObjects

 'Get the OLEObjects collection of the active page.
 Set vsoOLEObjects = ActivePage.OLEObjects

 'Step through the OLEObjects collection.
 For intCounter = 1 To vsoOLEObjects.Count
 Debug.Print vsoOLEObjects(intCounter).ProgID
 Next intCounter

End Sub


OLEObject.Shape Property (Visio)

 Copy code hover
[image]

OLEObject.Shape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Shape

expression A variable that represents an OLEObject object.

Return Value

Shape

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Shape property to get the Shape objects that own a Cell and a Characters object.

VBA Copy code Copy code

Public Sub Shape_Example()

 Dim vsoRectangle As Visio.Shape
 Dim vsoOval As Visio.Shape
 Dim vsoShapeFromCell As Visio.Shape
 Dim vsoShapeFromCharacters As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim vsoCharacters As Visio.Characters

 'Create 2 different shapes and add different text to each shape.
 Set vsoRectangle = ActivePage.DrawRectangle(2, 3, 5, 4)
 Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
 vsoRectangle.Text = "Rectangle Shape"
 vsoOval.Text = "Oval Shape"

 'Get a Cell object from the first shape.
 Set vsoCell = vsoRectangle.Cells("Width")

 'Get a Characters object from the second shape.
 Set vsoCharacters = vsoOval.Characters

 'Use the Shape property to get the Shape object.
 Set vsoShapeFromCell = vsoCell.Shape
 Set vsoShapeFromCharacters = vsoCharacters.Shape

 'Use each shape's text to verify the proper Shape
 'object was returned.
 Debug.Print vsoShapeFromCell.Text
 Debug.Print vsoShapeFromCharacters.Text

End Sub


OLEObject.Stat Property (Visio)

 Copy code hover
[image]

OLEObject.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents an OLEObject object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


OLEObjects Object (Visio)

 Copy code hover
[image]

OLEObjects Object (Visio)
Send feedback

Published: July 16, 2012

Includes an OLEObject object for each OLE 2.0 linked or embedded object or ActiveX control contained in a document, page, or master.

Version Information

Version Added: Visio 5.0

Remarks

Each member of an OLEObjects collection is an OLEObject object, which represents an OLE 2.0 linked or embedded object or an ActiveX control in a Microsoft Visio document.

The default property of an OLEObjects collection is Item.


OLEObjects Members (Visio)

 Copy code hover
[image]

OLEObjects Members (Visio)
Send feedback

Published: July 16, 2012

Includes an OLEObject object for each OLE 2.0 linked or embedded object or ActiveX control contained in a document, page, or master.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.


OLEObjects Properties (Visio)

 Copy code hover
[image]

OLEObjects Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ObjectType | Returns an object's type. Read-only.
Stat | Returns status information for an object. Read-only.


OLEObjects.Application Property (Visio)

 Copy code hover
[image]

OLEObjects.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents an OLEObjects object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


OLEObjects.Count Property (Visio)

 Copy code hover
[image]

OLEObjects.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents an OLEObjects object.

Return Value

Long

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


OLEObjects.Item Property (Visio)

 Copy code hover
[image]

OLEObjects.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameOrIndex)

expression A variable that represents a OLEObjects collection.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

OLEObject

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.


OLEObjects.ObjectType Property (Visio)

 Copy code hover
[image]

OLEObjects.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents an OLEObjects object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


OLEObjects.Stat Property (Visio)

 Copy code hover
[image]

OLEObjects.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents an OLEObjects object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Page Object (Visio)

 Copy code hover
[image]

Page Object (Visio)
Send feedback

Published: July 16, 2012

Represents a drawing page, which can be either a foreground page or a background page.

Version Information

Version Added: Visio 2.0

Remarks

The default property of a Page object is Name.

To retrieve the active page in an instance, use the ActivePage property of an Application object.

The members of a Document object's Pages collection represent the pages in that document. To retrieve a page's shapes, use the Shapes property of a Page object.


Page Members (Visio)

 Copy code hover
[image]

Page Members (Visio)
Send feedback

Published: July 16, 2012

Represents a drawing page, which can be either a foreground page or a background page.

Events

Name | Description
AfterReplaceShapes | Occurs after a shape-replacement operation.
BeforePageDelete | Occurs before a page is deleted.
BeforeReplaceShapes | Occurs just before a shape-replacement operation.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
CalloutRelationshipAdded | Occurs when a new callout relationship is added to the page.
CalloutRelationshipDeleted | Occurs when a callout relationship is deleted from the page.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ContainerRelationshipAdded | Occurs when a new container relationship is added to the document.
ContainerRelationshipDeleted | Occurs when a container relationship is deleted from the document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelReplaceShapes | Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
ReplaceShapesCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Methods

Name | Description
AddGuide | Adds a guide to a drawing page.
AutoConnectMany | Automatically draws multiple connections in the specified directions between the specified shapes. Returns the number of shapes connected.
AutoSizeDrawing | Automatically resizes the drawing page by adding as many printer-paper-sized tiles as necessary to fit all shapes in the drawing onto the page.
AvoidPageBreaks | Makes small adjustments to shapes to move them off page breaks.
BoundingBox | Returns a rectangle that tightly encloses the shapes of a page.
CenterDrawing | Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .
CreateSelection | Creates various types of Selection objects.
Delete | Deletes a Page object. Can also renumber remaining pages.
DrawArcByThreePoints | Creates a shape whose path consists of an arc defined by the three points passed as parameters.
DrawBezier | Creates a shape whose path is defined by the supplied sequence of Bezier control points.
DrawCircularArc | Creates a new shape whose path consists of a circular arc defined by its center, radius, and start and end angles.
DrawLine | Adds a line to the Shapes collection of a page.
DrawNURBS | Creates a new shape whose path consists of a single NURBS (nonuniform rational B-spline) segment.
DrawOval | Adds an oval (ellipse) to the Shapes collection of a page.
DrawPolyline | Creates a shape whose path is a polyline along a given set of points.
DrawQuarterArc | Creates a shape whose path consists of an elliptical arc defined by the two points and the flag passed in as arguments.
DrawRectangle | Adds a rectangle to the Shapes collection of a page, master, or group.
DrawSpline | Creates a new shape whose path follows a given sequence of points.
Drop | Creates one or more new Shape objects by dropping an object onto a receiving object such as a master, drawing page, shape, or group.
DropCallout | Creates a new callout Shape object on the page near the specified target shape, and associates the callout with the target shape. Returns the callout shape.
DropConnected | Creates a new Shape object on the page, places the new shape relative to the specified existing target shape, and adds a connector from the existing shape to the new shape. Returns the newly created shape.
DropContainer | Creates a new container Shape object on the page, places the container around the specified target shapes, and adds the target shapes to the container. Returns the container shape.
DropIntoList | Drops the specified object into the specified list at the specified position. Returns the newly dropped shape.
DropLegend | Inserts a data graphics legend on a Microsoft Visio drawing page. Returns the list shape instance specified in the OuterList parameter.
DropLinked | Returns a new shape on the drawing page linked to data in a data recordset.
DropMany | Creates one or more new Shape objects on a page. It returns an array of the IDs of the Shape objects it produces.
DropManyLinkedU | Creates multiple new shapes on the drawing page that are linked to multiple data rows in a data recordset. Returns the number of shape instances created and an array of IDs of those shapes.
DropManyU | Creates one or more new Shape objects on a page, in a master, or in a group. It returns an array of the IDs of the Shape objects it produces.
Duplicate | Duplicates the specified page and returns the new page.
Export | Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.
GetCallouts | Returns the list of identifiers of the callout shapes on the page.
GetContainers | Returns an array of shape identifiers (IDs) of the container shapes on the page.
GetFormulas | Returns the formulas of many cells.
GetFormulasU | Returns the formulas of many cells.
GetResults | Gets the results or formulas of many cells.
GetShapesLinkedToData | Returns an array of all shapes on the active page linked to data in the specified data recordset.
GetShapesLinkedToDataRow | Returns an array of all shapes on the active page linked to data in the specified data row in the specified data recordset.
GetTheme | Returns a Variant that represents the specified theme component of the specified page.
GetThemeVariant | Returns the color, style, and embellishment, if any, of the variant of the theme applied to the specified page.
Import | Imports a file into the current document.
InsertFromFile | Adds a linked or embedded object to a page, master, or group.
InsertObject | Adds a new embedded object or ActiveX control to a page, master, or group.
Layout | Lays out the shapes and/or reroutes the connectors for the page, master, group, or selection.
LayoutChangeDirection | Revises the layout of a set of connected shapes on the page, by rotating or flipping a connected diagram without rotating or flipping the individual shapes.
LayoutIncremental | Makes small adjustments to the position of shapes on the drawing page to better align the shapes or to space them evenly from other shapes.
LinkShapesToDataRows | Links multiple rows in the specified data recordset, as specified by their data row IDs, to multiple shapes on the page, and optionally applies the current data graphic to the linked shapes.
OpenDrawWindow | Opens a new drawing window that displays a page.
Paste | Pastes the contents of the Clipboard into an object.
PasteSpecial | Inserts the contents of the Clipboard, allowing you to control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Word document).
PasteToLocation | Pastes the shape to the specified location on the page.
Print | Prints the contents of an object to the default printer.
PrintTile | Prints a single tile of a drawing page.
ResizeToFitContents | Resizes the page, or the master's page, to fit tightly around the shapes or master that are on it.
SetFormulas | Sets the formulas of one or more cells.
SetResults | Sets the results or formulas of one or more cells.
SetTheme | Sets the theme for the specified page.
SetThemeVariant | Sets the color, style, and optionally the embellishment of the variant of the theme applied to the specified page.
ShapeIDsToUniqueIDs | Returns an array of unique IDs of shapes on the page, as specified by their shape IDs.
SplitConnector | Splits the specified connector with the specified shape. Returns the new duplicated connector.
UniqueIDsToShapeIDs | Returns an array of shape IDs of shapes on the page, as specifed by their unique IDs.
VisualBoundingBox |

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
AutoSize | Determines whether Microsoft Visio automatically resizes the drawing page by adding printer-paper-sized sheets, as necessary, to fit the drawing's contents. Read/write.
Background | Determines whether a page is a background page. Read/write.
BackPage | Gets or sets the background page of a page. Read/write.
Comments | Returns a Comments object that represents the collection of all the reviewer comments on the page. Read-only.
Connects | Returns a Connects collection for a shape, page, or master. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
ID | Gets the ID of an object. Read-only.
Index | Gets or sets the ordinal position of a page in a Pages collection. Read/write.
Layers | Returns the Layers collection of an object. Read-only.
LayoutRoutePassive | Determines whether to enable advanced connector routing logic on the page. Read/write.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Page object. Read/write.
ObjectType | Returns an object's type. Read-only.
OLEObjects | Returns the OLEObjects collection of a page. Read-only.
OriginalPage | Returns the Page object that represents the original Microsoft Visio drawing page that was marked up on separate markup overlays by reviewers of the drawing. Read-only.
PageSheet | Returns the page sheet (an object that represents the ShapeSheet spreadsheet) of a page. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Picture | Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.
PrintTileCount | Returns the number of print tiles for a drawing page. Read-only.
ReviewerID | Gets the reviewer ID associated with the markup overlay. Read-only.
ShapeComments | Returns a Comments object that represents the collection of all the reviewer comments on all the shapes on the page. Read-only.
Shapes | Returns the Shapes collection for a page, master, or group. Read-only.
SpatialSearch | Returns a Selection object whose shapes meet certain criteria in relation to a point that is expressed in the coordinate space of a page, master, or group. Read-only.
Stat | Returns status information for an object. Read-only.
ThemeColors | Gets or sets the current theme colors for the page. Read/write.
ThemeEffects | Gets or sets the current theme effect for the page. Read/write.
Type | Returns the type of the object. Read-only.


Page Properties (Visio)

 Copy code hover
[image]

Page Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
AutoSize | Determines whether Microsoft Visio automatically resizes the drawing page by adding printer-paper-sized sheets, as necessary, to fit the drawing's contents. Read/write.
Background | Determines whether a page is a background page. Read/write.
BackPage | Gets or sets the background page of a page. Read/write.
Comments | Returns a Comments object that represents the collection of all the reviewer comments on the page. Read-only.
Connects | Returns a Connects collection for a shape, page, or master. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
ID | Gets the ID of an object. Read-only.
Index | Gets or sets the ordinal position of a page in a Pages collection. Read/write.
Layers | Returns the Layers collection of an object. Read-only.
LayoutRoutePassive | Determines whether to enable advanced connector routing logic on the page. Read/write.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Page object. Read/write.
ObjectType | Returns an object's type. Read-only.
OLEObjects | Returns the OLEObjects collection of a page. Read-only.
OriginalPage | Returns the Page object that represents the original Microsoft Visio drawing page that was marked up on separate markup overlays by reviewers of the drawing. Read-only.
PageSheet | Returns the page sheet (an object that represents the ShapeSheet spreadsheet) of a page. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Picture | Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.
PrintTileCount | Returns the number of print tiles for a drawing page. Read-only.
ReviewerID | Gets the reviewer ID associated with the markup overlay. Read-only.
ShapeComments | Returns a Comments object that represents the collection of all the reviewer comments on all the shapes on the page. Read-only.
Shapes | Returns the Shapes collection for a page, master, or group. Read-only.
SpatialSearch | Returns a Selection object whose shapes meet certain criteria in relation to a point that is expressed in the coordinate space of a page, master, or group. Read-only.
Stat | Returns status information for an object. Read-only.
ThemeColors | Gets or sets the current theme colors for the page. Read/write.
ThemeEffects | Gets or sets the current theme effect for the page. Read/write.
Type | Returns the type of the object. Read-only.


Page.Application Property (Visio)

 Copy code hover
[image]

Page.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Page object.

Return Value

Application

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVPage.Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

    Dim vsoApplication As Visio.Application
    Dim vsoDocument As Visio.Document

    Set vsoDocument = ActiveDocument

    'Get the instance of Visio associated with the Document object.
    Set vsoApplication = vsoDocument.Application
    Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Page.AutoSize Property (Visio)

 Copy code hover
[image]

Page.AutoSize Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether Microsoft Visio automatically resizes the drawing page by adding printer-paper-sized sheets, as necessary, to fit the drawing's contents. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .AutoSize

expression An expression that returns a Page object.

Return Value

Boolean

Remarks

Set AutoSize to True to enable automatic resizing of the page. Set AutoSize to False (the default) to disable automatic resizing.

The AutoSize property setting corresponds to the state of the AutoSize button in the Page Setup group on the Design tab.


Page.Background Property (Visio)

 Copy code hover
[image]

Page.Background Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a page is a background page. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Background

expression A variable that represents a Page object.

Return Value

Integer

Remarks

The Background property must always be true for markup pages.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to iterate through a document's pages and determine whether a page is a foreground or background page. It displays the foreground pages in a list box. To run this macro, first insert a user form containing a list box control into your project.

VBA Copy code Copy code

Public Sub Background_Example()

 Dim vsoPages As Visio.Pages
 Dim vsoPage As Visio.Page
 Dim intCounter As Integer

 'Get the Pages collection.
 Set vsoPages = ThisDocument.Pages

 'Make sure the list box is cleared.
 UserForm1.ListBox1.Clear

 'Iterate through the collection.
 For intCounter = 1 To vsoPages.Count

 'Retrieve the Page object at the current index.
 Set vsoPage = vsoPages(intCounter)

 'Check whether the current page is a background page.
 'Display the names of all the foreground pages.
 If vsoPage.Background = False Then

 UserForm1.ListBox1.AddItem vsoPage.Name

 End If

 Next intCounter

 'Display the user form.
 UserForm1.Show

End Sub


Page.BackPage Property (Visio)

 Copy code hover
[image]

Page.BackPage Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the background page of a page. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .BackPage

expression A variable that represents a Page object.

Return Value

Variant

Remarks

If a page has no background, its BackPage property returns an empty Variant. Otherwise the returned Variant refers to a Page object, the background page of the indicated page.

To assign a background page to a page, set the page's BackPage property to the name of that background page. To cause a page to have no background page, pass an empty string to the BackPage property.

Markup overlay pages cannot have background pages, so you cannot use the BackPage property to assign a background page to a markup overlay page.

Note Note

In earlier versions of Visio (through version 4.1), the BackPage property returned an object (as opposed to a Variant of type Object) and it accepted a string (as opposed to a Variant of type String). Because of changes in Automation support tools, the property has been modified so that it accepts and returns a Variant.


Page.Comments Property (Visio)

 Copy code hover
[image]

Page.Comments Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns a Comments object that represents the collection of all the reviewer comments on the page. Read-only.

Syntax

expression .Comments

expression A variable that represents a Page object.

Property value

IVCOMMENTS

See also

Concepts

Page Object

Other resources

Page Members


Page.Connects Property (Visio)

 Copy code hover
[image]

Page.Connects Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Connects collection for a shape, page, or master. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Connects

expression A variable that represents a Page object.

Return Value

Connects

Remarks

The Connects collection of a shape contains every Connect object for which the shape is returned by the FromSheet property. This tells you all the shapes to which the shape is connected.

To obtain a Connects collection that contains every Connect object for which the shape is the ToSheet property, use the shape's FromConnects property. This tells you all the shapes that are connected to this shape.

The Connects collection of a page contains a Connect object for every connection on the page.

The Connects collection of a master contains a Connect object for every connection in the master.


Page.Document Property (Visio)

 Copy code hover
[image]

Page.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Page object.

Return Value

Document

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVPage.Document

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Document property of various objects to retrieve data about those objects, and does the following:

  • It adds a Document object to the Documents collection and sets several of the Document object's properties.

  • It gets the active window and active page, draws a rectangle on the page, and drops a master on the Document object to provide various objects to work on.

  • It uses the Document property to get the Document object associated with each of these other objects.

VBA Copy code Copy code

Public Sub Document_Example()

    Dim vsoDocument As Visio.Document
    Dim vsoTempDocument As Visio.Document
    Dim vsoPage As Visio.Page
    Dim vsoShape As Visio.Shape
    Dim vsoWindow As Visio.Window
    Dim vsoMaster As Visio.Master

    'Add a document to the Documents collection.
    Set vsoDocument = Documents.Add("")

    'Set the title of the document.
     vsoDocument.Title = "My Document"

    'Get the active window and active page.
    Set vsoWindow = ActiveWindow
    Set vsoPage = ActivePage

    'Draw a rectangle on the page.
    Set vsoShape = vsoPage.DrawRectangle(2, 2, 5, 5)

    'Add a master.
    Set vsoMaster = vsoDocument.Masters.Add

    'Get the Document object associated with various other objects.'Get the Document object associated with the Window object.
    Set vsoTempDocument = vsoWindow.Document

    'Get the Title property of the Document object'to verify that this is the same document we added earlier.
    Debug.Print vsoTempDocument.Title

    'Get the Document object associated with the Page object.
    Set vsoTempDocument = vsoPage.Document
    Debug.Print vsoTempDocument.Title

    'Get the Document object associated with the Shape object.
    Set vsoTempDocument = vsoShape.Document
    Debug.Print vsoTempDocument.Title

    'Get the Document object associated with the Master object.
    Set vsoTempDocument = vsoMaster.Document
    Debug.Print vsoTempDocument.Title

End Sub


Page.EventList Property (Visio)

 Copy code hover
[image]

Page.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Page object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Page.ID Property (Visio)

 Copy code hover
[image]

Page.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ID of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ID

expression A variable that represents a Page object.

Return Value

Long

Remarks

The ID of a shape is unique only within the scope of the page or master. The ID of a page, master, or style is unique within the scope of the document.

If a shape, page, master, or style is deleted, future objects in the same scope may be assigned the same ID. Therefore, persisting shape or style IDs in separate data stores is generally not as sound as persisting unique IDs using the UniqueID property.


Page.Index Property (Visio)

 Copy code hover
[image]

Page.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the ordinal position of a page in a Pages collection. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .Index

expression A variable that represents a Page object.

Return Value

Integer

Remarks

In versions earlier than 2002, the Index property of the Page object was read-only.

The Pages collection is indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so on. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.

You may only assign a new index to a foreground page. Background pages are unordered. Use the Background property to determine if a given page is a background page.

Use the BackPage property to assign a background page to a foreground page or to another background page.


Page.Layers Property (Visio)

 Copy code hover
[image]

Page.Layers Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Layers collection of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Layers

expression A variable that represents a Page object.

Return Value

Layers

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Layers property to add shapes to layers. It also uses the Layer property to get a reference to a particular layer, the LayerCount property to determine the number of layers to which a shape is assigned, and the Name property to get the name of the current layer.

VBA Copy code Copy code

Public Sub Layers_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoLayer As Visio.Layer
 Dim vsoLayers As Visio.Layers

 If ActiveDocument Is Nothing Then
 Documents.Add ("")
 End If

 Set vsoPage = ActivePage
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Get the Layers collection.
 Set vsoLayers = vsoPage.Layers

 'Create a layer named ExampleLayer1 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer1")
 vsoLayer.Add vsoShape, 1

 'Create a layer named ExampleLayer2 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer2")
 vsoLayer.Add vsoShape, 1

 'Verify that the shape has been assigned to 2 layers.
 Debug.Print "The shape is assigned to " & vsoShape.LayerCount & " layers."

 'Get a reference to the first layer.
 Set vsoLayer = vsoShape.Layer(1)

 'Verify by using the Name property.
 Debug.Print "Current layer name is """ & vsoLayer.Name & "."""

End Sub


Page.LayoutRoutePassive Property (Visio)

 Copy code hover
[image]

Page.LayoutRoutePassive Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether to enable advanced connector routing logic on the page. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .LayoutRoutePassive

expression A variable that represents a Page object.

Return Value

Boolean

Remarks

When LayoutRoutePassive is set to True, advanced connector routing is disabled, which means that when connectors are glued to shapes, they do not attach to the shapes dynamically. That is, when those shapes are moved, the connector endpoints that are glued to the shapes move with them, but without the benefits of dynamic routing, such as shifting their location to a new side of the shape when appropriate, or redistribution (in the Flowchart routing style only).

The default setting of the LayoutRoutePassive property is False, which means that advanced connector routing is enabled. Because setting the property to True disables advanced connector routing, doing so can result in shapes that are glued incorrectly, which, in turn, leads to unsatisfactory diagram appearance and connector behavior. As a result, it is suggested that you set this property to True only briefly, when you specifically do not want advanced connector routing to occur.

The LayoutRoutePassive property can also affect paste behavior. When you paste shapes into a diagram, the resulting connector behavior depends on how you pasted the shape into the diagram. When you paste by using the keyboard combination CTRL+V, advanced connector rerouting does not take place, but when you paste by using the right-click (context) menu, advanced connector rerouting does take place. However, if the LayoutRoutePassive property is set to True, advanced connector routing is always disabled when you paste shapes into the drawing, no matter which method you use.


Page.Name Property (Visio)

 Copy code hover
[image]

Page.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a Page object.

Return Value

String

Remarks

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Page.NameU Property (Visio)

 Copy code hover
[image]

Page.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of a Page object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .NameU

expression A variable that represents a Page object.

Return Value

String

Remarks

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Page.ObjectType Property (Visio)

 Copy code hover
[image]

Page.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Page object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Page.OLEObjects Property (Visio)

 Copy code hover
[image]

Page.OLEObjects Property (Visio)
Send feedback

Published: July 16, 2012

Returns the OLEObjects collection of a page. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .OLEObjects

expression A variable that represents a Page object.

Return Value

OLEObjects

Remarks

The OLEObjects property returns an OLEObjects collection that includes any OLE 2.0 linked or embedded objects or ActiveX controls contained in a document, master, or page.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the OLEObjects collection of an active page and print the ClassID and ProgID for each OLEObject object in the Immediate window. This example assumes that the active page contains at least one OLE 2.0 embedded or linked object or an ActiveX control.

VBA Copy code Copy code

Public Sub OLEObjects_Example()

 Dim intCounter As Integer
 Dim vsoOLEObjects As Visio.OLEObjects

 'Get the OLEObjects collection of the active page.
 Set vsoOLEObjects = ActivePage.OLEObjects

 'Step through the collection of OLEObjects on the page.
 For intCounter = 1 To vsoOLEObjects.Count
 Debug.Print vsoOLEObjects(intCounter).ClassID
 Debug.Print vsoOLEObjects(intCounter).ProgID
 Next intCounter

End Sub


Page.OriginalPage Property (Visio)

 Copy code hover
[image]

Page.OriginalPage Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Page object that represents the original Microsoft Visio drawing page that was marked up on separate markup overlays by reviewers of the drawing. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .OriginalPage

expression A variable that represents a Page object.

Return Value

Page

Remarks

If the Page parent object is not a markup overlay, OriginalPage returns an error. To determine if a page is a markup overlay, check to see whether Page.Type = visTypeMarkup (3).

When a user clicks Track Markup, Visio creates a new page of type visTypeMarkup. The original page has type visTypeForeground or visTypeBackground. Each markup overlay is associated with a unique original drawing page.

Example

This Microsoft Visual Basic for Applications (VBA) macro uses the OriginalPage property to get the name of the original page that was marked up on a markup overlay and display it in the Immediate window. Before running this macro, make sure that a drawing page is displayed in the active window.

VBA Copy code Copy code
Public Sub OriginalPage_Example()

 'Turn on Track Markup to make a markup overlay the active page.
 Application.ActiveDocument.DocumentSheet.CellsSRC(visSectionObject, visRowDoc, visDocAddMarkup).FormulaU = True

 'Display the name of the original page that currently is being marked up.
 Debug.Print ActivePage.OriginalPage.Name

End Sub


Page.PageSheet Property (Visio)

 Copy code hover
[image]

Page.PageSheet Property (Visio)
Send feedback

Published: July 16, 2012

Returns the page sheet (an object that represents the ShapeSheet spreadsheet) of a page. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .PageSheet

expression A variable that represents a Page object.

Return Value

Shape

Remarks

Every page contains a tree of Shape objects. Constants representing shape types are prefixed with visType and are declared by the Visio type library in VisShapeTypes.

In the tree of shapes of a page, there is exactly one shape of type visTypePage. This shape is always the root shape in the tree, and the PageSheet property returns this shape.

The page sheet contains important settings for the page such as its size and scale. It also contains the Layers section that defines the layers for that page.

An alternative way to obtain a page's page shape is to use the following macro:

VBA Copy code Copy code
Sub PagePageSheet_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page
 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes("ThePage")

End Sub


Page.PersistsEvents Property (Visio)

 Copy code hover
[image]

Page.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Page object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Page.Picture Property (Visio)

 Copy code hover
[image]

Page.Picture Property (Visio)
Send feedback

Published: July 16, 2012

Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .Picture

expression A variable that represents a Page object.

Return Value

IPictureDisp

Remarks

The Picture property returns only EMF files.

COM provides a standard implementation of a picture object that has the IPictureDisp interface on top of the underlying system picture support. The IPictureDisp interface exposes a picture object's properties and is implemented in the stdole type library as a StdPicture object creatable within Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic for Applications (VBA) projects in Microsoft Visio.

Currently, only in-process solutions can use the Picture property because the IPictureDisp interface cannot be marshaled.

To get information about the StdPicture object that supports the IPictureDisp interface

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click stdole.

  4. Under Classes, examine the class named StdPicture.

For details about the IPictureDisp interface, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Page.PrintTileCount Property (Visio)

 Copy code hover
[image]

Page.PrintTileCount Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of print tiles for a drawing page. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .PrintTileCount

expression A variable that represents a Page object.

Return Value

Long

Remarks

When drawings span multiple physical printer pages, you can use the PrintTileCount property to determine the number of print tiles there are for a Microsoft Visio drawing page. You can use the PrintTileCount property with the PrintTile method to identify and print selected tiles of an active drawing page.


Page.ReviewerID Property (Visio)

 Copy code hover
[image]

Page.ReviewerID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the reviewer ID associated with the markup overlay. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ReviewerID

expression A variable that represents a Page object.

Return Value

Long

Remarks

The ReviewerID property is valid only for markup overlays. To determine if a page is a markup overlay, check to see whether Page.Type = visTypeMarkup (3). If you attempt to get the ReviewerID value for foreground pages and for background pages that are not markup overlays, Microsoft Visio returns an error.

The reviewer ID returned by the ReviewerID property corresponds to one of the rows in the Reviewer section of the document's ShapeSheet. The ShapeSheet cell that contains the reviewer ID is hidden in the document ShapeSheet user interface, but you can determine the user name and initials associated with each reviewer ID by using the Document.DocumentSheet.CellsSRC property of the page. See the example that follows.

Note Note

To view a document's ShapeSheet, on the Developer tab, select Drawing Explorer, right-click the document's name, and then click Show ShapeSheet.

Example

This Microsoft Visual Basic for Applications (VBA) macro uses the ReviewerID property to get the ID of the reviewer associated with a markup overlay and then prints the reviewer's name in the Immediate window. It first determines if the active page is a markup overlay, and if so, gets the reviewer ID. Before running this macro, make sure there is an active drawing page in the Visio drawing window.

VBA Copy code Copy code
Public Sub ReviewerID_Example()
 Dim vsoPage As Visio.Page
 Dim intCounter As Integer

 Set vsoPage = ActivePage

 If vsoPage.Type = visTypeMarkup Then

 For intCounter = 0 To vsoPage.Document.DocumentSheet.RowCount(visSectionReviewer) - 1

 If vsoPage.ReviewerID = vsoPage.Document.DocumentSheet.CellsSRC(visSectionReviewer, visRowReviewer + intCounter, visReviewerReviewerID).ResultStr(0) Then

 Debug.Print "Reviewer name is: "; vsoPage.Document.DocumentSheet.CellsSRC(visSectionReviewer, visRowReviewer + intCounter, visReviewerName).ResultStr(0)

 End If

 Next intCounter

 Else

 Debug.Print "Active page is not a markup overlay."

 End If

End Sub


Page.ShapeComments Property (Visio)

 Copy code hover
[image]

Page.ShapeComments Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns a Comments object that represents the collection of all the reviewer comments on all the shapes on the page. Read-only.

Syntax

expression .ShapeComments

expression A variable that represents a Page object.

Property value

IVCOMMENTS

See also

Concepts

Page Object

Other resources

Page Members


Page.Shapes Property (Visio)

 Copy code hover
[image]

Page.Shapes Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shapes collection for a page, master, or group. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Shapes

expression A variable that represents a Page object.

Return Value

Shapes

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVPage.Shapes

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Shapes property to get the Shapes collection. It prints the names of all shapes on Page1 in the Immediate window.

To run this macro, make sure the active document has shapes on Page1.

VBA Copy code Copy code

Public Sub Shapes_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.Item(1).Shapes

    Debug.Print "Shapes in document: "; ActiveDocument.Name
    Debug.Print "On page: "; ActiveDocument.Pages.Item(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then
        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.Item(intCounter).Name
        Next intCounter

    Else
        Debug.Print "No Shapes On Page"
    End If

End Sub


Page.SpatialSearch Property (Visio)

 Copy code hover
[image]

Page.SpatialSearch Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Selection object whose shapes meet certain criteria in relation to a point that is expressed in the coordinate space of a page, master, or group. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .SpatialSearch(x, y, Relation, Tolerance, Flags)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Double | The x-coordinate.
y | Required | Double | The y-coordinate.
Relation | Required | Integer | Any combination of the values of the constants visSpatialContainedIn and visSpatialTouching.
Tolerance | Required | Double | A distance in internal drawing units with respect to the coordinate space.
Flags | Required | Integer | Flags that influence the result.

Return Value

Selection

Remarks

  • The relation argument can be any combination of the constants defined in VisSpatialRelationCodes. If relation is not specified, the SpatialSearch property uses both relationships as criteria.

  • The flags argument can be any combination of the values of the constants defined in VisSpatialRelationFlags in the Visio type library (except visSpatialIncludeHidden, which is reserved for future use, and should not be used).

Use the NoShow cell to determine whether a Geometry section is hidden or visible. Hidden Geometry section sections have a value of TRUE and visible Geometry sections have a value of FALSE in the NoShow cell.

Beginning with Microsoft Visio 2002, if flags contains visSpatialFrontToBack, items in the Selection object returned by the SpatialNeighbors property are ordered front to back. If visSpatialBackToFront is set, the items returned are ordered back to front. If this flag is not set, or if you are running an earlier version of Visio, the order is unpredictable. You can determine the order by using the Index property of the shapes identified in the Selection object.

Note Note

When it compares two shapes, the SpatialSearch property does not consider the width of a shape's line, shadows, line ends, control points, or connection points.


Page.Stat Property (Visio)

 Copy code hover
[image]

Page.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Page object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Page.ThemeColors Property (Visio)

 Copy code hover
[image]

Page.ThemeColors Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the current theme colors for the page. Read/write.

Version Information

Version Added: Visio 2007

Syntax

expression .ThemeColors

expression An expression that returns a Page object.

Return Value

Variant

Remarks

You can set the ThemeColors property value to any one of the following:

  • The name or universal name of the theme color (strings)

  • An enumerated value from the VisThemeColors enumeration

  • A Master object of type visTypeThemeColors

The ThemeColors property always returns the universal name of the current theme colors.


Page.ThemeEffects Property (Visio)

 Copy code hover
[image]

Page.ThemeEffects Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the current theme effect for the page. Read/write.

Version Information

Version Added: Visio 2007

Syntax

expression .ThemeEffects

expression An expression that returns a Page object.

Return Value

Variant

Remarks

You can set the ThemeEffects property value to any one of the following:

  • The name or universal name of the theme effect (strings)

  • An enumerated value from the VisThemeEffects enumeration

  • A Master object of type visTypeThemeEffects

The ThemeEffects property always returns the universal name of the current theme effect.


Page.Type Property (Visio)

 Copy code hover
[image]

Page.Type Property (Visio)
Send feedback

Published: July 16, 2012

Returns the type of the object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Type

expression A variable that represents a Page object.

Return Value

VisPageTypes

Remarks

Type value constants for Page objects (the possible values that the Type property of a Page object returns) are declared by the Visio type library in VisPageTypes.


Page Methods (Visio)

 Copy code hover
[image]

Page Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddGuide | Adds a guide to a drawing page.
AutoConnectMany | Automatically draws multiple connections in the specified directions between the specified shapes. Returns the number of shapes connected.
AutoSizeDrawing | Automatically resizes the drawing page by adding as many printer-paper-sized tiles as necessary to fit all shapes in the drawing onto the page.
AvoidPageBreaks | Makes small adjustments to shapes to move them off page breaks.
BoundingBox | Returns a rectangle that tightly encloses the shapes of a page.
CenterDrawing | Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .
CreateSelection | Creates various types of Selection objects.
Delete | Deletes a Page object. Can also renumber remaining pages.
DrawArcByThreePoints | Creates a shape whose path consists of an arc defined by the three points passed as parameters.
DrawBezier | Creates a shape whose path is defined by the supplied sequence of Bezier control points.
DrawCircularArc | Creates a new shape whose path consists of a circular arc defined by its center, radius, and start and end angles.
DrawLine | Adds a line to the Shapes collection of a page.
DrawNURBS | Creates a new shape whose path consists of a single NURBS (nonuniform rational B-spline) segment.
DrawOval | Adds an oval (ellipse) to the Shapes collection of a page.
DrawPolyline | Creates a shape whose path is a polyline along a given set of points.
DrawQuarterArc | Creates a shape whose path consists of an elliptical arc defined by the two points and the flag passed in as arguments.
DrawRectangle | Adds a rectangle to the Shapes collection of a page, master, or group.
DrawSpline | Creates a new shape whose path follows a given sequence of points.
Drop | Creates one or more new Shape objects by dropping an object onto a receiving object such as a master, drawing page, shape, or group.
DropCallout | Creates a new callout Shape object on the page near the specified target shape, and associates the callout with the target shape. Returns the callout shape.
DropConnected | Creates a new Shape object on the page, places the new shape relative to the specified existing target shape, and adds a connector from the existing shape to the new shape. Returns the newly created shape.
DropContainer | Creates a new container Shape object on the page, places the container around the specified target shapes, and adds the target shapes to the container. Returns the container shape.
DropIntoList | Drops the specified object into the specified list at the specified position. Returns the newly dropped shape.
DropLegend | Inserts a data graphics legend on a Microsoft Visio drawing page. Returns the list shape instance specified in the OuterList parameter.
DropLinked | Returns a new shape on the drawing page linked to data in a data recordset.
DropMany | Creates one or more new Shape objects on a page. It returns an array of the IDs of the Shape objects it produces.
DropManyLinkedU | Creates multiple new shapes on the drawing page that are linked to multiple data rows in a data recordset. Returns the number of shape instances created and an array of IDs of those shapes.
DropManyU | Creates one or more new Shape objects on a page, in a master, or in a group. It returns an array of the IDs of the Shape objects it produces.
Duplicate | Duplicates the specified page and returns the new page.
Export | Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.
GetCallouts | Returns the list of identifiers of the callout shapes on the page.
GetContainers | Returns an array of shape identifiers (IDs) of the container shapes on the page.
GetFormulas | Returns the formulas of many cells.
GetFormulasU | Returns the formulas of many cells.
GetResults | Gets the results or formulas of many cells.
GetShapesLinkedToData | Returns an array of all shapes on the active page linked to data in the specified data recordset.
GetShapesLinkedToDataRow | Returns an array of all shapes on the active page linked to data in the specified data row in the specified data recordset.
GetTheme | Returns a Variant that represents the specified theme component of the specified page.
GetThemeVariant | Returns the color, style, and embellishment, if any, of the variant of the theme applied to the specified page.
Import | Imports a file into the current document.
InsertFromFile | Adds a linked or embedded object to a page, master, or group.
InsertObject | Adds a new embedded object or ActiveX control to a page, master, or group.
Layout | Lays out the shapes and/or reroutes the connectors for the page, master, group, or selection.
LayoutChangeDirection | Revises the layout of a set of connected shapes on the page, by rotating or flipping a connected diagram without rotating or flipping the individual shapes.
LayoutIncremental | Makes small adjustments to the position of shapes on the drawing page to better align the shapes or to space them evenly from other shapes.
LinkShapesToDataRows | Links multiple rows in the specified data recordset, as specified by their data row IDs, to multiple shapes on the page, and optionally applies the current data graphic to the linked shapes.
OpenDrawWindow | Opens a new drawing window that displays a page.
Paste | Pastes the contents of the Clipboard into an object.
PasteSpecial | Inserts the contents of the Clipboard, allowing you to control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Word document).
PasteToLocation | Pastes the shape to the specified location on the page.
Print | Prints the contents of an object to the default printer.
PrintTile | Prints a single tile of a drawing page.
ResizeToFitContents | Resizes the page, or the master's page, to fit tightly around the shapes or master that are on it.
SetFormulas | Sets the formulas of one or more cells.
SetResults | Sets the results or formulas of one or more cells.
SetTheme | Sets the theme for the specified page.
SetThemeVariant | Sets the color, style, and optionally the embellishment of the variant of the theme applied to the specified page.
ShapeIDsToUniqueIDs | Returns an array of unique IDs of shapes on the page, as specified by their shape IDs.
SplitConnector | Splits the specified connector with the specified shape. Returns the new duplicated connector.
UniqueIDsToShapeIDs | Returns an array of shape IDs of shapes on the page, as specifed by their unique IDs.
VisualBoundingBox |


Page.AddGuide Method (Visio)

 Copy code hover
[image]

Page.AddGuide Method (Visio)
Send feedback

Published: July 16, 2012

Adds a guide to a drawing page.

Version Information

Version Added: Visio 2.0

Syntax

expression .AddGuide(Type, xPos, yPos)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | Integer | The type of guide to add.
xPos | Required | Double | The x-coordinate of a point on the guide.
yPos | Required | Double | The y-coordinate of a point on the guide.

Return Value

Shape

Remarks

The following constants declared by the Visio type library are valid values for guide types.

Constant | Value | Description
visPoint | 1 | Guide point
visHorz | 2 | Horizontal guide
visVert | 3 | Vertical guide

Example

The following macro shows how to add a horizontal guide to a page.

VBA Copy code Copy code

Public Sub AddGuide_Example()

 Dim vsoPages As Visio.Pages
 Dim vsoPage As Visio.Page
 Dim vsoShapes As Visio.Shapes
 Dim vsoShape As Visio.Shape
 Dim vsoPageHeightCell as Visio.Cell
 Dim intPageHeightIU as Integer

 'Get the Pages collection of the ThisDocument object.
 Set vsoPages = ThisDocument.Pages

 'Set the Page object to the first page of the Pages collection.
 Set vsoPage = vsoPages(1)

 'Get the Shapes collection of the vsoPage object.
 Set vsoShapes = vsoPage.Shapes

 'Get the page height in internal units.
 Set vsoPageHeightCell = vsoPage.PageSheet.CellsSRC( _
 visSectionObject, visRowPage, visPageHeight)
 intPageHeightIU = vsoPageHeightCell.ResultIU

 'Add a guide to the Shapes collection and set it
 'as the vsoShape object. The guide is a horizontal line
 'running through the middle of the page.
 Set vsoShape = vsoPage.AddGuide(visHorz,0,intPageHeightIU/2)

End Sub


Page.AutoConnectMany Method (Visio)

 Copy code hover
[image]

Page.AutoConnectMany Method (Visio)
Send feedback

Published: July 16, 2012

Automatically draws multiple connections in the specified directions between the specified shapes. Returns the number of shapes connected.

Version Information

Version Added: Visio 2010

Syntax

expression .AutoConnectMany(FromShapeIDs(), ToShapeIDs(), PlacementDirs(), [Connector])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
FromShapeIDs() | Required | Long | An array of identifers of the shapes from which to draw a connection.
ToShapeIDs() | Required | Long | An array of identifers of the shapes to which to draw a connection.
PlacementDirs() | Required | Long | An array of VisAutoConnectDir constants that represent the directions in which to draw the connections. See Remarks for possible values.
Connector | Optional | [UNKNOWN] | The connector to use. Can be a Master, MasterShortcut, Shape, or IDataObject object.

Return Value

Long

Remarks

For the PlacementDirs() parameter, pass an array of values from the VisAutoConnectDir enumeration to specify the connection directions (that is, where to locate the connected shapes with respect to the primary shapes). Possible values for PlacementDirs() are as follows.

Constant | Value | Description
visAutoConnectDirDown | 2 | Connect down.
visAutoConnectDirLeft | 3 | Connect to the left.
visAutoConnectDirNone | 0 | Connect without relocating the shapes.
visAutoConnectDirRight | 4 | Connect to the right
visAutoConnectDirUp | 1 | Connect up.

Calling the AutoConnectMany method is equivalent to calling the Shape.AutoConnect method multiple times.

You can include the same shape multiple times in each array you pass as a parameter. You cannot use the AutoConnectMany method to connect a shape to itself.

If a particular AutoConnectMany operation fails or is invalid, Microsoft Visio skips it and processes the next item in each of the parameter arrays. AutoConnectMany returns the total number of items successfully processed.

If the parameter arrays do not each contain the same number of values, Visio returns an Invalid Parameter error.

The optional Connector parameter value must be an object that references a one-dimensional routable shape. If you do not pass a value for Connector, Visio uses the default dynamic connector.

If you use the IDataObject interface to pass a selection of shapes for Connector, Visio uses only the first shape. If Connector is not a Visio object, Visio returns an Invalid Parameter error. If Connector is not a shape that matches the context of the method, Visio returns an Invalid Source error.


Page.AutoSizeDrawing Method (Visio)

 Copy code hover
[image]

Page.AutoSizeDrawing Method (Visio)
Send feedback

Published: July 16, 2012

Automatically resizes the drawing page by adding as many printer-paper-sized tiles as necessary to fit all shapes in the drawing onto the page.

Version Information

Version Added: Visio 2010

Syntax

expression .AutoSizeDrawing

expression An expression that returns a Page object.

Return Value

Nothing

Remarks

If you call the AutoSizeDrawing method when the Print zoom setting in the user interface (on the Print Setup tab of the Page Setup dialog box on the Design tab) is set to Fit to (a specified number of sheets across and down), Visio returns an error, indicating that it cannot automatically resize that page.


Page.AvoidPageBreaks Method (Visio)

 Copy code hover
[image]

Page.AvoidPageBreaks Method (Visio)
Send feedback

Published: July 16, 2012

Makes small adjustments to shapes to move them off page breaks.

Version Information

Version Added: Visio 2010

Syntax

expression .AvoidPageBreaks

expression A variable that represents a Page object.

Return Value

Nothing


Page.BoundingBox Method (Visio)

 Copy code hover
[image]

Page.BoundingBox Method (Visio)
Send feedback

Published: July 16, 2012

Returns a rectangle that tightly encloses the shapes of a page.

Version Information

Version Added: Visio 4.5

Syntax

expression .BoundingBox(Flags, lpr8Left, lpr8Bottom, lpr8Right, lpr8Top)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Required | Integer | Flags that influence the bounding box calculated for each shape that contributes to the resulting bounding box.
lpr8Left | Required | Double | Returns the x-coordinate of the left edge of the bounding box.
lpr8Bottom | Required | Double | Returns the y-coordinate of the bottom edge of the bounding box.
lpr8Right | Required | Double | Returns the x-coordinate of the right edge of the bounding box.
lpr8Top | Required | Double | Returns the y-coordinate of the top edge of the bounding box.

Return Value

Nothing

Remarks

For a Shape object, the BoundingBox method returns a rectangle that tightly encloses the shape and its subshapes.

For a Page, Master, or Selection object, the BoundingBox method returns a rectangle that tightly encloses the page's, master's, or selection's shapes and their subshapes.

If the BoundingBox method returns an error, or if it is asked to return the rectangle enclosing zero shapes, the rectangle returned is { left: 0, bottom: 0, right: -1, top: -1 }; otherwise, the rectangle returned has left less than or equal to (<=) right, and bottom less than or equal to (<=) top. The numbers returned are in internal units (inches).

The bounding rectangle returned for an individual shape depends on its Type property.

Constant | Description
visTypePage | Equivalent to Page.BoundingBox or Master.BoundingBox.
visTypeGroup | Rectangle that tightly encloses the group and its subshapes.
visTypeShape | Determined rectangle depends on flags. See the following table.
visTypeForeignObject | Determined rectangle depends on flags. See the following table.
visTypeGuide | Determined rectangle depends on flags. See the following table.

The method will raise an exception for object type visTypeDoc.

The Flags argument has several bits that control the bounding box retrieved for each shape. If more than one of the bits described in the following table is set, the rectangle determined for the shape covers all rectangles implied by the bits.

Flag | Value | Description
visBBoxUprightWH | &H1 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the shape's width-height box.If the shape is not rotated, its upright width-height box and its width-height box are the same. Paths in the shape's geometry need not and often do not lie entirely within the shape's width-height box.
visBBoxUprightText | &H2 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the shape's text.
visBBoxExtents | &H4 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the paths stroked by the shape's geometry.This may be larger or smaller than the shape's upright width-height box. The extents box determined for a shape of type visTypeForeignObject equals that shape's upright width-height box.
visBBoxIncludeHidden | &H10 | Includes hidden geometry.
visBBoxIgnoreVisible | &H20 | Ignores visible geometry.
visBBoxIncludeDataGraphics | &H10000 | Includes data-graphic callout shapes (and their sub-shapes) that are applied to the shapes on the page. Off by default.
visBBoxIncludeGuides | &H1000 | Includes extents for shapes of type visTypeguide. By default, the extents of shapes of type visTypeGuide are ignored.If you request guide extents, then only the x positions of vertical guides and the y positions of horizontal guides contribute to the rectangle that is returned. If any vertical guides are reported on, an infinite y extent is returned. If any horizontal guides are reported on, an infinite x extent is returned. If any rotated guides are reported on, infinite x and y extents are returned.
visBBoxDrawingCoords | &H2000 | Returns numbers in the drawing coordinate system of the page or master whose shapes are being considered. By default, the returned numbers are drawing units in the local coordinate system of the parent of the considered shapes.
visBBoxNoNonPrint | &H4000 | Ignores the extents of shapes that are nonprinting. A shape is nonprinting if the value of its NonPrinting cell is non-zero or it belongs only to nonprinting layers.

The extents rectangle is determined using the center of the shape's strokes; it does not take into account the width of the strokes. Nor does the rectangle include any area covered by shadows or line end markers. Microsoft Visio does not expose a means to determine a shape's "black bits" box, that is, the extents box adjusted to account for stroke widths, shadows, and line ends.

A shape may have control points or connection points that lie outside any of the bounding rectangles reported by the shape. You can determine the position of control points and connection points by querying results of the shape's cells.

Example

The following procedure prints the dimensions of the bounding box of the selected shape in the Immediate window. If more than one shape is selected in the active window, a message box indicating an error is displayed. In all cases, results are reported in the drawing units of the page or master to which the shape belongs. This means that if the shape is a subshape of a group, visBBoxDrawingCoords is passed as a flag to the BoundingBox method.

If the shape is a guide, the procedure passes visBBoxIncludeGuides to the BoundingBox method so that the shape will be considered to have extent. Three rectangles are reported for the shape:

  • visBBoxUprightWH: an upright box that encloses the shape's width-height box

  • visBBoxUprightText: an upright box that encloses the shape's text box

  • visBBoxExtents: an upright box that encloses the shape's paths

To run this macro, make sure exactly one shape is selected on the Visio drawing page.

VBA Copy code Copy code

Public Sub BoundingBox_Example()

 Dim vsoSelection As Visio.Selection
 Set vsoSelection = ActiveWindow.Selection
 vsoSelection.IterationMode = visSelModeSkipSub

 If vsoSelection.Count <> 1 Then
 MsgBox "BoundingBox_Example() expects exactly one selected shape."

 Else

 Dim vsoShape As Visio.Shape
 Set vsoShape = vsoSelection(1)
 Dim intFlags As Integer
 intFlags = 0

 If vsoShape.ContainingShape.Type = visTypeGroup Then

 intFlags = visBBoxDrawingCoords

 End If

 If vsoShape.Type = visTypeGuide Then

 intFlags = intFlags + visBBoxIncludeGuides

 End If

 Dim dblTop As Double
 Dim dblBottom As Double
 Dim dblLeft As Double
 Dim dblRight As Double

 vsoShape.BoundingBox intFlags + visBBoxUprightWH, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Upright WH "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 vsoShape.BoundingBox intFlags + visBBoxUprightText, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Upright text "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 vsoShape.BoundingBox intFlags + visBBoxExtents, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Bounding Box "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 End If

End Sub

The following macro uses the BoundingBox method and the ShapesOverlap() function to determine if one shape (vsoShape2) overlaps another (vsoShape1).

VBA Copy code Copy code
Public Sub OverlappingShapes_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim blsIsOverlapping As Boolean

 Set vsoShape1 = Application.ActiveWindow.Page.Drop(Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Square"), 3, 9)

 Set vsoShape2 = Application.ActiveWindow.Page.Drop(Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3, 8)

 blsIsOverlapping = ShapesOverlap(vsoShape2, vsoShape1)

 If blsIsOverlapping Then
 Debug.Print "Shapes overlap."
 Else
 Debug.Print "Shapes do not overlap."
 End If

End Sub

Private Function ShapesOverlap(vsoShape1 As IVShape, vsoShape2 As IVShape) As Boolean

 Dim dblLeft1 As Double
 Dim dblLeft2 As Double
 Dim dblBottom1 As Double
 Dim dblBottom2 As Double
 Dim dblRight1 As Double
 Dim dblRight2 As Double
 Dim dblTop1 As Double
 Dim dblTop2 As Double

 vsoShape1.BoundingBox Flags + visBBoxExtents, dblLeft1, dblBottom1, dblRight1, dblTop1
 vsoShape2.BoundingBox Flags + visBBoxExtents, dblLeft2, dblBottom2, dblRight2, dblTop2

 If ((dblLeft2 >= dblLeft1 And dblLeft2 <= dblRight1) Or _
 (dblRight2 >= dblLeft1 And dblRight2 <= dblRight1)) And _
 ((dblTop2 >= dblBottom1 And dblTop2 <= dblTop1) Or _
 (dblBottom2 >= dblBottom1 And dblBottom2 <= dblTop1)) Then
 ShapesOverlap = True
 Else
 ShapesOverlap = False
 End If

End Function


Page.CenterDrawing Method (Visio)

 Copy code hover
[image]

Page.CenterDrawing Method (Visio)
Send feedback

Published: July 16, 2012

Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .

Version Information

Version Added: Visio 4.0

Syntax

expression .CenterDrawing

expression A variable that represents a Page object.

Return Value

Nothing

Remarks

Centering shapes does not change their position relative to each other.


Page.CreateSelection Method (Visio)

 Copy code hover
[image]

Page.CreateSelection Method (Visio)
Send feedback

Published: July 16, 2012

Creates various types of Selection objects.

Version Information

Version Added: Visio 2003

Syntax

expression .CreateSelection(SelType, IterationMode, [Data])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
SelType | Required | VisSelectionTypes | The type of selection. See Remarks for possible values.
IterationMode | Optional | VisSelectMode | The selection mode used. See Remarks for possible values.
Data | Optional | Variant | The object type that corresponds to the SelType argument. See Remarks for possible values.

Return Value

Selection

Remarks

The CreateSelection method makes it possible to create complex selections programmatically. So instead of having to select all shapes on a page, for example, you can select only those on a given layer, or only those based on a certain master.

Calling the CreateSelection method with SelType equal to visSelTypeByType or visSelTypeByLayer is equivalent to selecting options in the Select byType dialog box (click Select in the Editing group on the Home tab, and then click Select by Type).

The SelType argument should be one of the following values, which are declared in VisSelectionTypes in the Visio type library.

Constant | Value | Description
visSelTypeAll | 1 | A selection that initially contains all shapes.
visSelTypeByDataGraphic | 6 | A selection that initially contains all shapes that have a given type of data graphic appled.
visSelTypeByLayer | 3 | A selection that initially contains all the shapes of a given layer.
visSelTypeByMaster | 5 | A selection that initially contains all the instantiated shapes of a given master.
visSelTypeByRole | 7 | A selection that initially contains all the shapes of a given role.
visSelTypeByType | 4 | A selection that initially contains all the shapes of a given type.
visSelTypeEmpty | 0 | A selection that initially contains no shapes.
visSelTypeSingle | 2 | A selection that initially contains one shape.

The optional IterationMode argument should be one of the following values, which are declared in VisSelectMode in the Visio type library. The default is visSelModeSkipSuper.

Constant | Value | Description
visSelModeOnlySub | &H0800 | Selection only reports subselected shapes.
visSelModeOnlySuper | &H0200 | Selection only reports superselected shapes.
visSelModeSkipSub | &H0400 | Selection does not report subselected shapes.
visSelModeSkipSuper | &H0100 | Selection does not report superselected shapes.

The optional Data argument should be an object that corresponds to the object type specified by SelType. For example, if you want to select all the masters of a certain type, Data should be of type Master. And if you want to select all the shapes on a certain layer, Data should be of type Layer.

When SelType is visSelTypeByRole, Data should be a member of the VisRoleSelectionTypes enumeration.

When the SelType argument is visSelTypeByType, possible Data values should be one of the following values, which are declared in VisTypeSelectionTypes in the Visio type library.

Constant | Value | Description
visTypeSelBitmap | 16 | A shape that is a bitmap.
visTypeSelGroup | 1 | A shape that contains other shapes.
visTypeSelGuide | 4 | A shape that is a guide.
visTypeSelInk | 32 | A shape that is ink.
visTypeSelMetafile | 8 | A shape that is a metafile.
visTypeSelOLE | 64 | A shape that is linked, embedded, or a control.
visTypeSelShape | 2 | A native Visio shape.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the CreateSelection method to select all shapes on a particular layer. Before running this macro, create two layers in your drawing, one named "a" and one named "b", and add shapes to both layers.

VBA Copy code Copy code
Public Sub CreateSelection_Layer_Example()

 Dim vsoLayer As Visio.Layer
 Dim vsoSelection As Visio.Selection

 Set vsoLayer = ActivePage.Layers.ItemU("a")
 Set vsoSelection = ActivePage.CreateSelection(visSelTypeByLayer, visSelModeSkipSuper, vsoLayer)

 Application.ActiveWindow.Selection = vsoSelection

End Sub

This VBA macro shows how to use the CreateSelection method to select a particular shape on the drawing page. Before running this macro, open the Basic Shapes stencil.

VBA Copy code Copy code
Public Sub CreateSelection_Page_Example()

 Dim vsoSelection As Visio.Selection
 Dim vsoShape As Visio.Shape

 Application.ActiveWindow.Page.Drop Application.Documents("BASIC_U.VSS").Masters.ItemU("Rectangle"), 2, 9
 Application.ActiveWindow.Page.Drop Application.Documents("BASIC_U.VSS").Masters.ItemU("Rectangle"), 5, 9
 Application.ActiveWindow.Page.Drop Application.Documents("BASIC_U.VSS").Masters.ItemU("Rectangle"), 2, 7

 Set vsoShape = ActivePage.Shapes(2)
 Set vsoSelection = ActivePage.CreateSelection(visSelTypeSingle, visSelModeSkipSuper, vsoShape)

 Application.ActiveWindow.Selection = vsoSelection

 Debug.Print vsoShape.Name

End Sub


Page.Delete Method (Visio)

 Copy code hover
[image]

Page.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes a Page object. Can also renumber remaining pages.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete(fRenumberPages)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
fRenumberPages | Required | Integer | 1 (True) to renumber remaining pages; otherwise, 0 (False).

Return Value

Nothing

Remarks

When fRenumberPages is non-zero, the remaining pages' default page names are renumbered after the page is deleted, otherwise, the pages retain their names.


Page.DrawArcByThreePoints Method (Visio)

 Copy code hover
[image]

Page.DrawArcByThreePoints Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path consists of an arc defined by the three points passed as parameters.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawArcByThreePoints(xBegin, yBegin, xEnd, yEnd, xControl, yControl)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
xBegin | Required | Double | The x-coordinate of the begin point of the arc.
yBegin | Required | Double | The y-coordinate of the begin point of the arc.
xEnd | Required | Double | The x-coordinate of the endpoint of the arc.
yEnd | Required | Double | The y-coordinate of the endpoint of the arc.
xControl | Required | Double | The x-coordinate of the control point of the arc.
yControl | Required | Double | The y-coordinate of the control point of the arc.

Return Value

Shape

Remarks

All points should be in internal drawing units with respect to the coordinate space of the master, page, or group where the shape is being drawn.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the DrawArcByThreePoints method to draw an arc on the drawing page.

VBA Copy code Copy code
Public Sub DrawArcByThreePoints_Example

 Dim vsoShape As Visio.Shape
 Set vsoShape = ActivePage.DrawArcByThreePoints(3, 3, 6, 8, 5, 5)

End Sub


Page.DrawBezier Method (Visio)

 Copy code hover
[image]

Page.DrawBezier Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path is defined by the supplied sequence of Bezier control points.

Version Information

Version Added: Visio 4.1

Syntax

expression .DrawBezier(xyArray(), degree, Flags)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
xyArray() | Required | Double | An array of alternating x and y values that define the Bezier control points for the new shape.
degree | Required | Integer | The degree of the Bezier curve.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Shape

Remarks

The xyArray() and degree parameters must meet the following conditions:

1 <= degree <= 9

The number of points must be k * degree + 1, where k is a positive integer. If the first point is called p0, for any integer m between 1 and k, p(m * degree) is assumed to be the last control point of a Bezier segment, as well as the first control point of the next.

The result is a composite curve that consists of k Bezier segments. The input points from xyArray() define the curve's control points. If you want a smooth curve, make sure the points p(n - 1), pn, and p(n + 1) are co-linear whenever n = m * degree with an integer m. The composite Bezier curve is represented in the application as a B-spline with integer knots of multiplicity = degree.

The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group where the shape is being drawn. The passed array should be a SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The Flags argument is a bitmask that specifies options for drawing the new shape. Its value should be zero (0) or visSpline1D (8).

If Flags is visSpline1D and the first and last points in xyArray() don't coincide, the DrawBezier method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.

If the first and last points in xyArray() do coincide, the DrawBezier method produces a filled shape.

Example

The following example shows how to draw a Bezier curve through five arbitrary points on the active page.

VBA Copy code Copy code

Public Sub DrawBezier_Example()

 Dim vsoShape As Visio.Shape
 Dim intCounter As Integer
 Dim adblXYPoints(1 To (5 * 2)) As Double

 For intCounter = 1 To 5

 'Set x-coordinates (array elements 1,3,5,7,9) to 1,2,3,4,5
 adblXYPoints((intCounter * 2) - 1) = intCounter

 'Set y-coordinates (array elements 2,4,6,8,10) to f(intCounter)
 adblXYPoints(intCounter * 2) = (intCounter * intCounter) - (7 * intCounter) + 15

 Next intCounter

 Set vsoShape = ActivePage.DrawBezier(adblXYPoints, 2, visSpline1D)

End Sub


Page.DrawCircularArc Method (Visio)

 Copy code hover
[image]

Page.DrawCircularArc Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape whose path consists of a circular arc defined by its center, radius, and start and end angles.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawCircularArc(xCenter, yCenter, Radius, StartAngle, EndAngle)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
xCenter | Required | Double | The x-coordinate of the center of the arc.
yCenter | Required | Double | The y-coordinate of the center of the arc.
Radius | Required | Double | The radius of the arc.
StartAngle | Optional | Double | The angle in radians with respect to the x-axis at which to start drawing the arc. The default is 0.
EndAngle | Optional | Double | The angle in radians with respect to the x-axis at which to end the arc. The default is pi (3.14592634898).

Return Value

Shape

Remarks

By default, DrawCircularArc draws a 180-degree arc on the drawing page.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the DrawCircularArc method to draw an arc on the drawing page.

VBA Copy code Copy code
Public Sub DrawCircularArc_Example

 Dim vsoShape As Visio.Shape
 Set vsoShape = ActivePage.DrawCircularArc(3, 3, 3)

End Sub


Page.DrawLine Method (Visio)

 Copy code hover
[image]

Page.DrawLine Method (Visio)
Send feedback

Published: July 16, 2012

Adds a line to the Shapes collection of a page.

Version Information

Version Added: Visio 2.0

Syntax

expression .DrawLine(xBegin, yBegin, xEnd, yEnd)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
xBegin | Required | Double | The x-coordinate of the line's begin point.
yBegin | Required | Double | The y-coordinate of the line's begin point.
xEnd | Required | Double | The x-coordinate of the line's endpoint.
yEnd | Required | Double | The y-coordinate of the line's endpoint.

Return Value

Shape

Remarks

Using the DrawLine method is equivalent to using the Line tool in Microsoft Visio. The arguments are in internal drawing units with respect to the coordinate space of the page, master, or group where the line is being placed.

Example

The following example shows how to draw a line shape on the active page.

VBA Copy code Copy code

Public Sub DrawLine_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawLine(5, 4, 7.5, 1)

End Sub


Page.DrawNURBS Method (Visio)

 Copy code hover
[image]

Page.DrawNURBS Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape whose path consists of a single NURBS (nonuniform rational B-spline) segment.

Version Information

Version Added: Visio 2000

Syntax

expression .DrawNURBS(degree, Flags, xyArray(), knots(), weights)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
degree | Required | Integer | The spline's degree; an integer between 1 and 25.
Flags | Required | Integer | Flags that influence how the shape is drawn.
xyArray() | Required | Double | An array of alternating x and y values that define the control points coordinates; use internal drawing units (inches).
knots() | Required | Double | An array of knots.
weights | Optional | Variant | An array of weights.

Return Value

Shape

Remarks

The DrawNURBS method creates a new shape whose path consists of a single NURBS segment as specified by the arguments.

The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group in which the new shape is being created. The xyArray, knots, and weights arrays should be of type SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The knots argument is unit-less. The sequence of knots should be non-decreasing. In other words, knots(i + 1) < knots(i) is not acceptable. knots(i + 1) = knots(i) is permitted, and then the value is repeated, but the following restrictions apply:

  • The first knot may not be repeated more than degree + 1 times.

  • The last knot may not be repeated.

  • Any knot between the first and last may not be repeated more than degree times.

  • If the first knot is repeated less than degree + 1 times, the spline is periodic.

  • The list of weights is optional. Its absence signals that the spline is non-rational. Weights are unit-less.

The following rules apply to the sizes of the lists. For a spline with n control points:

  • If the spline is periodic, n > 2. Otherwise, n > degree.

  • The size of xyArray is 2n.

  • The size of the weights array is n (if present).

  • The size of the knots array is n + 1.

The conventional non-periodic spline requires n + degree + 1 knots, but the application implies the repeated knots at the end. For example, the degree 2 knot list (0,0,0,2,5,8) is interpreted in the application as the conventional knot sequence (0,0,0,2,5,8,8,8).

The Flags parameter is a bitmask that specifies options for drawing the new shape. Its value should be either zero (0) or visSpline1D (8). If Flags is visSpline1D and if the first and last points in xyArray don't coincide, the DrawNURBS method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.

If the first and last points in xyArray do coincide, the DrawNURBS method produces a filled shape.


Page.DrawOval Method (Visio)

 Copy code hover
[image]

Page.DrawOval Method (Visio)
Send feedback

Published: July 16, 2012

Adds an oval (ellipse) to the Shapes collection of a page.

Version Information

Version Added: Visio 2.0

Syntax

expression .DrawOval(x1, y1, x2, y2)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
x1 | Required | Double | The x-coordinate of one corner of the ellipse's width-height box.
y1 | Required | Double | The y-coordinate of one corner of the ellipse's width-height box.
x2 | Required | Double | The x-coordinate of the other corner of the ellipse's width-height box.
y2 | Required | Double | The y-coordinate of the other corner of the ellipse's width-height box.

Return Value

Shape

Remarks

Using the DrawOval method is equivalent to using the Ellipse tool in the application. The arguments are in internal drawing units with respect to the coordinate space of the page, master, or group where the ellipse is being placed.

Example

The following example shows how to draw an oval (ellipse) on the active page.

VBA Copy code Copy code

Public Sub DrawOval_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawOval(1.5, 10.5, 7.5, 6.5)

End Sub


Page.DrawPolyline Method (Visio)

 Copy code hover
[image]

Page.DrawPolyline Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path is a polyline along a given set of points.

Version Information

Version Added: Visio 2000

Syntax

expression .DrawPolyline(xyArray(), Flags)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
xyArray() | Required | Double | An array of alternating x and y values that defines points in the new shape's path.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Shape

Remarks

The DrawPolyline method creates a new shape whose path consists of a sequence of line segments and whose endpoints match the points specified in xyArray. Calling the DrawPolyline method is equivalent to calling the DrawSpline method with a tolerance of zero (0) and a flag of visSplineAbrupt.

The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group in which the new shape is being created. The passed array should be a type SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The Flags argument is a bitmask that specifies options for drawing the new shape. Its value can include visPolyline1D (8) or visPolyarcs (256). If Flags includes:

  • visPolyline1D and if the first and last points in xyArray don't coincide, the DrawPolyline method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.

  • visPolyarcs, Microsoft Visio will produce a sequence of arcs rather than a sequence of line segments; xyArray should specify the initial x,y point of the sequence followed by x,y bow triples. Visio will produce a shape with EllipticalArcTo rows where the bow of the arc matches the specified value.

If the first and last points in xyArray coincide, the DrawPolyline method produces a filled shape.

Example

The following example shows how to draw two polyline shapes that have 2-D and 1-D behavior, respectively, on the active page.

VBA Copy code Copy code

Public Sub DrawPolyline_Example()

 Dim vsoShape As Visio.Shape
 Dim adblXYPoints(1 To 8) As Double
 Dim intCounter As Integer

 'Initialize array with coordinates.
 adblXYPoints(1) = 1
 adblXYPoints(2) = 1
 adblXYPoints(3) = 3
 adblXYPoints(4) = 3
 adblXYPoints(5) = 5
 adblXYPoints(6) = 1
 adblXYPoints(7) = 1
 adblXYPoints(8) = 2

 'Use the DrawPolyline method to draw a shape that has 2-D behavior.
 Set vsoShape = ActivePage.DrawPolyline(adblXYPoints, 0)

 'Increase the Y-coordinate of the array by 4 to separate
 'the next shape drawn from the first.
 For intCounter = 2 To UBound(adblXYPoints) Step 2
 adblXYPoints(intCounter) = adblXYPoints(intCounter) + 4
 Next intCounter

 'Use the DrawPolyline method to draw a shape that has 1-D behavior.
 Set vsoShape = ActivePage.DrawPolyline(adblXYPoints, visPolyline1D)

End Sub


Page.DrawQuarterArc Method (Visio)

 Copy code hover
[image]

Page.DrawQuarterArc Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path consists of an elliptical arc defined by the two points and the flag passed in as arguments.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawQuarterArc(xBegin, yBegin, xEnd, yEnd, SweepFlag)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
xBegin | Required | Double | The x-coordinate of the begin point of the arc.
yBegin | Required | Double | The y-coordinate of the begin point of the arc.
xEnd | Required | Double | The x-coordinate of the endpoint of the arc.
yEnd | Required | Double | The y-coordinate of the endpoint of the arc.
SweepFlag | Required | VisArcSweepFlags | The type of arc, concave or convex.

Return Value

Shape

Remarks

The begin and endpoints define the bounding rectangle of the arc, and the SweepFlag argument determines which of the two possible arcs within the bounding rectangle is drawn. The bounding rectangle is always aligned to the page coordinate system; that is, the x-axis of the ellipse is parallel to the x-axis of the page.

The following possible values for the SweepFlag argument are declared in VisArcSweepFlags in the Visio type library.

Constant | Value | Description
visArcSweepFlagConcave | 0 | Concave arc
visArcSweepFlagConvex | 1 | Convex arc

If SweepFlag is visArcSweepFlagConcave, the line joining the center of the ellipse to the arc sweeps through decreasing angles; if it is visArcSweepFlagConvex, it sweeps through increasing angles.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the DrawQuarterArc method to draw a concave arc on the drawing page.

VBA Copy code Copy code
Public Sub DrawQuarterArc_Example

 Dim vsoShape As Visio.Shape
 Set vsoShape = ActivePage.DrawQuarterArc(3, 3, 6, 8, visArcSweepFlagConcave)

End Sub


Page.DrawRectangle Method (Visio)

 Copy code hover
[image]

Page.DrawRectangle Method (Visio)
Send feedback

Published: July 16, 2012

Adds a rectangle to the Shapes collection of a page, master, or group.

Version Information

Version Added: Visio 2.0

Syntax

expression .DrawRectangle(x1, y1, x2, y2)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
x1 | Required | Double | The x-coordinate of one corner of the rectangle's width-height box.
y1 | Required | Double | The y-coordinate of one corner of the rectangle's width-height box.
x2 | Required | Double | The x-coordinate of the other corner of the rectangle's width-height box.
y2 | Required | Double | The y-coordinate of the other corner of the rectangle's width-height box.

Return Value

Shape

Remarks

Using the DrawRectangle method is equivalent to using the Rectangle tool in the application. The arguments are in internal drawing units with respect to the coordinate space of the page, master, or group where the rectangle is being placed.

Example

The following example shows how to draw a rectangle on the active page.

VBA Copy code Copy code

Public Sub DrawRectangle_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawRectangle(1, 4, 4, 1)

End Sub


Page.DrawSpline Method (Visio)

 Copy code hover
[image]

Page.DrawSpline Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape whose path follows a given sequence of points.

Version Information

Version Added: Visio 4.1

Syntax

expression .DrawSpline(xyArray(), Tolerance, Flags)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
xyArray() | Required | Double | An array of alternating x and y values that define points in the new shape's path.
Tolerance | Required | Double | How closely the path of the new shape must approximate the given points.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Shape

Remarks

The DrawSpline method creates a new shape whose path falls within the given tolerance of the given array of points. To fit the given points exactly, specify a tolerance of zero (0). Typically, the DrawSpline method fits spline segments through the points, but it sometimes produces line or circular arc segments in the new shape.

The control points and tolerance are in internal drawing units (inches) with respect to the coordinate space of the page, master, or group in which the new shape is being created. The passed array should be a SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The error from the points to the path of the resulting shape is roughly within tolerance. When the number of points is large, the actual error may sometimes exceed the prescribed tolerance.

The Flags argument is a bitmask that specifies options for drawing the new shape. Its value should be zero or a combination of one or more of the following values.

Constant | Value
visSplinePeriodic | 1(&H1)
visSplineDoCircles | 2(&H2)
visSplineAbrupt | 4(&H4)
visSpline1D | 8(&H8)

If Flags includes visSplinePeriodic and the following conditions are met, the application attempts to draw a periodic spline. Otherwise, Visio draws a non-periodic spline:

  • The last point must be a repetition of the first one.

  • If the flag visSplineAbrupt is included as well, the entire closed path outlined by the points must be free of abrupt changes of direction and curvature.

If Flags includes visSplineDoCircles, Microsoft Visio recognizes circular segments in the given array of points and generates circular arcs instead of spline rows for those segments.

If Flags includes visSplineAbrupt, Visio breaks the spline whenever it detects an abrupt change of direction or curvature in the point's trail. An abrupt change of direction is defined by three consecutive points A, B, C in the list, for which the distance between B and the line segment AC is more than twice the tolerance. The application also considers point B to be an abrupt change if one of the segments AB or BC is more than twice as long as the other. At a point where an abrupt change is detected, the application ends the current piece (line, arc, or spline) and starts a fresh one.

If Flags includes visSpline1D and the first and last points in xyArray() don't coincide, the DrawSpline method produces a shape that has one-dimensional (1-D) behavior, otherwise, it produces a shape that has two-dimensional (2-D) behavior.

If the first and last points in xyArray() do coincide, the DrawSpline method produces a filled shape.

Example

The following example shows how to draw a periodic spline through five arbitrary points, requiring that the spline approach within 0.25 (drawing) inches of each point. It allows Visio to start new segments in the path of the new shape at points considered abrupt.

VBA Copy code Copy code

Public Sub DrawSpline_Example()

 Dim vsoShape As Visio.Shape
 Dim intCounter As Integer
 Dim adblXYPoints(1 To (5 * 2)) As Double

 For intCounter = 1 To 5

 'Set x components (array elements 1,3,5,7,9) to 1,2,3,4,5
 adblXYPoints((intCounter * 2) - 1) = intCounter

 'Set y components (array elements 2,4,6,8,10) to f(i)
 adblXYPoints(intCounter * 2) = (intCounter * intCounter) - (7 * intCounter) + 15
 Next intCounter

 Set vsoShape = ActivePage.DrawSpline(adblXYPoints, 0.25, visSplineAbrupt)

End Sub


Page.Drop Method (Visio)

 Copy code hover
[image]

Page.Drop Method (Visio)
Send feedback

Published: July 16, 2012

Creates one or more new Shape objects by dropping an object onto a receiving object such as a master, drawing page, shape, or group.

Version Information

Version Added: Visio 2.0

Syntax

expression .Drop(ObjectToDrop, xPos, yPos)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | [UNKNOWN] | The object or selection to drop. While this is typically a Visio object such as a Master, Shape, or Selection object, it can be any OLE object that provides an IDataObject interface.
xPos | Required | Double | The x-coordinate at which to place the center of the shape's width or PinX.
yPos | Required | Double | The y-coordinate at which to place the center of the shape's height or PinY.

Return Value

Shape

Remarks

Using the Drop method is similar to moving a shape with the mouse. The object dropped (ObjectToDrop) can be a master or a shape on the drawing page.

To add a shape to a group or on a drawing page, apply the Drop method to a Shape or Page object, respectively. The center of the shape's width-height box is positioned at the specified coordinates, and a Shape object that represents the shape that is created is returned. When applying this method to a Shape object, make sure that the Shape object represents a group.

If ObjectToDrop is a Master, the pin of the master is dropped at the specified coordinates. A master's pin is often, but not necessarily, at its center of rotation.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVPage.Drop(object, double, double)

Example

The following example shows how to use the Drop method to drop shapes onto Page and Shape objects.

VBA Copy code Copy code

Public Sub Drop_Example()

    Dim vsoShape1 As Visio.Shape
    Dim vsoShape2 As Visio.Shape
    Dim vsoShape3 As Visio.Shape
    Dim vsoGroupShape As Visio.Shape
    Dim vsoSubShape As Visio.Shape
    Dim vsoSelection As Visio.Selection

    Set vsoShape1 = ActivePage.DrawRectangle(1, 2, 2, 1)
    Set vsoShape2 = ActivePage.DrawRectangle(1, 4, 2, 3)

    'Drop a shape on the page.
    Set vsoShape3 = ActivePage.Drop(vsoShape1, 3.5, 3.5)

    'Make sure only one shape is selected to start.
    Set vsoSelection = ActiveWindow.Selection
    vsoSelection.Select vsoShape1, visDeselectAll + visSelect
    vsoSelection.Select vsoShape2, visSelect

    'Create a group shape.
    Set vsoGroupShape = vsoSelection.Group

    'Drop a shape on the group shape to create a new subshape.
    Set vsoSubShape = vsoGroupShape.Drop(vsoShape3, 1, 2)

End Sub


Page.DropCallout Method (Visio)

 Copy code hover
[image]

Page.DropCallout Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new callout Shape object on the page near the specified target shape, and associates the callout with the target shape. Returns the callout shape.

Version Information

Version Added: Visio 2010

Syntax

expression .DropCallout(ObjectToDrop, TargetShape)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | [UNKNOWN] | The callout to add to the page. Can be a Master, MasterShortcut, Shape, or IDataObject object.
TargetShape | Required | Shape | The existing shape with which to associate the callout.

Return Value

Shape

Remarks

If the ObjectToDrop parameter is not a Microsoft Visio object, Visio returns an Invalid Parameter error. If the value you pass is a shape that does not match the context of the method, Visio returns an Invalid Source error.

If the TargetShape paremeter is null, Visio places the callout shape at the center of the page and does not associate it with any target shapes. If the specified target shapes are not top-level members of the page, Visio returns an Invalid Parameter error.

The DropCallout method corresponds to the Insert Callout command in the Visio user interface. (On the Insert tab, click Callout.)

Example

The following Visual Basic for Applications (VBA) example shows how to use the DropCallout method to add a callout to the active page and associate it with a specific shape.

VBA Copy code Copy code
Dim vsoDocument As Visio.Document
Set vsoDocument = Application.Documents.OpenEx(Application.GetBuiltInStencilFile(visBuiltInStencilCallouts, visMSUS), visOpenHidden)
Application.ActivePage.DropCallout vsoDocument.Masters.ItemU("Text callout"), vsoTargetShape
vsoDocument.Close


Page.DropConnected Method (Visio)

 Copy code hover
[image]

Page.DropConnected Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new Shape object on the page, places the new shape relative to the specified existing target shape, and adds a connector from the existing shape to the new shape. Returns the newly created shape.

Version Information

Version Added: Visio 2010

Syntax

expression .DropConnected(ObjectToDrop, TargetShape, PlacementDir, [Connector])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | [UNKNOWN] | The shape to add to the page. Can be a Master, MasterShortcut, Shape, or an IDataObject object.
TargetShape | Required | Shape | The existing shape from which to align, space, and connect.
PlacementDir | Required | VisAutoConnectDir | The direction from TargetShape in which to place ObjectToDrop.
Connector | Optional | [UNKNOWN] | The connector to use. Can be a Master, MasterShortcut, Shape, or an IDataObject object.

Return Value

Shape

Remarks

The ObjectToDrop parameter must be an object that references a two-dimensional (2-D) shape. If you pass a selection of shapes represented by an IDataObject object, Visio uses only the first of those shapes. If ObjectToDrop is not a valid Visio object, Visio returns an Invalid Parameter error. If ObjectToDrop is not a shape that matches the context of the method, Visio returns an Invalid Source error.

The TargetShape parameter must be a 2-D top-level shape on the page. If TargetShape is invalid, Visio returns an Invalid Source error.

The PlacementDir parameter value must be one of the VisAutoConnectDir constants. If you pass visAutoConnectDirNone for PlacementDir, Visio places the shape in a default location (0,0) and then connects it; the shape is not placed in relation to the target.

The Connector parameter must be an object that references a one-dimensional (1-D) routable shape. If you pass a selection of shapes represented by an IDataObject object, Visio uses only the first of those shapes. If Connector is not a valid Visio object, Visio returns an Invalid Parameter error. If Connector is not a shape that matches the context of the method, Visio returns an Invalid Source error.


Page.DropContainer Method (Visio)

 Copy code hover
[image]

Page.DropContainer Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new container Shape object on the page, places the container around the specified target shapes, and adds the target shapes to the container. Returns the container shape.

Version Information

Version Added: Visio 2010

Syntax

expression .DropContainer(ObjectToDrop, TargetShapes)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | [UNKNOWN] | The container shape to add to the page. Can be a Master, MasterShortcut, Shape, or IDataObject object.
TargetShapes | Required | [UNKNOWN] | The shapes that the container should contain. Can be a Shape or a Selection object. The shapes or selection must already be on the page.

Return Value

Shape

Remarks

To pass a Master object for the ObjectToDrop parameter, use the Documents.OpenEx method and the Application.GetBuiltInStencilFile method, passing it visBuiltInStencilContainers, to open the hidden, built-in container stencil. Then use the Masters.ItemU property to get the particular container that you want from the stencil.

An IDataObject that you pass for ObjectToDrop must be provided by Microsoft Visio and must be in the same process space as Visio.

If ObjectToDrop is not a Visio object, or if it is not a container, Visio returns an Invalid Parameter error. If the value you pass is a shape that does not match the context of the method, Visio returns an Invalid Source error.

If the TargetShapes parameter is Nothing, Visio places the container shape at the center of the page, devoid of any target shapes. If the specified target shapes are not top-level members of the page, Visio returns an Invalid Parameter error.

The DropContainer method corresponds to the Insert Container command in the Visio user interface. (On the Insert tab, click Container.)

Example

The following Visual Basic for Applications (VBA) example shows how to use the DropContainer method to add a container from the hidden, built-in container stencil to the active page to contain the selected shape or shapes. Before running this macro, be sure that there is a selected shape (or a selection of shapes) on the active page.

VBA Copy code Copy code
Public Sub DropContainer_Example()

    Dim vsoDocument As Visio.Document
    Set vsoDocument = Application.Documents.OpenEx(Application.GetBuiltInStencilFile(visBuiltInStencilContainers, visMSUS), visOpenHidden)
    Application.ActivePage.DropContainer vsoDocument.Masters.ItemU("Container 1"), Application.ActiveWindow.Selection
    vsoDocument.Close

End Sub


Page.DropIntoList Method (Visio)

 Copy code hover
[image]

Page.DropIntoList Method (Visio)
Send feedback

Published: July 16, 2012

Drops the specified object into the specified list at the specified position. Returns the newly dropped shape.

Version Information

Version Added: Visio 2010

Syntax

expression .DropIntoList(ObjectToDrop, TargetList, lPosition)

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | IUnknown | The source of the shape to drop into the list. Can be a Master, Selection, Shape, or IDataObject object. See Remarks for more information.
TargetList | Required | Shape | The list into which to drop ObjectToDrop.
lPosition | Required | Long | The position in the 1-based list to add the shape.

Return Value

Shape

Remarks

If ObjectToDrop is a Selection object, the selection can contain only a single shape.

If ObjectToDrop is an IDataObject, it must be associated with a local Microsoft Visio object that is in the same instance as the page on which it is being dropped.

Visio returns an Invalid Target error if ObjectToDrop does not match the category requirements of the list or the container. Shapes can be assigned categories, and containers can have required and excluded categories.

Categories are user-defined strings that you can use to categorize shapes and, thereby, to restrict membership in a container. You can define categories in the User.msvShapeCategories cell in the ShapeSheet for a shape. You can define multiple categories for a shape by separating the categories with semicolons.

If ObjectToDrop is not a Microsoft Visio object, or if it does not contain top-level shapes on the page, Microsoft Visio returns an Invalid Parameter error.

If the ContainerProperties.LockMembership property of the list is True, Visio returns a Disabled error.

Example

The following Visual Basic for Applications (VBA) example shows how to use the DropIntoList method to add a new shape to an existing list on the active page, in the first position in the list.

VBA Copy code Copy code
Application.ActivePage.DropIntoList vsoMaster, vsoListShape, 1


Page.DropLegend Method (Visio)

 Copy code hover
[image]

Page.DropLegend Method (Visio)
Send feedback

Published: July 16, 2012

Inserts a data graphics legend on a Microsoft Visio drawing page. Returns the list shape instance specified in the OuterList parameter.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2010

Syntax

expression .DropLegend(OuterList, InnerList, populateFlags)

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
OuterList | Required | [UNKNOWN] | A Master or MasterShortcut object that represents the legend object. Corresponds to the outermost list shape.
InnerContainer | Required | [UNKNOWN] | A Master or MasterShortcut object that represents the legend object. Corresponds to the inner field container shape used within the legend for each data-graphic field.
populateFlags | Required | VisLegendFlags | A flag that specifies whether Visio should populate the legend.

Return Value

Shape

Remarks

The value of the populateFlags parameter must be one of the following VisLegendFlags constants.

Constant | Value | Description
visLegendPopulate | 0 | Insert the legend and populate it.
visLegendNoContents | 1 | Insert the legend but do not populate it.

If you pass visLegendPopulate for the populateFlags parameter, Visio inserts the legend and populates it with eligible data-graphic items in use on the specified drawing page. If no such items exist, Visio returns the error EU_API_NOOP, "Operation succeeded but no action taken."

If you pass visLegendNoContents for the populateFlags parameter, Visio inserts a legend that consists of the outer list shape as well as a single inner container shape, which contains an inner list shape but has no heading text.


Page.DropLinked Method (Visio)

 Copy code hover
[image]

Page.DropLinked Method (Visio)
Send feedback

Published: July 16, 2012

Returns a new shape on the drawing page linked to data in a data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DropLinked(ObjectToDrop, x, y, DataRecordsetID, DataRowID, ApplyDataGraphicAfterLink)

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | [UNKNOWN] | The object to drop. While this is typically a Visio object such as a Master, Shape, or Selection object; it can be any OLE object that provides an IDataObject interface.
x | Required | Double | The x-coordinate at which to place the center of the shape's width or PinX.
y | Required | Double | The y-coordinate at which to place the center of the shape's height or PinY.
DataRecordsetID | Required | Long | The ID of the data recordset that contains the data to link to.
DataRowID | Required | Long | The ID of the data row that contains the data to link to.
ApplyDataGraphicAfterLink | Required | Boolean | Whether to apply the current data graphic to the linked shape. The default is not to apply a data graphic. See Remarks for more information.

Return Value

Shape

Remarks

When you want to create shapes already linked to data on a drawing page that either does not contain any shapes or contains shapes other than the ones you want to link, you can use the Page.DropLinked and Page.DropManyLinkedU methods to create one or more additional shapes already linked to data. These methods resemble the existing Page.Drop and Page.DropManyU methods in that they create additional shapes at a specified location on the page; but in addition, they create links between the new shapes and specified data rows in a specified data recordset.

When the object you pass for the ObjectToDrop parameter is a shape, the center of the resulting shape's width-height box is positioned at the specified coordinates, and a Shape object that represents the shape that is created is returned.

If ObjectToDrop is a Master, the pin of the master is positioned at the specified coordinates. A master's pin is often, but not necessarily, at its center of rotation.

If you pass True for the optional ApplyDataGraphicsAfterLink parameter, Visio applies the data graphic most recently applied to any other shape in the current document.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the DropLinked method to create a shape on the active drawing page, centered at page coordinates (2, 2), and linked to a data row in the data recordset most recently added to the active document.

The shape passed to the DropLinked method is a simple rectangle from the Basic Shapes (US units) stencil. Before running this macro, use the DataRecordsets.Add method or another means to add at least one data recordset to the DataRecordsets collection, and make sure that the Basic Shapes (US units) stencil is open in the Visio drawing window. In this example, the ID of the data row is set to 1; before running the code, ensure that a row with that ID exists, or change the ID value in the code.

VBA Copy code Copy code
Public Sub DropLinked_Example()

    Dim vsoShape As Visio.Shape
    Dim vsoMaster As Visio.Master
    Dim dblX As Double
    Dim dblY As Double
    Dim lngDataRowID As Long
    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intRecordesetCount As Integer

    intRecordsetCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intRecordsetCount)

    Set vsoMaster = Visio.Documents("Basic_U.VSS").Masters("Rectangle")
    dblX = 2
    dblY = 2
    lngDataRowID = 1

    Set vsoShape = ActivePage.DropLinked(vsoMaster, dblX, dblY, vsoDataRecordset.ID, lngDataRowID, True)

End Sub


Page.DropMany Method (Visio)

 Copy code hover
[image]

Page.DropMany Method (Visio)
Send feedback

Published: July 16, 2012

Creates one or more new Shape objects on a page. It returns an array of the IDs of the Shape objects it produces.

Version Information

Version Added: Visio 4.5

Syntax

expression .DropMany(ObjectsToInstance(), xyArray(), IDArray())

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectsToInstance() | Required | Variant | Identifies masters or other objects from which to make shapes.
xyArray() | Required | Double | An array of alternating x and y values specifying the positions for the new shapes.
IDArray() | Required | Integer | Out parameter. An array that returns the IDs of the created shapes.

Return Value

Integer

Remarks

Using the DropMany method is like using the Page, Master, or Shape object's Drop method, except you can use the DropMany method to create many new Shape objects at once, rather than one per method call. The DropMany method creates new Shape objects on the page, in the master, or in the group shape to which it is applied (this shape is called the "target object" in the following discussion).

You can identify which master to drop by passing the DropMany method a Master object or the master's index or the master's name. When you pass an object, DropMany isn't constrained to just dropping a master from the document stencil of the document onto which it is being dropped. The object can be a master from another document or another type of object.

Passing integers (master indices) or strings (master names) to DropMany is faster than passing objects, but integers or strings can identify only masters in the document stencil of the document onto which it is being dropped. Hence your program has to somehow get the masters in question into the document stencil in the first place, provided they weren't there already.

ObjectsToInstance() should be a one-dimensional array of n >= 1 variants. Its entries identify objects from which you want to make new Shape objects. An entry often refers to a Microsoft Visio application Master object. It might also refer to a Visio application Shape object, Selection object, or even an object from another application. The application doesn't care what the lower and upper array bounds of the ObjectsToInstance() entries are. Call these vlb and vub, respectively.

  • If ObjectsToInstance(i) is a reference to an OLE object that provides an IDataObject interface (in Microsoft Visual Basic for Applications, a reference to a selection, shape, master, guide, or OLE object), the object it is referencing is instanced. This is essentially equivalent to calling Drop(ObjectsToInstance(i),x,y).

  • If ObjectsToInstance(i) is the integer j, an instance of the Master object in the document stencil of the target object's document whose 1-based index is j is made. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to be triggered.

  • If ObjectsToInstance(i) is the string s (or a reference to the string s), an instance of the Master object with name s in the document stencil of the target object's document is made; s can equal either the Master object's UniqueID or Name property. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to be triggered.

  • For vlb < i <= vub, if ObjectsToInstance(i) is empty (Nothing or uninitialized in Microsoft Visual Basic), entry i will cause ObjectsToInstance(j) to be instanced again, where j is the largest value < i such that ObjectsToInstance(j) isn't empty. If you want to make n instances of the same thing, only ObjectsToInstance(vlb) needs to be provided.

The xyArray() argument should be a one-dimensional array of 2m doubles with lower bound xylb and upper bound xyub, where m >= n. The values in the array tell the DropMany method where to position the Shape objects it produces. ObjectsToInstance(vlb + ( i - 1)) is dropped at (xy[(i - 1)2 + xylb],xy[(i - 1)2 + xylb + 1]) for 1 <= i <=n.

Note that m > n is allowed. For n < i <= m, the i'th thing instanced is the same thing as the n'th thing instanced. Thus to make m >= 1 instances of the same thing, you can pass an ObjectsToInstance() array with one entry and an m entry xyArray() array.

If the entity being instanced is a master, the pin of the new Shape object is positioned at the given xy. Otherwise, the center of the Shape objects is positioned at the given xy.

The value returned by the DropMany method is the number of xy entries in xyArray() that the DropMany method successfully processed. If all entries were processed successfully, m is returned. If some entries are successfully processed prior to an error occurring, the produced Shape objects are not deleted and this raises an exception but still returns a positive value.

Presuming all mxy entries are processed correctly, the number of new Shape objects produced by the DropMany method is usually equal to m. In rare cases (for example, if a Selection object gets instanced), more than m Shape objects may be produced. The caller can determine the number of produced Shape objects by comparing the number of shapes in the target object before and after the DropMany method is executed. The caller can assert the new Shape objects are those with the highest indices in the target object's Shapes collection.

If the DropMany method returns zero (0), IDArray returns null (Nothing). Otherwise, it returns a one-dimensional array of m integers indexed from 0 to m - 1. IDArray() is an out parameter that is allocated by the DropMany method and ownership is passed to the program that called the DropMany method. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.)

If IDArray returns non-null (not Nothing), IDArray(i - 1), 1 <= i <= intReturned, returns the ID of the Shape object produced by the i'th xyArray() entry, provided the i'th xyArray() entry produced exactly one Shape object. If the i'th xyArray() entry produced multiple Shape objects, -1 is returned in the entry. All entries i, intReturned <= i < m, return -1.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the DropMany method to drop more than one shape when you are using local names to identify the shapes. Use the DropManyU method to drop more than one shape when you are using universal names to identify the shapes.

Example

The following example shows how to use the DropMany method. It drops one instance of every master in the document stencil of the macro's Document object onto Page1 of the macro's Document object. Before running this macro, make sure there is at least one master in the document stencil.

VBA Copy code Copy code

Public Sub DropMany_Example()

 On Error GoTo HandleError

 Dim vsoMasters As Visio.Masters
 Dim intMasterCount As Integer
 Set vsoMasters = ThisDocument.Masters
 intMasterCount = vsoMasters.Count

 ReDim varObjectsToInstance(1 To intMasterCount) As Variant
 ReDim adblXYArray(1 To intMasterCount * 2) As Double
 Dim intCounter As Integer
 For intCounter = 1 To intMasterCount

 'Pass name of object to drop to DropMany.
 varObjectsToInstance(intCounter) = vsoMasters.Item(intCounter).Name

 'Set x components of where to drop to 2,4,6,2,4,6,2,4,6,...
 adblXYArray (intCounter * 2 - 1) = (((intCounter - 1) Mod 3) + 1) * 2

 'Set y components to 2,2,2,4,4,4,6,6,6,...
 adblXYArray (intCounter * 2) = Int((intCounter + 2) / 3) * 2

 Next intCounter

 Dim aintIDArray() As Integer
 Dim intProcessed As Integer

 intProcessed = ThisDocument.Pages(1).DropMany(varObjectsToInstance, _
 adblXYArray, aintIDArray)
 Debug.Print intProcessed

 For intCounter = LBound(aintIDArray) To UBound(aintIDArray)
 Debug.Print intCounter; aintIDArray(intCounter)
 Next intCounter

 Exit Sub

 HandleError:
 MsgBox "Error"

 Exit Sub

End Sub


Page.DropManyLinkedU Method (Visio)

 Copy code hover
[image]

Page.DropManyLinkedU Method (Visio)
Send feedback

Published: July 16, 2012

Creates multiple new shapes on the drawing page that are linked to multiple data rows in a data recordset. Returns the number of shape instances created and an array of IDs of those shapes.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DropManyLinkedU(ObjectsToInstance(), XYs(), DataRecordsetID, DataRowIDs(), ApplyDataGraphicAfterLink, ShapeIDs())

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectsToInstance() | Required | Variant | An array of type Variant of objects to create instances of.
XYs() | Required | Double | An array of type Double
DataRecordsetID | Required | Long | The ID of the data recordset containing the data rows to link to.
DataRowIDs() | Required | Long | An array of type Long of IDs of the data rows containing the data to link to.
ApplyDataGraphicAfterLink | Required | Boolean | Whether to apply the current data graphic to the linked shapes. See Remarks for more information.
ShapeIDs() | Required | Long | Out parameter. An array of type Long of shapes created and linked to.

Return Value

Long

Remarks

When you want to create shapes already linked to data on a drawing page that either does not contain any shapes or contains shapes other than the ones you want to link, you can use the Page.DropLinked and Page.DropManyLinkedU methods to create one or more additional shapes already linked to data. These methods resemble the existing Page.Drop and Page.DropManyU methods in that they create additional shapes at a specified location on the page; but in addition, they create links between the new shapes and specified data rows in a specified data recordset.

For the ObjectsToInstance() parameter, pass an array of objects to instance into shapes linked to data. While these objects are typically Visio objects such as Master, Shape, or Selection objects, they can be any OLE objects that provide an IDataObject interface.

For the XYs() parameter, pass an array of type Double. Each consecutive pair of array-index-position values should correspond to the x- and y- page coordinates where you want the instance of the object in the corresponding positon in the ObjectsToInstance() array to be positioned. For example, if you want the instance of the object in the first array index position in ObjectsToInstance() to be positioned at page coordinate (2,4), place the value 2 in the first array index position in XYs(), and place the value 4 in the second array index positon in that array, and so on for the rest of the objects and coordinates.

When an object you pass in the ObjectsToInstance() array is a shape, the center of the shape's width-height box is positioned at the coordinates you specify in XYs().

When an object you pass in the ObjectsToInstance() array is a master, the pin of the master is positioned at the coordinates you specify in XYs(). A master's pin is often, but not necessarily, at its center of rotation.

For the DataRowIDs() parameter, pass an array of Long values that represent the IDs of the data rows in the data recordset that you want to link to the shape instances created from the objects in the corresponding array index positions in the ObjectsToInstance() array.

For the ShapeIDs() parameter, pass an empty, dimensionless array of type Long. The method will return the array filled with the IDs of the newly created and linked shapes.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name.

Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions of Visio, universal names were not visible in the user interface.) As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the DropManyLinkedU method to drop more than one shape linked to data when you are using universal names to identify the shapes.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the DropManyLinkedU method to create several shapes on the active drawing page, centered at specified coordinates, and linked to a data rows in the data recordset most recently added to the active document. It prints the number of shapes created and their ID numbers to the Immediate window.

The shapes passed to the DropManyLinkedU method are simple forms from the Basic Shapes (US units) stencil. Before running this macro, use the DataRecordsets.Add method or another means to add at least one data recordset to the DataRecordsets collection, and make sure that the Basic Shapes (US units) stencil is open in the Visio drawing window.

VBA Copy code Copy code
Sub DropManyLinkedU_Example()

    Dim avarObjects(0 To 2) As Variant
    Dim adblXYs(0 To 5) As Double
    Dim alngDataRowIDs(0 To 2) As Long
    Dim alngShapeIDs() As Long
    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intRecordesetCount As Integer
    Dim lngReturned As Long
    Dim intCounter As Integer

    intRecordsetCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intRecordsetCount)

    Set avarObjects(0) = Visio.Documents("Basic_U.VSS").Masters("Rectangle")
    Set avarObjects(1) = Visio.Documents("Basic_U.VSS").Masters("Triangle")
    Set avarObjects(2) = Visio.Documents("Basic_U.VSS").Masters("Circle")

    adblXYs(0) = 2
    adblXYs(1) = 2
    adblXYs(2) = 4
    adblXYs(3) = 4
    adblXYs(4) = 6
    adblXYs(5) = 6

    alngDataRowIDs(0) = 1
    alngDataRowIDs(1) = 2
    alngDataRowIDs(2) = 3

    lngReturned = ActivePage.DropManyLinkedU(avarObjects, adblXYs, vsoDataRecordset.ID, alngDataRowIDs, True, alngShapeIDs)
    Debug.Print lngReturned

    For intCounter = 0 To lngReturned - 1
        Debug.Print alngShapeIDs(intCounter)
    Next

End Sub


Page.DropManyU Method (Visio)

 Copy code hover
[image]

Page.DropManyU Method (Visio)
Send feedback

Published: July 16, 2012

Creates one or more new Shape objects on a page, in a master, or in a group. It returns an array of the IDs of the Shape objects it produces.

Version Information

Version Added: Visio 4.5

Syntax

expression .DropManyU(ObjectsToInstance(), xyArray(), IDArray())

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectsToInstance() | Required | Variant | Identifies masters or other objects from which to make shapes by their universal names.
xyArray() | Required | Double | An array of alternating x and y values that specify the positions for the new shapes.
IDArray() | Required | Integer | Out parameter. An array that returns the IDs of the created shapes.

Return Value

Integer

Remarks

Using the DropManyU method is like using the Page, Master, or Shape object's Drop method, except you can use the DropManyU method to create many new Shape objects at once, rather than one per method call. The DropManyU method creates new Shape objects on the page, in the master, or in the group shape to which it is applied (this shape is called the "target object" in the following discussion).

You can identify which master to drop by passing the DropManyU method a Master object or the master's index or the master's name. When you pass an object, DropManyU isn't constrained to just dropping a master from the document stencil of the document onto which it is being dropped. The object can be a master from another document or another type of object.

Passing integers (master indices) or strings (master names) to DropManyU is faster than passing objects, but integers or strings can identify only masters in the document stencil of the document onto which it is being dropped. Hence your program has to somehow get the masters in question into the document stencil in the first place, provided they weren't there already.

ObjectsToInstance() should be a one-dimensional array of n >= 1 variants. Its entries identify objects from which you want to make new Shape objects. An entry often refers to a Microsoft Visio application Master object. It might also refer to a Visio application Shape object, Selection object, or even an object from another application. The application doesn't care what the lower and upper array bounds of the ObjectsToInstance() entries are. Call these vlb and vub, respectively.

  • If ObjectsToInstance(i) is the integer j, an instance of the Master object in the document stencil of the target object's document whose 1-based index is j is made. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to trigger.

  • If ObjectsToInstance(i) is the string s (or a reference to the string s), an instance of the Master object with name s in the document stencil of the target object's document is made; s can equal either the Master object's UniqueID or NameU property. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to be triggered.

  • For vlb < i <= vub, if ObjectsToInstance(i) is empty (Nothing or uninitialized in Microsoft Visual Basic), entry i will cause ObjectsToInstance(j) to be instanced again, where j is the largest value < i such that ObjectsToInstance(j) isn't empty. If you want to make n instances of the same thing, only ObjectsToInstance(vlb) needs to be provided.

The xyArray() parameter should be a one-dimensional array of 2m doubles with lower bound xylb and upper bound xyub, where m >= n. The values in the array tell the DropManyU method where to position the Shape objects it produces. ObjectsToInstance()(vlb + ( i - 1)) is dropped at (xy[(i - 1)2 + xylb],xy[(i - 1)2 + xylb + 1]) for 1 <= i <=n.

Note that m > n is allowed. For n < i <= m, the i'th thing instanced is the same thing as the n'th thing instanced. Thus to make m >= 1 instances of the same thing, you can pass an ObjectsToInstance() array with one entry and an m entry xyArray() array.

If the entity being instanced is a master, the pin of the new Shape object is positioned at the given xy. Otherwise, the center of the Shape objects is positioned at the given xy.

The Integer value returned by the DropManyU method is the number of xy entries in xyArray that the DropManyU method successfully processed. If all entries were processed successfully, m is returned. If some entries are successfully processed prior to an error occurring, the produced Shape objects are not deleted and this raises an exception but still returns a positive integer.

Presuming all mxy entries are processed correctly, the number of new Shape objects produced by the DropManyU method is usually equal to m. In rare cases (for example, if a Selection object gets instanced), more than m Shape objects may be produced. The caller can determine the number of produced Shape objects by comparing the number of shapes in the target object before and after the DropManyU method is executed. The caller can assert the new Shape objects are those with the highest indices in the target object's Shapes collection.

If the DropManyU method returns zero (0), IDArray() returns null (Nothing). Otherwise, it returns a one-dimensional array of m integers indexed from 0 to m - 1. IDArray() is an out parameter that is allocated by the DropManyU method and ownership is passed to the program that called the DropManyU method. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.)

If IDArray() returns non-null (not Nothing), IDArray(i - 1), 1 <= i <= intReturned, returns the ID of the Shape object produced by the i'th xyArray() entry, provided the i'th xyArray() entry produced exactly one Shape object. If the i'th xyArray() entry produced multiple Shape objects, -1 is returned in the entry. All entries i, intReturned <= i < m, return -1.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the DropMany method to drop more than one shape when you are using local names to identify the shapes. Use the DropManyU method to drop more than one shape when you are using universal names to identify the shapes.

Example

The following example shows how to use the DropManyU method. It drops one instance of every master in the document stencil of the macro's Document object onto Page1 of the macro's Document object. Before running this macro, make sure there is at least one master in the document stencil.

VBA Copy code Copy code

Public Sub DropManyU_Example()

 On Error GoTo HandleError

 Dim vsoMasters As Visio.Masters
 Dim intMasterCount As Integer
 Set vsoMasters = ThisDocument.Masters
 intMasterCount = vsoMasters.Count

 ReDim varObjectsToInstance(1 To intMasterCount) As Variant
 ReDim adblXYArray(1 To (intMasterCount * 2)) As Double
 Dim intCounter As Integer
 For intCounter = 1 To intMasterCount

 'Pass universal name of object to drop to DropManyU.
 varObjectsToInstance(intCounter) = vsoMasters.ItemU(intCounter).NameU

 'Set x components of where to drop to 2,4,6,2,4,6,2,4,6,...
 adblXYArray (intCounter * 2 - 1) = (((intCounter - 1) Mod 3) + 1) * 2

 'Set y components to 2,2,2,4,4,4,6,6,6,...
 adblXYArray (intCounter * 2) = Int((intCounter + 2) / 3) * 2

 Next intCounter

 Dim aintIDArray() As Integer
 Dim intProcessed As Integer

 intProcessed = ThisDocument.Pages(1).DropManyU(varObjectsToInstance, _
 adblXYArray, aintIDArray)
 Debug.Print intProcessed

 For intCounter = LBound(aintIDArray) To UBound(aintIDArray)
 Debug.Print intCounter; aintIDArray(intCounter)
 Next intCounter

 Exit Sub

 HandleError:
 MsgBox "Error"

 Exit Sub

End Sub


Page.Duplicate Method (Visio)

 Copy code hover
[image]

Page.Duplicate Method (Visio)
See also Send feedback

Published: July 16, 2012

Duplicates the specified page and returns the new page.

Syntax

expression .Duplicate

expression A variable that represents a Page object.

Return value

PAGE

Remarks

The duplicated page is inserted immediately after the original page in the document. If the original page is numbered automatically, the duplicated page is numbered in the same way.

See also

Concepts

Page Object

Other resources

Page Members


Page.Export Method (Visio)

 Copy code hover
[image]

Page.Export Method (Visio)
Send feedback

Published: July 16, 2012

Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.

Version Information

Version Added: Visio 3.0

Syntax

expression .Export(FileName)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The fully qualified path and name of the file to receive the exported object.

Return Value

Nothing

Remarks

The file name extension indicates which export filter to use. If the filter is not installed, the Export method returns a compiler error in your Visual Basic or VBA project. The Export method uses the default preference settings for the specified filter and does not prompt the user for non-default arguments.

The Export method of a Page object supports saving to HTML file format using the extension .htm or .html. When pages are exported, Visio uses the settings that were last selected in the Save As dialog box.

If the specified file already exists, Visio replaces it without prompting the user.

Starting with Microsoft Visio 2010, you can use various properties and methods of the ApplicationSettings object that relate to raster images to configure settings for export to .bmp, .gif, .jpg, .png, and .tif file types.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVPage.Export(string)

Example

This example shows how to export a Visio page as a bitmap (.bmp) file. It assumes a drawing page is open and active in Microsoft Visio.

VBA Copy code Copy code
Public Sub Export_Example()
    Dim vsoPage As Visio.Page
    Set vsoPage = ActivePage
    vsoPage.Export ("C:\\myExportedPage.bmp")
End Sub


Page.GetCallouts Method (Visio)

 Copy code hover
[image]

Page.GetCallouts Method (Visio)
Send feedback

Published: July 16, 2012

Returns the list of identifiers of the callout shapes on the page.

Version Information

Version Added: Visio 2010

Syntax

expression .GetCallouts(NestedOptions)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
NestedOptions | Required | VisContainerNested | A constant that indicates whether to exclude shapes on the page that are contained by containers or lists. See Remarks for possible values.

Return Value

Long()

Remarks

The NestedOptions parameter must be one of the following VisContainerNested constants.

Constant | Value | Description
visContainerIncludeNested | 0 | Include shapes that are in nested containers.
visContainerExcludeNested | 1 | Exclude shapes that are in nested containers.


Page.GetContainers Method (Visio)

 Copy code hover
[image]

Page.GetContainers Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of shape identifiers (IDs) of the container shapes on the page.

Version Information

Version Added: Visio 2010

Syntax

expression .GetContainers(NestedOptions)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
NestedOptions | Required | VisContainerNested | Indicates whether to exclude shapes in nested containers. See Remarks for possible values.

Return Value

Long()

Remarks

The NestedOptions parameter must be one of the following VisContainerNested constants.

Constant | Value | Description
visContainerIncludeNested | 0 | Include shapes that are in nested containers.
visContainerExcludeNested | 1 | Exclude shapes that are in nested containers.

You can use the Shapes.ItemFromID property to get the actual shapes from the IDs returned by GetContainers.

Example

The following Visual Basic for Applications (VBA) example shows how to use the GetContainers method to get the IDs of all the containers on a page, loop through those containers, and print each container name in the Immediate window. The example includes nested containers.

VBA Copy code Copy code
For Each containerID In vsoPage.GetContainers(visContainerIncludeNested)
    Set vsoContainerShape = vsoPage.Shapes.ItemFromID(containerID)
    Debug.Print vsoContainerShape.NameU
Next


Page.GetFormulas Method (Visio)

 Copy code hover
[image]

Page.GetFormulas Method (Visio)
Send feedback

Published: July 16, 2012

Returns the formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetFormulas(SID_SRCStream(), formulaArray())

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | Stream identifying cells to be queried.
formulaArray() | Required | Variant | Out parameter. Array that receives formulas of queried cells.

Return Value

Nothing

Remarks

The GetFormulas method is like the Formula property of a Cell object, except you can use it to obtain the formulas of many cells at once rather than one cell at a time. The GetFormulas method is a specialization of the GetResults method, which can be used to obtain cell formulas or results. Setting up a call to the GetFormulas method involves slightly less work than setting up the GetResults method.

For Page objects, you can use the GetFormulas method to get formulas of any set of cells in any set of shapes of the page or master.

SID_SRCStream() is an array of 2-byte integers. For Page objects, SID_SRCStream() should be a one-dimensional array of 4n 2-byte integers for n >= 1. The GetFormulas method interprets SID_SRCStream() as:

VBA Copy code Copy code
{sheetID, sectionIdx, rowIdx, cellIdx}n

where sheetID is the ID property of the Shape object on the page or master whose cell formula is desired.

Note Note

If the sheetID in an entry is visInvalShapeID (-1) or if the bottom byte of sectionIdx is visSectionInval (255), the entry will be ignored and an empty variant will be returned in the corresponding results array entry. This is because the same SID_SRCStream() array can be used on several calls to GetFormulas, SetFormulas, and similar methods with the caller only needing to make minor changes to the stream between calls.

If the GetFormulas method succeeds, formulaArray() returns a one-dimensional array of n variants indexed from 0 to n - 1. Each variant returns a formula as a string. formulaArray() is an out parameter that is allocated by the GetFormulas method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetFormulas method returns. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.) The GetFormulas method fails if formulaArray() is Null.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetFormulas method to get more than one formula when you are using local syntax. Use the GetFormulasU method to get more than one formula when you are using universal syntax.

Example

The following macro shows how to use the GetFormulas method. It assumes that there is an active Microsoft Visio page that has at least three shapes on it. It uses GetFormulas to get the width of shape 1, the height of shape 2, and the angle of shape 3.

This example uses the GetFormulas method of the Page object to get three cell formulas. The input array has four slots for each cell, as it also would for Master objects. For Shape or Style objects, only three slots would be needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub GetFormulas_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer

 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Return the formulas of the cells.
 Dim avarFormulaArray() As Variant
 ActivePage.GetFormulas aintSheetSectionRowColumn, avarFormulaArray

 Debug.Print "Shape 1 width is "; avarFormulaArray(0)
 Debug.Print "Shape 2 height is "; avarFormulaArray(1)
 Debug.Print "Shape 3 angle is "; avarFormulaArray(2)

Exit Sub

HandleError:
 MsgBox "Error"
Exit Sub

End Sub


Page.GetFormulasU Method (Visio)

 Copy code hover
[image]

Page.GetFormulasU Method (Visio)
Send feedback

Published: July 16, 2012

Returns the formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetFormulasU(SID_SRCStream(), formulaArray())

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | Stream identifying cells to be queried.
formulaArray() | Required | Variant | Out parameter. Array that receives formulas of queried cells.

Return Value

Nothing

Remarks

The GetFormulasU method is like the FormulaU property of a Cell object, except you can use it to obtain the formulas of many cells at once, rather than one cell at a time. The GetFormulasU method is a specialization of the GetResults method, which can be used to obtain cell formulas or results. Setting up a call to the GetFormulasU method involves slightly less work than setting up the GetResults method.

You can use the GetFormulasU method to get formulas in universal syntax of any set of cells in any set of shapes of the page or master.

SID_SRCStream() is an array of 2-byte integers. SID_SRCStream() should be a one-dimensional array of 4n 2-byte integers for n >= 1. The GetFormulasU method interprets SID_SRCStream() as:

VBA Copy code Copy code
{sheetID, sectionIdx, rowIdx, cellIdx}n

where sheetID is the ID property of the Shape object on the page or master whose cell formula is desired.

Note Note

If the sheetID in an entry is visInvalShapeID (-1) or if the bottom byte of sectionIdx is visSectionInval (255), the entry will be ignored and an empty variant will be returned in the corresponding results array entry. The reason for this is that the same SID_SRCStream() array can be used on several calls to GetFormulasU, SetFormulas, and similar methods with the caller only needing to make minor changes to the stream between calls.

If the GetFormulasU method succeeds, formulaArray() returns a one-dimensional array of n variants indexed from 0 to n - 1. Each variant returns a formula as a string. formulaArray() is an out parameter that is allocated by the GetFormulasU method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetFormulasU method returns. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.) The GetFormulasU method fails if formulaArray() is Null.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetFormulas method to get more than one formula when you are using local syntax. Use the GetFormulasU method to get more than one formula when you are using universal syntax.

Example

The following macro shows how to use the GetFormulasU method. It assumes that there is an active Visio page that has at least three shapes on it. It uses GetFormulasU to get the width of shape 1, the height of shape 2, and the angle of shape 3.

This example uses the GetFormulasU method of the Page object to get three cell formulas The input array has four slots for each cell, as it also would for Master objects. For Shape or Style objects, only three slots would be needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub GetFormulasU_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To 3 * 4) As Integer

 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Return the formulas of the cells.
 Dim avarFormulaArray() As Variant
 ActivePage.GetFormulasU aintSheetSectionRowColumn, avarFormulaArray

 Debug.Print "Shape 1 width is "; avarFormulaArray(0)
 Debug.Print "Shape 2 height is "; avarFormulaArray(1)
 Debug.Print "Shape 3 angle is "; avarFormulaArray(2)

Exit Sub

HandleError:
 MsgBox "Error"
Exit Sub

End Sub


Page.GetResults Method (Visio)

 Copy code hover
[image]

Page.GetResults Method (Visio)
Send feedback

Published: July 16, 2012

Gets the results or formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetResults(SID_SRCStream(), Flags, UnitsNamesOrCodes(), resultArray())

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | Array identifying cells to be queried.
Flags | Required | Integer | Flags that influence the type of entries returned in results.
UnitsNamesOrCodes() | Required | Variant | Array of measurement units that results are to be returned in.
resultArray() | Required | Variant | Array that receives results or formulas of queried cells.

Return Value

Nothing

Remarks

The GetResults method is like the Result property for the Cell object, except that it can be used to get the results (values) of many cells at once, rather than one cell at a time.

For a Page object, you can use the GetResults method to get results of any set of cells in any set of shapes of the page.

SID_SRCStream() is an array of 2-byte integers. For Page objects, SID_SRCStream() should be a one-dimensional array of 4n 2-byte integers for n >= 1. The GetResults method interprets SID_SRCStream() as:

VBA Copy code Copy code
{sheetID, sectionIdx, rowIdx, cellIdx }n

where sheetID is the ID property of the Shape object on the page whose cell result is desired.

Note Note

If the sheetID in an entry is visInvalShapeID (-1) or if the bottom byte of sectionIdx is visSectionInval (255), the entry will be ignored and an empty variant will be returned in the corresponding results array entry. The reason for this is that the same SID_SRCStream() array can be used on several calls to GetResults, SetResults, and similar methods with the caller only needing to make minor changes to the stream between calls.

The Flags parameter indicates what data type the returned results should be expressed in. Its value should be one of the following.

Constant | Value | Description
visGetFloats | 0 | Results returned as doubles (VT_R8).
visGetTruncatedInts | 1 | Results returned as truncated long integers (VT_I4).
visGetRoundedInts | 2 | Results returned as rounded long integers (VT_I4).
visGetStrings | 3 | Results returned as strings (VT_BSTR).
visGetFormulas | 4 | Formulas returned as strings (VT_BSTR).
visGetFormulasU | 5 | Formulas returned in universal syntax (VT_BSTR).

The UnitsNamesOrCodes() parameter is an array that controls what measurement units individual results are returned in. Each entry in the array can be a string such as "inches", "inch", "in.", or "i". Strings may be used for all supported Visio units such as centimeters, meters, miles, and so on. You can also indicate desired units with integer constants (visCentimeters, visInches, and so on) declared by the Visio type library. Note that the values specified in the UnitsNamesOrCodes() array have no effect if Flags is visGetFormulas.

If UnitsNamesOrCodes() is not null, the application expects it to be a one-dimensional array of 1 <= u Variants. Each entry can be a string or integer code, or empty (nothing). If the i'th entry is empty, the i'th returned result is returned in the units designated by UnitsNamesOrCodes(j), where j is the index of the most recent prior non-empty entry. Thus if you want all returned values to be in the same units, you need only pass a UnitsNamesOrCodes() array with one entry. If there is no prior non-empty entry, or if no UnitsNameOrCodes() array is supplied, visNumber (0x20) is used. This causes internal units (like the ResultIU property of a Cell object) to be returned.

If the GetResults method succeeds, results returns a one-dimensional array of n variants indexed from zero (0) to n - 1. The type of the returned variants is a function of Flags. The resultArray() parameter is an out argument that is allocated by the GetResults method, which passes ownership back to the caller. The caller should eventually perform SafeArrayDestroy on the returned array. Note that SafeArrayDestroy has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetResults method returns. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.)

Example

The following example shows how to use the GetResults method. This example assumes there is an active page that has at least 3 shapes on it. It uses the GetResults method to get the width of shape 1, the height of shape 2, and the angle of shape 3.

This example uses the GetResults method of the Page object to get 3 cell formulas. The input array has 4 slots for each cell, as it also would for Master objects. For Shape or Style objects, only 3 slots would be needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub GetResults_Example()

 On Error GoTo HandleError

 Dim intCounter As Integer
 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer

 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Get first two values in inches. The second element in
 'the units array is left uninitialized (empty) because we
 'want the second result in the same units as the first
 'result. The third result is initialized in degrees. Note that
 'units can be expressed as a string or an integer constant.
 Dim avarUnits(1 To 3) As Variant
 avarUnits(1) = "in."
 avarUnits(3) = visDegrees

 'Return results of cells as an array of floating point numbers.
 Dim avarResults() As Variant
 ActivePage.GetResults aintSheetSectionRowColumn, visGetFloats, _
 avarUnits, avarResults

 For intCounter = 0 To 3
 Debug.Print avarResults(intCounter)
 Next

 Exit Sub

HandleError:
 MsgBox "Error"
 Exit Sub

End Sub


Page.GetShapesLinkedToData Method (Visio)

 Copy code hover
[image]

Page.GetShapesLinkedToData Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of all shapes on the active page linked to data in the specified data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetShapesLinkedToData(DataRecordsetID, ShapeIDs())

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of a data recordset contained in the current document.
ShapeIDs() | Required | Long | Out parameter. An array of type Long that the method will return filled with the shape IDs of shapes on the page linked to the data recordset specified in DataRecordsetID.

Return Value

Nothing

Remarks

For the ShapeIDs() parameter, pass an empty, dimensionless array of type Long. If there are no linked shapes on the page, GetShapesLinkedToData will return an empty array.

To determine the specific data row in the data recordset shapes are linked to, use the Page.GetShapesLinkedToDataRow method.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetShapesLinkedToData method to determine the shape IDs of the shapes on the page linked to data in the data recordset most recently added to the DataRecordsets collection of the current document. It prints the shape IDs in the Immediate window.

Before running this macro, use the DataRecordsets.Add method or another means to add at least one data recordset to the DataRecordsets collection, and make sure there is at least one shape on the active page linked to data in the data recordset.

VBA Copy code Copy code
Public Sub GetShapesLinkedToData_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intRecordsetCount As Integer
    Dim alngShapeIDs() As Long
    Dim intArrayCounter As Integer

    intRecordsetCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intRecordsetCount)

    ActivePage.GetShapesLinkedToData vsoDataRecordset.ID, alngShapeIDs

    For intArrayCounter = LBound(alngShapeIDs) To UBound(alngShapeIDs)
        Debug.Print alngShapeIDs(intArrayCounter)
    Next

End Sub


Page.GetShapesLinkedToDataRow Method (Visio)

 Copy code hover
[image]

Page.GetShapesLinkedToDataRow Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of all shapes on the active page linked to data in the specified data row in the specified data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetShapesLinkedToDataRow(DataRecordsetID, DataRowID, ShapeIDs())

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of a data recordset contained in the current document.
DataRowID | Required | Long | The ID of a data row in the data recordset specified in DataRecordsetID.
ShapeIDs() | Required | Long | Out parameter. An array of type Long that the method will return filled with the shape IDs of shapes on the page linked to the data row specified in DataRowID in the data recordset specified in DataRecordsetID.

Return Value

Nothing

Remarks

For the ShapeIDs() parameter, pass an empty, dimensionless array of type Long. If there are no shapes on the page linked to the data row specified by DataRowID in the data recordset specified by DataRecordsetID, GetShapesLinkedToDataRow will return an empty array.

To determine the IDs of all the data rows in a data recordset, use the DataRecordset.GetDataRowIDs method. Note that data row IDs do not necessarily always correspond to the logical position of the data rows in the data recordset.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetShapesLinkedToDataRow method to determine the shape IDs of the shapes on the page linked to data in the data row with ID number 1 in the data recordset most recently added to the DataRecordsets collection of the current document. It prints the shape IDs in the Immediate window.

Before running this macro, use the DataRecordsets.Add method or another means to add at least one data recordset to the DataRecordsets collection, and make sure there is at least one shape on the active page linked to data in the data row with ID number 1 in the data recordset.

VBA Copy code Copy code
Public Sub GetShapesLinkedToDataRow_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intRecordsetCount As Integer
    Dim alngShapeIDs() As Long
    Dim lngDataRowID As Long
    Dim intArrayCounter As Integer

    intRecordsetCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intRecordsetCount)

    lngDataRowID = 1

    ActivePage.GetShapesLinkedToDataRow vsoDataRecordset.ID, lngDataRowID, alngShapeIDs

    For intArrayCounter = LBound(alngShapeIDs) To UBound(alngShapeIDs)
        Debug.Print alngShapeIDs(intArrayCounter)
    Next

End Sub


Page.GetTheme Method (Visio)

 Copy code hover
[image]

Page.GetTheme Method (Visio)
See also Send feedback

Published: July 16, 2012

Returns a Variant that represents the specified theme component of the specified page.

Syntax

expression .GetTheme(eThemeType)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data type | Description
eThemeType | Required | VISTHEMETYPES | Specifies the type of the theme component to return.

Return value

VARIANT

Remarks

The theme components returned are enumerations of built-in theme definitions for colors, fonts, and styles for 2-dimensional shapes, and styles for 1-dimensional shapes.

See also

Concepts

Page Object

Other resources

Page Members


Page.GetThemeVariant Method (Visio)

 Copy code hover
[image]

Page.GetThemeVariant Method (Visio)
See also Send feedback

Published: July 16, 2012

Returns the color, style, and embellishment, if any, of the variant of the theme applied to the specified page.

Syntax

expression .GetThemeVariant(pVariantColor,pVariantStyle,pEmbellishment)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data type | Description
pVariantColor | Required | INT16 | The index of the color variant applied. Possible values are from 0 to 3.Out parameter.
pVariantStyle | Required | INT16 | The index of the style variant applied. Possible values are from 0 to 3. Out parameter.
pEmbellishment | Optional | INT16 | The index of the embellishment applied, if any. Possible values are from 1, for "low," to 3, for "high." Out parameter.

Return value

VOID

See also

Concepts

Page Object

Other resources

Page Members


Page.Import Method (Visio)

 Copy code hover
[image]

Page.Import Method (Visio)
Send feedback

Published: July 16, 2012

Imports a file into the current document.

Version Information

Version Added: Visio 3.0

Syntax

expression .Import(FileName)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file to import; must be a fully qualified path.

Return Value

Shape

Remarks

The Import method imports the file specified by FileName onto a page, or into a master or group.

If the path to FileName does not resolve, the Import method returns an error.

The file name extension indicates which import filter to use. If the filter is not installed, the Import method returns an error. The Import method uses the default preference settings for the specified filter and does not prompt the user for non-default arguments.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Import method to import a bitmap image onto the drawing page. This example assumes that there is a file with the name sampleImage.bmp on drive C of your computer.

VBA Copy code Copy code
Public Sub Import_Example()

 ActivePage.Import ("C:\sampleImage.bmp")

End Sub


Page.InsertFromFile Method (Visio)

 Copy code hover
[image]

Page.InsertFromFile Method (Visio)
Send feedback

Published: July 16, 2012

Adds a linked or embedded object to a page, master, or group.

Version Information

Version Added: Visio 4.1

Syntax

expression .InsertFromFile(FileName, Flags)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file that contains the object to link or embed.
Flags | Required | Integer | Flags that influence how the object is inserted.

Return Value

Shape

Remarks

The InsertFromFile method creates a new shape that represents a linked or embedded OLE object.

The Flags argument is a bitmask that should be a combination of the following values.

Constant | Value | Description
visInsertLink | &H8 | If set, the new shape represents an OLE link to the named file. Otherwise, the InsertFromFile method produces an OLE object from the contents of the named file and embeds it in the document that contains the page, master, or group.
visInsertIcon | &H10 | Displays the new shape as an icon.

Security Use caution when you are adding ActiveX controls to your application. ActiveX controls may be designed in such a way that their use could pose a security risk. We recommend that you use controls from trusted sources only.


Page.InsertObject Method (Visio)

 Copy code hover
[image]

Page.InsertObject Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new embedded object or ActiveX control to a page, master, or group.

Version Information

Version Added: Visio 4.1

Syntax

expression .InsertObject(ClassOrProgID, Flags)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ClassOrProgID | Required | String | Identifies the type of object or control to create.
Flags | Required | Integer | Flags that influence the operation.

Return Value

Shape

Remarks

ClassOrProgID is a string that identifies the kind of object or control to create. It can be either the object or control's class ID (GUID) in string form or the object or control's program ID of the handler for the class.

  • If ClassOrProgID is a string representing a class ID, it looks like "{D3E34B21-9D75-101A-8C3D-00AA001A1652}."

  • If ClassOrProgID is a string representing a program ID, it looks like "paint.picture" or "forms.combobox.1".

See vendor-specific documentation or browse the registry to determine which class IDs and program IDs are associated with objects and controls provided by other applications.

The Flags argument is a bitmask that can include one of the following values.

Constant | Value | Description
visInsertIcon | &H10 | Displays the new shape as an icon.
visInsertDontShow | &H1000 | Does not execute the new object's show verb.

If both visInsertIcon and visInsertDontShow are specified, the InsertObject method fails. If you want to insert an object that is displayed as an icon, you must allow the application to execute the object's show verb.

The Flags argument can also include one of the following values.

Constant | Value
visInsertAsControl | &H2000
visInsertAsEmbed | &H4000

Values in visInsertAsControl and visInsertAsEmbed only have an effect if the class identified by ClassOrProgID is identified in the registry as a control that can be inserted. If neither visInsertAsControl nor visInsertAsEmbed is specified and the object can be either a control or an embedded object, the application inserts it as a control.

In rare cases, Visio 5.0 or later versions may insert a control whereas earlier versions of Visio would have responded to the same call by inserting an embedded object. If a control is inserted, this method places the document in design mode, causing any code executing in the document to halt until the document is returned to run mode.

Security Use caution when you are adding ActiveX controls to your application. ActiveX controls may be designed in such a way that their use could pose a security risk. We recommend that you use controls from trusted sources only. Sign any controls you author.

Caution note Caution

Modifying the registry in any manner, whether through the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).


Page.Layout Method (Visio)

 Copy code hover
[image]

Page.Layout Method (Visio)
Send feedback

Published: July 16, 2012

Lays out the shapes and/or reroutes the connectors for the page, master, group, or selection.

Version Information

Version Added: Visio 4.5

Syntax

expression .Layout

expression A variable that represents a Page object.

Return Value

Nothing

Remarks

Using the Layout method is equivalent to clicking Re-Layout Page in the Layout group on the Design tab and then clicking More Layout Options and configuring options in the Configure Layout dialog box.

Behavior of the Layout method can be influenced by setting the formulas or results of cells in the Page Layout and Shape Layout ShapeSheet sections of the page, master, or group to be laid out. You can infer how these cells influence the behavior of the Layout method by examining the effect of various Configure Layout dialog box options on the values of these cells.

To lay out a subset of the shapes of a page, master, or group, establish a Selection object in which the shapes to be laid out are selected, and then call the Layout method. If the Layout method is performed on a Selection object and the object has no shapes selected, all shapes in the page, master, or group of the selection are laid out.


Page.LayoutChangeDirection Method (Visio)

 Copy code hover
[image]

Page.LayoutChangeDirection Method (Visio)
Send feedback

Published: July 16, 2012

Revises the layout of a set of connected shapes on the page, by rotating or flipping a connected diagram without rotating or flipping the individual shapes.

Version Information

Version Added: Visio 2010

Syntax

expression .LayoutChangeDirection(Direction)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | VisLayoutDirection | The action to take. See Remarks for possible values.

Return Value

Nothing

Remarks

The Direction parameter must be one of the following VisLayoutDirection constants.

Constant | Value | Description
visLayoutDirRotateRight | 0 | Rotates the diagram 90 degrees clockwise.
visLayoutDirRotateLeft | 1 | Rotates the diagram 90 degrees counterclockwise.
visLayoutDirFlipVert | 2 | Flips the diagram vertically.
visLayoutDirFlipHorz | 3 | Flips the diagram horizontally.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the LayoutChangeDirection method to flip connected shapes on the active page vertically, without flipping the individual shapes.

VBA Copy code Copy code
Public Sub PageLayoutChangeDirection_Example()

   ActivePage.LayoutChangeDirection (visLayoutDirFlipVert)

End Sub


Page.LayoutIncremental Method (Visio)

 Copy code hover
[image]

Page.LayoutIncremental Method (Visio)
Send feedback

Published: July 16, 2012

Makes small adjustments to the position of shapes on the drawing page to better align the shapes or to space them evenly from other shapes.

Version Information

Version Added: Visio 2010

Syntax

expression .LayoutIncremental(AlignOrSpace, AlignHorizontal, AlignVertical, SpaceHorizontal, SpaceVertical, UnitsNameOrCode)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
AlignOrSpace | Required | VisLayoutIncrementalType | The type of incremental layout action to perform--alignment, spacing, or both. See Remarks for possible values.
AlignHorizontal | Required | VisLayoutHorzAlignType | Indicates how Microsoft Visio aligns shapes horizontally when it aligns incrementally. See Remarks for possible values.
AlignVertical | Required | VisLayoutVertAlignType | Indicates how Visio aligns shapes vertically when it aligns incrementally (except if layout style is circular). See Remarks for possible values.
SpaceHorizontal | Required | Double | The edge-to-edge horizontal spacing. Must be greater than or equal to zero.
SpaceVertical | Required | Double | The edge-to-edge vertical spacing (except if layout style is circular). Must be greater than or equal to zero.
UnitsNameOrCode | Required | VisUnitCodes | The units for the spacing values.

Return Value

Nothing

Remarks

The AlignOrSpace parameter must be one or the combination of both (3) of the following VisLayoutIncrementalType constants.

Constant | Value | Description
visLayoutIncrAlign | 1 | Align shapes.
visLayoutIncrSpace | 2 | Space shapes evenly.

The AlignHorizontal parameter must be one of the following VisLayoutHorzAlignType constants.

Constant | Value | Description
visLayoutHorzAlignNone | 0 | Do not align horizontally.
visLayoutHorzAlignDefault | 1 | Visio chooses how to align horizontally.
visLayoutHorzAlignLeft | 2 | Align the left edges of the shapes.
visLayoutHorzAlignCenter | 3 | Align the centers of the shapes.
visLayoutHorzAlignRight | 4 | Align the right edges of the shapes.

The AlignVertical parameter must be one of the following VisLayoutVertAlignType constants.

Constant | Value | Description
visLayoutVertAlignNone | 0 | Do not align vertically.
visLayoutVertAlignDefault | 1 | Visio chooses how to align vertically.
visLayoutVertAlignTop | 2 | Align the top edges of the shapes.
visLayoutVertAlignMiddle | 3 | Align the middles of the shapes.
visLayoutVertAlignBottom | 4 | Align the bottom edges of the shapes.

If AlignOrSpace is visLayoutIncrAlign, either AlignHorizontal must be a value other than visLayoutHorzAlignNone, or AlignVertical must be a value other than visLayoutVertAlignNone.

If AlignOrSpace is visLayoutIncrSpace, both AlignHorizontal and AlignVertical must be greater than zero.

If AlignOrSpace is a combination of visLayoutIncrAlign and visLayoutIncrSpace, both of these conditions must be true.

If the page layout style is circular, Visio uses only the AlignHorizontal value to determine whether to align, and only the SpaceHorizontal value to determine whether to space, ignoring the AlignVertical and SpaceVertical values, respectively. In this case, if you pass anything other than visLayoutHorzAlignNone for AlignHorizontal, Visio performs the alignment. Similarly, if you pass any value greater than zero for SpaceHorizontal, Visio performs the spacing.


Page.LinkShapesToDataRows Method (Visio)

 Copy code hover
[image]

Page.LinkShapesToDataRows Method (Visio)
Send feedback

Published: July 16, 2012

Links multiple rows in the specified data recordset, as specified by their data row IDs, to multiple shapes on the page, and optionally applies the current data graphic to the linked shapes.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .LinkShapesToDataRows(DataRecordsetID, DataRowIDs(), ShapeIDs(), ApplyDataGraphicAfterLink)

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of a data recordset contained in the current document containing the data to link to.
DataRowIDs() | Required | Long | An array of type Long of data row IDs of rows in the data recordset specified in DataRecordsetID, to be linked to the shapes specified in ShapeIDs().
ShapeIDs() | Required | Long | An array of type Long of shape IDs of shapes on the page to be linked to the data rows specified in DataRowIDs() in the data recordset specified in DataRecordsetID.
ApplyDataGraphicAfterLink | Optional | Boolean | Whether to apply the current data graphic to the linked shapes. See Remarks for more information.

Return Value

Nothing

Remarks

Index positions of the shape IDs in the array you pass for the ShapeIDs() parameter should correspond to the index position in the DataRowIDs() array of the IDs of the data rows to which you want the shapes to be linked. That is, to link the shape with ID 1 to the data row with ID 10, for example, place the shape ID and the data row ID in the same array index position in their respective arrays.

If Visio cannot establish a link between a shape and a data row, Visio skips that shape and goes on to the next shape in the array. After you run the method, to determine if all shapes in the array are actually linked to the specified data rows, call the Shape.GetLinkedDataRow method on each shape in the array. If that method fails for any shape, it indicates that the shape is not linked to the data row. Visio will usually succeed in linking a row to a shape unless the shape is already linked to data and the link-replacement-behavior setting for the data recordset specifies that the link should not be replaced.

If you pass True for the optional ApplyDataGraphicAfterLink parameter, or if you do not pass a value for this parameter, Visio re-applies the existing data graphic to shapes that already had data graphics applied before you called the method. For shapes that previously had no data graphic, Visio applies the data graphic most recently applied to any other shape in the current document.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the LinkShapesToDataRows method to link the first three shapes added to the active drawing page to data in the first three data rows in the data recordset most recently added to the DataRecordsets collection of the current document. Because it does not pass a value for the optional final parameter, it also applies a data graphic to the linked shapes.

Before running this macro, open a new Visio drawing and use the DataRecordsets.Add method or another means to add at least one data recordset to the DataRecordsets collection. The most recently added data recordset should contain at least three data rows. Then add at least three shapes to the drawing page.

VBA Copy code Copy code
Public Sub LinkShapesToDataRows_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim intRecordsetCount As Integer
    Dim alngDataRowIDs(0 To 2) As Long
    Dim alngShapeIDs(0 To 2) As Long

    alngShapeIDs(0) = 1
    alngShapeIDs(1) = 2
    alngShapeIDs(2) = 3

    alngDataRowIDs(0) = 1
    alngDataRowIDs(1) = 2
    alngDataRowIDs(2) = 3

    intRecordsetCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intRecordsetCount)

    ActivePage.LinkShapesToDataRows vsoDataRecordset.ID, alngDataRowIDs, alngShapeIDs

End Sub


Page.OpenDrawWindow Method (Visio)

 Copy code hover
[image]

Page.OpenDrawWindow Method (Visio)
Send feedback

Published: July 16, 2012

Opens a new drawing window that displays a page.

Version Information

Version Added: Visio 4.1

Syntax

expression .OpenDrawWindow

expression A variable that represents a Page object.

Return Value

Window

Remarks

The OpenDrawWindow method opens a new drawing window, even if the page is already displayed in a drawing window.


Page.Paste Method (Visio)

 Copy code hover
[image]

Page.Paste Method (Visio)
Send feedback

Published: July 16, 2012

Pastes the contents of the Clipboard into an object.

Version Information

Version Added: Visio 2002

Syntax

expression .Paste(Flags)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Optional | Variant | Determines how shapes are translated during the paste operation.

Return Value

Nothing

Remarks

The Paste method works only with Shape objects that are group shapes. Use the Type property of a shape to determine whether it is a group.

Possible values for Flags are declared by the Visio type library in VisCutCopyPasteCodes, and are described in the following table.

Flag | Value | Description
visCopyPasteNormal | &H0 | Follow default copying behavior.
visCopyPasteNoTranslate | &H1 | Copy shapes to their original coordinate locations.
visCopyPasteCenter | &H2 | Copy shapes to the center of the page.
visCopyPasteNoHealConnectors | &H4 | Do not clean up connectors attached to cut shapes.
visCopyPasteNoContainerMembers | &H8 | Do not cut and copy unselected members of containers or lists.
visCopyPasteNoAssociatedCallouts | &H16 | Do not cut and copy unselected callouts associated with shapes.
visCopyPasteDontAddToContainers | &H32 | Do not add pasted shapes to any underlying containers.
visCopyPasteNoCascade | &H64 | Do not offset shapes on copy.

Setting Flags to visCopyPasteNormal is the equivalent of the behavior in the user interface. You should use visCopyPasteNormal and the other flags consistently. For example, if you use the value visCopyPasteNoTranslate to copy, you should also use that value to paste, because that is the only way to ensure that shapes are pasted to their original coordinate location.

If you need to control the format of the pasted information and (optionally) establish a link to a source file (for example, a Microsoft Word document), use the PasteSpecial method.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Paste method. It draws a rectangle, copies it, and then pastes the copy onto the drawing page.

VBA Copy code Copy code

Public Sub Paste_Example()

 Dim vsoShape As Visio.Shape

 'Draw a rectangle.
 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)

 'Copy the shape to the Clipboard.
 vsoShape.Copy

 'Paste the copy onto the drawing page.
 ActivePage.Paste

End Sub


Page.PasteSpecial Method (Visio)

 Copy code hover
[image]

Page.PasteSpecial Method (Visio)
Send feedback

Published: July 16, 2012

Inserts the contents of the Clipboard, allowing you to control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Word document).

Version Information

Version Added: Visio 2002

Syntax

expression .PasteSpecial(Format, Link, DisplayAsIcon)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Format | Required | Long | The internal Clipboard format.
Link | Optional | Variant | True to establish a link to the source of the pasted data; otherwise, False (the default). Ignored if the source data is not suitable for, or does not support, linking.
DisplayAsIcon | Optional | Variant | True to display the pasted data as an icon; otherwise, False (the default).

Return Value

Nothing

Remarks

To simply paste the contents of the Clipboard into an object, use the Paste method.

The value of the Format argument can be any of the following:

  • A value from VisPasteSpecialCodes (see the following table).

  • Any of the standard Clipboard formats, for example, CF_TEXT. For details, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network Web site.

  • Any value returned from a call to the RegisterClipboardFormat function. For details, see the Microsoft Platform SDK on MSDN.

Note Note

Before calling Microsoft Windows functions, you should understand how arguments and data types are handled by the Windows API DLLs. Incorrectly calling Windows functions may result in invalid page faults or other unexpected behaviors. For more information on calling Windows functions, search for "Windows API" on MSDN.

Possible values for Format declared by the Visio type library in VisPasteSpecialCodes are described in the following table.

Constant | Value | Description
visPasteBitmap | 2 | Paste bitmap.
visPasteDIB | 8 | Paste device-independent bitmap.
visPasteEMF | 14 | Paste enhanced metafile.
visPasteHyperlink | 65538 | Paste hyperlink.
visPasteInk | 65544 | Paste Ink data.
visPasteMetafile | 3 | Paste metafile.
visPasteOEMText | 7 | Paste OEM text.
visPasteOLEObject | 65536 | Paste OLE object.
visPasteRichText | 65537 | Paste rich text.
visPasteText | 1 | Paste ANSI text.
visPasteURL | 65539 | Paste Uniform Resource Locator (URL).
visPasteVisioIcon | 65543 | Paste Visio icon.
visPasteVisioMastersXML | 65546 | Paste Visio masters XML.
visPasteVisioMasters | 65541 | Paste Visio masters.
visPasteVisioShapesXML | 65545 | Paste Visio shapes XML.
visPasteVisioShapesWithoutDataLinks | 65548 | Paste Visio drawing data without internal data links.
visPasteVisioShapes | 65540 | Paste Visio shapes.
visPasteVisioText | 65542 | Paste Visio text.


Page.PasteToLocation Method (Visio)

 Copy code hover
[image]

Page.PasteToLocation Method (Visio)
Send feedback

Published: July 16, 2012

Pastes the shape to the specified location on the page.

Version Information

Version Added: Visio 2010

Syntax

expression .PasteToLocation(xPos, yPos, Flags)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
xPos | Required | Double | The x-coordinate at which to place the center of the object's width or PinX, in inches.
yPos | Required | Double | The y-coordinate at which to place the center of the object's height or PinY, in inches.
Flags | Required | Long | The default is zero.

Return Value

Nothing

Remarks

The Flags parameter value can also be visCopyPasteDontAddToContainers.


Page.Print Method (Visio)

 Copy code hover
[image]

Page.Print Method (Visio)
Send feedback

Published: July 16, 2012

Prints the contents of an object to the default printer.

Version Information

Version Added: Visio 2.0

Syntax

expression .Print

expression A variable that represents a Page object.

Return Value

Nothing

Remarks

For a Document object, this method prints all of the document's pages. Background pages are printed on the same sheet of paper as the foreground pages to which they are assigned.

For a Page object, this method prints the page and its background page (if any) on the same sheet of paper.

If you're using Microsoft Visual Basic for Applications (VBA) or Visual Basic, you must assign the method result to a dummy variable and you must apply the method to a variable of type Object, not type Visio.Document or Visio.Page. For example, to print a document, use the following code.

VBA Copy code Copy code

 Dim vsoDocument As Visio.Document
 Dim vsoDocumentTemp as Object
 Dim strDummy As String

 Set vsoDocument = ThisDocument
 Set vsoDocumentTemp = vsoDocument
 strDummy = vsoDocumentTemp.Print


Page.PrintTile Method (Visio)

 Copy code hover
[image]

Page.PrintTile Method (Visio)
Send feedback

Published: July 16, 2012

Prints a single tile of a drawing page.

Version Information

Version Added: Visio 2002

Syntax

expression .PrintTile(nTile)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
nTile | Required | Long | The number of tiles.

Return Value

Nothing

Remarks

Use the PrintTile method to print a single tile of a drawing that spans multiple physical printer pages.

Using this method is the equivalent of clicking Print when you are previewing a single tile in Print Preview mode.


Page.ResizeToFitContents Method (Visio)

 Copy code hover
[image]

Page.ResizeToFitContents Method (Visio)
Send feedback

Published: July 16, 2012

Resizes the page, or the master's page, to fit tightly around the shapes or master that are on it.

Version Information

Version Added: Visio 2002

Syntax

expression .ResizeToFitContents

expression A variable that represents a Page object.

Return Value

Nothing

Remarks

After the page is resized, the page height and width and the PinX and PinY values of the shapes or master are typically changed.

Calling the ResizeToFitContents method is the equivalent of selecting Let Visio expand the page as needed on the Page Size tab in the Page Setup dialog box (on the Design tab, click Size, and then click More Page Sizes).

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVPage.ResizeToFitContents()


Page.SetFormulas Method (Visio)

 Copy code hover
[image]

Page.SetFormulas Method (Visio)
Send feedback

Published: July 16, 2012

Sets the formulas of one or more cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .SetFormulas(SID_SRCStream(), formulaArray(), Flags)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | Stream identifying cells to be modified.
formulaArray() | Required | Variant | Formulas to be assigned to identified cells.
Flags | Required | Integer | Flags that influence the behavior of SetFormulas.

Return Value

Integer

Remarks

The SetFormulas method behaves like the Formula property except that you can use it to set the formulas of many cells at once, rather than one cell at a time.

For Page objects, you can use the SetFormulas method to set results of any set of cells in any set of shapes of the page or master. You tell the SetFormulas method which cells you want to set by passing an array of integers in SID_SRCStream(). SID_SRCStream() is a one-dimensional array of 2-byte integers.

For Page objects SID_SRCStream() should be a one-dimensional array of 4n 2-byte integers for n >= 1. The SetFormulas method interprets the stream as:

VBA Copy code Copy code
{sheetID, sectionIdx, rowIdx, cellIdx }n

where sheetID is the ID property of the Shape object on the page or master whose cell result is to be modified.

If the sheetID in an entry is visInvalShapeID (-1) or if the bottom byte of sectionIdx is visSectionInval (255), the entry is ignored by the SetResults method. This is because the same SID_SRCStream() array can be used on several calls to SetFormulas, GetFormulas, and similar methods with the caller only needing to make minor changes to the stream between calls.

The formulaArray() parameter should be a one-dimensional array of 1 <= m variants. Each Variant should be a String, a reference to a String, or Empty. If formulaArray(i) is empty, the i'th cell will be set to the formula in formulaArray(j), where j is the index of the most recent prior entry that is not empty. If there is no prior entry that is not empty, the corresponding cell is not altered. If fewer formulas than cells are specified (m < n), the i'th cell, i > m, will be set to the same formula as was chosen to set the m'th cell to. Thus to set many cells to the same formula, you need pass only one copy of the formula.

The Flags parameter should be a bitmask of the following values.

Constant | Value | Description
visSetBlastGuards | &H2 | Override present cell values even if they're guarded.
visSetTestCircular | &H4 | Test for establishment of circular cell references.
visSetUniversalSyntax | &H8 | Formulas are in universal syntax.

The value returned by the SetFormulas method is the number of entries in SID_SRCStream() that were successfully processed. If i < n entries process correctly, but an error occurs on the i + 1st entry, the SetFormulas method raises an exception and returns i. Otherwise, n is returned.

Example

The following macro shows how to use the SetFormulas method. It assumes that there is an active Microsoft Office Visio page that has at least three shapes on it. It uses the GetFormulas method to get the width of shape 1, the height of shape 2, and the angle of shape 3. It then uses SetFormulas to set the width of shape 1 to the height of shape 2 and the height of shape 2 to the width of shape 1. The angle of shape 3 is left unaltered.

This example uses the GetFormulas method of the Page object to get three cell formulas and the SetFormulas method of the same object to set the formulas. The input array has four slots for each cell, as it also would for Master objects. For Shape or Style objects, only three slots are needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub SetFormulas_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To 3 * 4) As Integer
 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Return the formulas of the cells.
 Dim avarFormulaArray() As Variant
 ActivePage.GetFormulas aintSheetSectionRowColumn, avarFormulaArray

 'Use SetFormulas to:
 ' - Set the width of shape 1 to height of shape 2.
 ' - Set height of shape 2 to width of shape 1.
 ' Note: avarFormulaArray() is indexed from 0 to 2.
 Dim varTemp As variant
 varTemp = avarFormulaArray(0)
 avarFormulaArray(0) = avarFormulaArray(1)
 avarFormulaArray(1) = varTemp

 'Pass the same array back to SetFormulas that we
 'just passed to GetFormulas, leaving angle alone. By setting
 'the sheet ID entry in the third slot of the
 'aintSheetSectionRowColumn array to visInvalShapeID,
 'we tell SetFormulas to ignore that slot.
 aintSheetSectionRowColumn (9) = visInvalShapeID

 'Tell Microsoft Visio to set the formulas of the cells.
 ActivePage.SetFormulas aintSheetSectionRowColumn, avarFormulaArray, 0

 Exit Sub

HandleError:

 MsgBox "Error"

 Exit Sub

End Sub


Page.SetResults Method (Visio)

 Copy code hover
[image]

Page.SetResults Method (Visio)
Send feedback

Published: July 16, 2012

Sets the results or formulas of one or more cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .SetResults(SID_SRCStream(), UnitsNamesOrCodes(), resultArray(), Flags)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | An array identifying cells to be modified.
UnitsNamesOrCodes() | Required | Variant | Measurement units to be attributed to entries in results array.
resultArray() | Required | Variant | Results or formulas to be assigned to identified cells.
Flags | Required | Integer | Flags that influence the behavior of SetResults.

Return Value

Integer

Remarks

The SetResults method is like the Result method of a Cell object, except that it can be used to set the results (values) of many cells at once, rather than one cell at a time.

For Page objects, you can use the SetResults method to set results of any set of cells in any set of shapes of the page or master.

You tell the SetResults method which cells you want to set by passing an array of integers in SID_SRCStream(). SID_SRCStream() is a one-dimensional array of 2-byte integers.

For Page objects, SID_SRCStream() should be a one-dimensional array of 4n 2-byte integers for n >= 1. The SetResults method interprets the stream as:

VBA Copy code Copy code
{sheetID, sectionIdx, rowIdx, cellIdx }n

where sheetID is the ID property of the Shape object on the page or master whose cell result is to be modified.

If the sheetID in an entry is visInvalShapeID (-1) or if the bottom byte of sectionIdx is visSectionInval (255), the entry is ignored by the SetResults method. The motivation for this is that the same SID_SRCStream() array can be used on several calls to SetResults, GetResults, and similar methods with the caller only needing to make minor changes to the stream between calls.

The UnitsNamesOrCodes() array controls what measurement units individual entries in results are in. Each entry in the array can be a string such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Office Visio units such as centimeters, meters, miles, and so on. You can also indicate desired units with integer constants (visCentimeters, visInches, and so on) declared by the Visio type library in VisUnitCodes. For a list of constants used for units of measure, see About Units of Measure. Note that the values specified in the UnitsNamesOrCodes() array have no effect if visSetFormulas is set in Flags.

If UnitsNamesOrCodes() is not empty, we expect it to be a one-dimensional array of 1 <= u variants. Each entry can be a string or integer code, or empty (nothing). If the i'th entry is empty, the i'th entry in resultArray() is in the units designated by units(j), where j is the most recent prior entry that is not empty. Thus, if you want all entries in resultArray() to be interpreted in the same units, you need only pass a UnitsNamesOrCodes() array that has one entry. If there is no prior entry that is not empty, or if no units array is supplied, visNumber (0x20) will be used. This causes the application to default to internal units (as does the ResultIU property of a Cell object).

The resultArray() parameter should be a one-dimensional array of 1 <= m variants. A result can be passed as Double, Integer, String, or a reference to a String. Strings are accepted only if visSetFormulas is set in Flags, in which case strings are interpreted as formulas. If resultArray(i) is empty, the i'th cell will be set to the value in resultArray(j), where j is the index of the most recent prior entry that is not empty. If there is no prior entry that is not empty, the corresponding cell is not altered. If fewer results than cells are specified (if m < n), the i'th cell, i < m, will be set to the same value as the m'th cell. Thus, to set many cells to the same value, you need only pass one copy of the value.

The Flags parameter should be a bitmask of the following values.

Constant | Value | Description
visSetFormulas | &H1 | Treat strings in results as formulas.
visSetBlastGuards | &H2 | Override present cell values even if they're guarded.
visSetTestCircular | &H4 | Test for establishment of circular cell references.
visSetUniversalSyntax | &H8 | Formulas are in universal syntax

The value returned by the SetResults method is the number of entries in SID_SRCStream() that were successfully processed. If i < n entries are processed correctly, but an error occurs on the i + 1st entry, the SetResults method raises an exception and returns i. Otherwise, n is returned.

Example

The following example shows how to use the SetResults method. This example assumes there is an active page that has at least 3 shapes on it. It uses the GetResults method to get the width of shape 1, the height of shape 2, and the angle of shape 3. It then uses SetResults to set the width of shape 1 to the height of shape 2 and the height of shape 2 to the width of shape 1.The angle of shape 3 is left unaltered.

This example uses the GetResults method of the Page object to get 3 cell formulas and the SetResults method of the same object to set the formulas. The input array has 4 slots for each cell, as it also would for Master objects. For Shape or Style objects, only 3 slots are needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub Set Results_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer
 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Get the first two values in inches. The second element in
 'the units array is left uninitialized (empty) because we
 'want the second result in the same units as the first
 'result. The third result is initialized in degrees. Note that
 'units can be expressed as a string or an integer constant.
 Dim avarUnits(1 To 3) As Variant
 avarUnits(1) = "in."
 avarUnits(3) = visDegrees

 'Return results of cells as an array of floating point numbers.
 Dim avarResults() As Variant
 ActivePage.GetResults aintSheetSectionRowColumn, visGetFloats, _
 avarUnits, avarResults

 'Use SetResults to:

 ' - Set the width of shape 1 to the height of shape 2.

 ' - Set the height of shape 2 to the width of shape 1.

 'NOTE: avarResults() is indexed from 0 to 2.

 Dim varTemp As variant
 varTemp = avarResults(0)
 avarResults(0) = avarResults(1)
 avarResults(1) = varTemp

 'Pass the same array back to SetResults that we
 'just passed to GetResults, but leave the angle
 'alone. By setting the sheet ID entry in the third
 'slot of the aintSheetSectionRowColumn array to
 'visInvalShapeID, we tell SetResults to ignore that slot.
 aintSheetSectionRowColumn(9) = visInvalShapeID

 'Set the results of the cells.
 ActivePage.SetResults aintSheetSectionRowColumn, avarUnits, avarResults, 0

 Exit Sub

HandleError:

 MsgBox "Error"

 Exit Sub

End Sub


Page.SetTheme Method (Visio)

 Copy code hover
[image]

Page.SetTheme Method (Visio)
See also Send feedback

Published: July 16, 2012

Sets the theme for the specified page.

Syntax

expression .SetTheme(varThemeIndex,varColorScheme,varEffectScheme,varConnectorScheme,varFontScheme)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data type | Description
varThemeIndex | Required | VARIANT | The theme to apply.
varColorScheme | Optional | VARIANT | The color scheme theme component to apply.
varEffectScheme | Optional | VARIANT | The effect scheme theme component to apply.
varConnectorScheme | Optional | VARIANT | The connector scheme theme component to apply.
varFontScheme | Optional | VARIANT | The font scheme theme component to apply.

Return value

VOID

Remarks

Possible themes correspond to those displayed in the Themes and the Colors, Effects, and Connectors galleries on the Design tab of the ribbon. You can specify values for just the first, required parameter, or for any combination of the first parameter and one or more of the other four parameters. If you pass a value for the only first parameter, varThemeIndex and you pass nothing for the other four optional parameters, Visio sets all five parameters to the theme value you specified for the first parameter. For example, if you pass "Linear" for the first parameter, Visio sets the color scheme, effect scheme, connector scheme, and font scheme to "Linear" as well. If you pass "Linear" for the first parameter and "Gemstone" for the second parameter, Visio sets the effect scheme, connector scheme, and font scheme to "Linear," but sets the color scheme to "Gemstone," and so on.

See also

Concepts

Page Object

Other resources

Page Members


Page.SetThemeVariant Method (Visio)

 Copy code hover
[image]

Page.SetThemeVariant Method (Visio)
See also Send feedback

Published: July 16, 2012

Sets the color, style, and optionally the embellishment of the variant of the theme applied to the specified page.

Syntax

expression .SetThemeVariant(variantColor,variantStyle,embellishment)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data type | Description
variantColor | Required | INT16 | The index of the color variant to apply. Possible values are from 0 to 3.
variantStyle | Required | INT16 | The index of the style variant to apply. Possible values are from 0 to 3.
embellishment | Optional | INT16 | The index of the embellishment to apply. Possible values are from 1, for "low," to 3, for "high."

Return value

VOID

See also

Concepts

Page Object

Other resources

Page Members


Page.ShapeIDsToUniqueIDs Method (Visio)

 Copy code hover
[image]

Page.ShapeIDsToUniqueIDs Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of unique IDs of shapes on the page, as specified by their shape IDs.

Version Information

Version Added: Visio 2007

Syntax

expression .ShapeIDsToUniqueIDs(ShapeIDs(), UniqueIDArgs, GUIDs())

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ShapeIDs() | Required | Long | An array of type Long of shape IDs corresponding to a set of shapes on the active drawing page.
UniqueIDArgs | Required | VisUniqueIDArgs | Gets, deletes, or makes the unique ID of a Shape object. See Remarks for possible values.
GUIDs() | Required | String | Out parameter. An empty array that the method fills with unique IDs of type String corresponding to the shapes specified in ShapeIDs()

Return Value

Nothing

Remarks

Microsoft Visio identifies shapes by two different IDs: shape IDs and unique IDs. Shape IDs are numeric and uniquely identify shapes within the scope of an individual drawing page. They are not unique within a wider scope, however.

Unique IDs are globally unique identifiers (GUIDs). They are unique within the scope of the application.

To convert between shape IDs and unique IDs, you can use two methods of the Page object, ShapeIDsToUniqueIDs and UniqueIDsToShapeIDs.

By default, a shape does not have a unique ID. A shape acquires a unique ID only if you set its Shape.UniqueID property. If a Shape object has a unique ID, no other shape in any other document will have the same ID.

The UniqueIDArgs parameter sets and controls the behavior of the UniqueID property for all the shapes in ShapeIDs().UniqueIDArgs should have one of the following values declared in the Visio type library in VisUniqueIDArgs.

Constant | Value | Description
visGetGUID | 0 | Returns the unique ID string only if the shape already has a unique ID. Otherwise it returns a zero-length string ("").
visGetOrMakeGUID | 1 | Returns the unique ID string of the shape. If the shape does not yet have a unique ID, it assigns one to the shape and returns the new ID.
visDeleteGUID | 2 | Deletes the unique ID of a shape and returns a zero-length string ("").
visGetOrMakeGUIDWithUndo | 3 | Returns the unique ID string of the shape. If the shape does not already have a unique ID, assigns one to the shape and returns the new ID. Undoable.
visDeleteGUIDWithUndo | 4 | Clears the unique ID of a shape and returns a zero-length string (""). Undoable.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ShapeIDsToUniqueIDs method to determine the unique IDs of the shapes on the page passed to the method. It iterates through all the shapes on the active drawing page, using the Shape.UniqueID property to get the shape IDs of the shapes, and then passes an array of those IDs to the ShapeIDsToUniqueIDs method as the ShapeIDs() parameter to get the unique IDs of the shapes. For the UniqueIDArgs parameter, it passes the value visGetOrMakeGUID, telling Visio to create a unique ID for any shape that doesn't already have one. It prints the unique IDs and shape IDs to the Immediate window.

Before running this macro, open a Visio drawing and place several shapes on the active drawing page.

VBA Copy code Copy code
Public Sub ShapeIDsToUniqueIDs_Example()
    Dim vsoShape As Visio.Shape
    Dim intArrayCounter As Integer

    intShapeCount = ActivePage.Shapes.Count

    ReDim alngShapeIDs(intShapeCount - 1) As Long
    ReDim astrUniqueIDs(intShapeCount - 1) As String

    intArrayCounter = 0

    For Each vsoShape In ActivePage.Shapes
        alngShapeIDs(intArrayCounter) = vsoShape.ID
        Debug.Print alngShapeIDs(intArrayCounter)
        intArrayCounter = intArrayCounter + 1
    Next

    ActivePage.ShapeIDsToUniqueIDs alngShapeIDs, visGetOrMakeGUID, astrUniqueIDs

    intArrayCounter = 0

    For intArrayCounter = LBound(astrUniqueIDs) To UBound(astrUniqueIDs)
        Debug.Print astrUniqueIDs(intArrayCounter)
    Next

End Sub


Page.SplitConnector Method (Visio)

 Copy code hover
[image]

Page.SplitConnector Method (Visio)
Send feedback

Published: July 16, 2012

Splits the specified connector with the specified shape. Returns the new duplicated connector.

Version Information

Version Added: Visio 2010

Syntax

expression .SplitConnector(ConnectorToSplit, Shape)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ConnectorToSplit | Required | Shape | The connector to split. Must be a routable one-dimensional (1-D) connector.
Shape | Required | Shape | The shape to use to split the connector. Must be a two-dimensional (2-D) shape.

Return Value

Shape

Remarks

When you call SplitConnector, Microsoft Visio duplicates the connector (except for text), positions the shape automatically, and glues the shape to the two resulting connectors.


Page.UniqueIDsToShapeIDs Method (Visio)

 Copy code hover
[image]

Page.UniqueIDsToShapeIDs Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of shape IDs of shapes on the page, as specifed by their unique IDs.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .UniqueIDsToShapeIDs(GUIDs(), ShapeIDs())

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
GUIDs() | Required | String | An array of unique IDs of type String of shapes on the page.
ShapeIDs() | Required | Long | Out parameter. An empty array that the method fills with shape IDs of type Long corresponding to the shapes specified in GUIDs()

Return Value

Nothing

Remarks

Microsoft Visio identifies shapes by two different IDs: shape IDs and unique IDs. Shape IDs are numeric and uniquely identify shapes within the scope of an individual drawing page. They are not unique within a wider scope, however.

Unique IDs are globally unique identifiers (GUIDs). They are unique within the scope of the application.

To convert between shape IDs and unique IDs, you can use two methods of the Page object, ShapeIDsToUniqueIDs and UniqueIDsToShapeIDs.

By default, a shape does not have a unique ID. A shape acquires a unique ID only if you set its Shape.UniqueID property.

If a Shape object has a unique ID, no other shape in any other document will have the same ID.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the UniqueIDsToShapeIDs method to determine the shape IDs of the shapes on the page passed to the method as unique IDs. It iterates through all the shapes on the active drawing page, using the UniqueID property of each shape to get the unique IDs of the shapes. Then it passes those unique IDs to the UniqueIDsToShapeIDs method to return the shape IDs of the shapes. It prints the unique IDs and shape IDs to the Immediate window.

Before running this macro, open a Visio drawing and place several shapes on the active drawing page.

VBA Copy code Copy code
Public Sub UniqueIDsToShapeIDs_Example()

    Dim vsoShape As Visio.Shape
    Dim intArrayCounter As Integer
    Dim intShapeCount As Integer

    intShapeCount = ActivePage.Shapes.Count

    ReDim astrUniqueIDs(intShapeCount - 1) As String
    ReDim alngShapeIDs(intShapeCount - 1) As Long

    intArrayCounter = 0

    For Each vsoShape In ActivePage.Shapes
        astrUniqueIDs(intArrayCounter) = vsoShape.UniqueID(1)
        Debug.Print astrUniqueIDs(intArrayCounter)
        intArrayCounter = intArrayCounter + 1
    Next

    ActivePage.UniqueIDsToShapeIDs astrUniqueIDs, alngShapeIDs

    intArrayCounter = 0

    For intArrayCounter = LBound(alngShapeIDs) To UBound(alngShapeIDs)
        Debug.Print alngShapeIDs(intArrayCounter)
    Next

End Sub


Page Events (Visio)

 Copy code hover
[image]

Page Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
AfterReplaceShapes | Occurs after a shape-replacement operation.
BeforePageDelete | Occurs before a page is deleted.
BeforeReplaceShapes | Occurs just before a shape-replacement operation.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
CalloutRelationshipAdded | Occurs when a new callout relationship is added to the page.
CalloutRelationshipDeleted | Occurs when a callout relationship is deleted from the page.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ContainerRelationshipAdded | Occurs when a new container relationship is added to the document.
ContainerRelationshipDeleted | Occurs when a container relationship is deleted from the document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelReplaceShapes | Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
ReplaceShapesCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.


Page.AfterReplaceShapes Event (Visio)

 Copy code hover
[image]

Page.AfterReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs after a shape-replacement operation.

Syntax

expression .AfterReplaceShapes(sel)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data type | Description
sel | Required | IVSELECTION | A Selection object that represents the replacement shape or shapes.

See also

Concepts

Page Object

Other resources

Page Members


Page.BeforePageDelete Event (Visio)

 Copy code hover
[image]

Page.BeforePageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a page is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforePageDelete(ByVal Page As [IVPAGE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.BeforeReplaceShapes Event (Visio)

 Copy code hover
[image]

Page.BeforeReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs just before a shape-replacement operation.

Syntax

expression .BeforeReplaceShapes(replaceShapes)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.

See also

Concepts

Page Object

Other resources

Page Members


Page.BeforeSelectionDelete Event (Visio)

 Copy code hover
[image]

Page.BeforeSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before selected objects are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selected objects that are going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. To find out if a shape is locked against deletion, check the value of its LockDelete cell.

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.BeforeShapeDelete Event (Visio)

 Copy code hover
[image]

Page.BeforeShapeDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is deleted.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeShapeDelete(ByVal Shape As [IVSHAPE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeShapeDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use the VBA WithEvents keyword to sink the BeforeShapeDelete event.

For performance considerations, the Document object's event set does not include the BeforeShapeDelete event. To sink the BeforeShapeDelete event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Page.BeforeShapeTextEdit Event (Visio)

 Copy code hover
[image]

Page.BeforeShapeTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is opened for text editing in the user interface.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _BeforeShapeTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be opened for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.CalloutRelationshipAdded Event (Visio)

 Copy code hover
[image]

Page.CalloutRelationshipAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a new callout relationship is added to the page.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _CalloutRelationshipAdded(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the new callout shape-pair relationship.

Remarks

The RelatedShapePairEvent object returned by this event contains two shapes: the callout, represented by the FromShapeID property of the RelatedShapePairEvent object; and the target shape, represented by the ToShapeID property.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Page.CalloutRelationshipDeleted Event (Visio)

 Copy code hover
[image]

Page.CalloutRelationshipDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a callout relationship is deleted from the page.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _CalloutRelationshipDeleted(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the callout shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively. When Microsoft Visio deletes both shapes in the container relationship simultaneously, for example when both shapes are deleted from a drawing as part of a selection, the event does not fire.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event that you want to create, see Event Codes.


Page.CellChanged Event (Visio)

 Copy code hover
[image]

Page.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


Page.ConnectionsAdded Event (Visio)

 Copy code hover
[image]

Page.ConnectionsAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections have been established between shapes.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsAdded(ByVal Connects As [IVCONNECTS])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that were established.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsAdded event. To sink the ConnectionsAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Page.ConnectionsDeleted Event (Visio)

 Copy code hover
[image]

Page.ConnectionsDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections between shapes have been removed.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsDeleted(ByVal Connects As [IVCONNECTS])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that have been removed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsDeleted event. To sink the ConnectionsDeleted event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Page.ContainerRelationshipAdded Event (Visio)

 Copy code hover
[image]

Page.ContainerRelationshipAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a new container relationship is added to the document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _ContainerRelationshipAdded(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the new container shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Page.ContainerRelationshipDeleted Event (Visio)

 Copy code hover
[image]

Page.ContainerRelationshipDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a container relationship is deleted from the document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _ContainerRelationshipDeleted(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the container shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively. When Microsoft Visio deletes both shapes in the container relationship simultaneously, for example when both shapes are deleted from a drawing as part of a selection, the event does not fire.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Page.ConvertToGroupCanceled Event (Visio)

 Copy code hover
[image]

Page.ConvertToGroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ConvertToGroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.FormulaChanged Event (Visio)

 Copy code hover
[image]

Page.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Page.GroupCanceled Event (Visio)

 Copy code hover
[image]

Page.GroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _GroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.PageChanged Event (Visio)

 Copy code hover
[image]

Page.PageChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageChanged(ByVal Page As [IVPAGE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that changed.

Remarks

If several pages of a document have default names and any page but the last is deleted, Microsoft Visio will automatically rename the remaining pages to preserve the naming sequence, but the renaming will not trigger the PageChanged event. For example, if a document contains Page-1, Page-2, and Page-3, and then Page-1 is deleted, Page-2 will be renamed Page-1, and Page-3 will be renamed Page-2, but no PageChanged event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.PageDeleteCanceled Event (Visio)

 Copy code hover
[image]

Page.PageDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _PageDeleteCanceled(ByVal Page As [IVPAGE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was going to be deleted.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.QueryCancelConvertToGroup Event (Visio)

 Copy code hover
[image]

Page.QueryCancelConvertToGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelConvertToGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be converted to a group.

Remarks

A Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • If all handlers return False (don't cancel), the conversion is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.QueryCancelGroup Event (Visio)

 Copy code hover
[image]

Page.QueryCancelGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be grouped.

Remarks

A Microsoft Visio instance fires QueryCancelGroup after the user has directed the instance to group a selection of shapes.

  • If any event handler returns True (cancel), the instance fires GroupCanceled and does not group the shapes.

  • If all handlers return False (do not cancel), the grouping is performed.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.QueryCancelPageDelete Event (Visio)

 Copy code hover
[image]

Page.QueryCancelPageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelPageDelete(ByVal Page As [IVPAGE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

A Visio instance fires QueryCancelPageDelete after the user has directed the instance to delete a page.

  • If any event handler returns True (cancel), the instance fires PageDeleteCanceled and does not delete the page.

  • If all handlers return False (don't cancel) the instance fires BeforePageDelete and then deletes the page.

While a Microsoft Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.QueryCancelReplaceShapes Event (Visio)

 Copy code hover
[image]

Page.QueryCancelReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.

Syntax

expression .QueryCancelReplaceShapes(replaceShapes)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.
lpboolRet | Required | BOOL |

See also

Concepts

Page Object

Other resources

Page Members


Page.QueryCancelSelectionDelete Event (Visio)

 Copy code hover
[image]

Page.QueryCancelSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelSelectionDelete after the user has directed the instance to delete one or more shapes.

  • If any event handler returns True (cancel), the instance fires SelectionDeleteCanceled and does not delete the shapes.

  • If all handlers returnFalse (don't cancel), the instance fires BeforeSelectionDelete and BeforeShapeDelete and then deletes the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.QueryCancelUngroup Event (Visio)

 Copy code hover
[image]

Page.QueryCancelUngroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelUngroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be ungrouped.

Remarks

A Microsoft Visio instance fires QueryCancelUngroup after the user has directed the instance to ungroup one or more shapes.

  • If any event handler returns True (cancel), the instance fires UngroupCanceled and does not ungroup the shapes.

  • If all handlers return False (don't cancel), the instance fires ShapeParentChanged, BeforeSelectionDelete, and BeforeShapeDelete, and then ungroups the shapes.

While a Visio instance is firing a query or cancel event, it respondsto inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.ReplaceShapesCanceled Event (Visio)

 Copy code hover
[image]

Page.ReplaceShapesCanceled Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.

Syntax

expression .ReplaceShapesCanceled(replaceShapes)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.

See also

Concepts

Page Object

Other resources

Page Members


Page.SelectionAdded Event (Visio)

 Copy code hover
[image]

Page.SelectionAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionAdded(ByVal Selection As [IVSELECTION])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the SelectionAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the SelectionAdded event.

For performance considerations, the Document object's event set does not include the SelectionAdded event. To sink the SelectionAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Page.SelectionDeleteCanceled Event (Visio)

 Copy code hover
[image]

Page.SelectionDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _SelectionDeleteCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.ShapeAdded Event (Visio)

 Copy code hover
[image]

Page.ShapeAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _ShapeAdded(ByVal Shape As [IVSHAPE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape or group of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the ShapeAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

To determine if a ShapeAdded event was triggered by a new shape or group of shapes being added to the page, by a set of existing shapes being grouped, or by a paste action, you can use the Application.IsInScope property. If IsInScope returns True when passed visCmdObjectGroup, the ShapeAdded event was triggered by a grouping action. If IsInScope returns True when passed visCmdUFEditPaste or visCmdEditPasteSpecial, the ShapeAdded event was triggered by a paste operation. If IsInScope returns False when passed all of these arguments, the event must have been triggered by new shapes being added to the page.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square. Paste the code into the active document's project in Visio.

The DocumentSaved event handler runs when the active document is saved. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentSaved(ByVal vsoDocument As Visio.IVDocument)

 'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 'the shape was created locally.
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Page.ShapeChanged Event (Visio)

 Copy code hover
[image]

Page.ShapeChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a property of a shape that is not stored in a cell is changed in a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _ShapeChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose property changed.

Remarks

To determine which properties have changed when ShapeChanged fires, use the EventInfo property. The string returned by the EventInfo property contains a list of substrings that identify the properties that changed.

Changes to the following shape properties cause the ShapeChanged event to fire:

  • Name (the EventInfo property contains "/name")

  • Data1 (the EventInfo property contains "/data1")

  • Data2 (the EventInfo property contains "/data2")

  • Data3 (the EventInfo property contains "/data3")

  • UniqueID (the EventInfo property contains "/uniqueid")

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection that was created by using AddAdvise, the varMoreInfo argument to VisEventProc contains the string: "/doc=1 /page=1 /shape=Sheet.3"

Note Note

You can use VBA WithEvents variables to sink the ShapeChanged event.

For performance considerations, the Document object's event set does not include the ShapeChanged event. To sink the ShapeChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Page.ShapeDataGraphicChanged Event (Visio)

 Copy code hover
[image]

Page.ShapeDataGraphicChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a data graphic is applied to or deleted from a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeDataGraphicChanged(ByVal Shape As IVSHAPE)

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape to which the data graphic was applied or from which it was deleted.

Remarks

A data graphic is a Master object of type visTypeDataGraphic. When the same master that is already applied to a shape is re-applied to the shape, the ShapeDataGraphicChanged event does not fire, even if the master has been modified since it was applied originally. If, however, a different data graphic master is applied to the shape, the event does fire.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.ShapeExitedTextEdit Event (Visio)

 Copy code hover
[image]

Page.ShapeExitedTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is no longer open for interactive text editing.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeExitedTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that was closed for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.ShapeLinkAdded Event (Visio)

 Copy code hover
[image]

Page.ShapeLinkAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is linked to a data row.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkAdded(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long)

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is linked to data.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row linked to the shape.
DataRowID | Required | Long | The ID of the data row linked to the shape.

Remarks

The ShapeLinkAdded event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkAdded event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.ShapeLinkDeleted Event (Visio)

 Copy code hover
[image]

Page.ShapeLinkDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the link between a shape and a data row is deleted.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkDeleted(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long )

expression An expression that returns a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose link to a data row was broken.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row that was linked to the shape.
DataRowID | Required | Long | The ID of the data row that was linked to the shape.

Remarks

The ShapeLinkDeleted event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkDeleted event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.ShapeParentChanged Event (Visio)

 Copy code hover
[image]

Page.ShapeParentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after shapes are grouped or a group is ungrouped.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeParentChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose parent changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Page.TextChanged Event (Visio)

 Copy code hover
[image]

Page.TextChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the text of a shape is changed in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _TextChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose text changed.

Remarks

The TextChanged event is fired when the raw text of a shape changes, such as when the characters Microsoft Visio stores for the shape change. If a shape's characters change because a user is typing, the TextChanged event does not fire until the text editing session terminates.

When a field is added to or removed from a shape's text, its raw text changes; hence, a TextChanged event fires. However, no TextChanged event fires when the text in a field changes. For example, a shape has a text field that shows its width. A TextChanged event does not fire when the shape's width changes, because the raw text stored for the shape has not changed, even though the apparent (expanded) text of the shape does change. Use the CellChanged event for one of the cells in the Text Fields section to detect when the text in a text field changes.

To access a shape's raw text, use the Text property. To access the text of a shape in which text fields have been expanded, use the Characters.Text property. You can determine the location and properties of text fields in a shape's text by using the Shape.Characters object.

In Visio 5.0 and earlier versions, the raw characters reported by the Text property for a field included four characters, the first being the escape character. Starting with Visio 2000, only a single escape character is present in the raw text stream.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the TextChanged event.

For performance considerations, the Document object's event set does not include the TextChanged event. To sink the TextChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Page.UngroupCanceled Event (Visio)

 Copy code hover
[image]

Page.UngroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _UngroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be ungrouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages Object (Visio)

 Copy code hover
[image]

Pages Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Page object for each drawing page in a document.

Remarks

To retrieve a Pages collection, use the Pages property of a Document object.

The default property of a Pages collection is Item.

The order of items in a Pages collection is significant: if there are n foreground pages in a document, the first n pages in its Pages collection are foreground pages and are in order. The remaining pages in the collection are the background pages of the document; these are in no particular order.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this collection maps to the following types:

  • Microsoft.Office.Interop.Visio.IVPages


Pages Members (Visio)

 Copy code hover
[image]

Pages Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Page object for each drawing page in a document.

Events

Name | Description
AfterReplaceShapes | Occurs after a shape-replacement operation.
BeforePageDelete | Occurs before a page is deleted.
BeforeReplaceShapes | Occurs just before a shape-replacement operation.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
CalloutRelationshipAdded | Occurs when a new callout relationship is added to a page.
CalloutRelationshipDeleted | Occurs when a callout relationship is deleted from a page.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ContainerRelationshipAdded | Occurs when a new container relationship is added to the document.
ContainerRelationshipDeleted | Occurs when a container relationship is deleted from the document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
PageAdded | Occurs after a new page is added to a document.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelReplaceShapes | Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
ReplaceShapesCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Methods

Name | Description
Add | Adds a new object to a collection.
GetNames | Returns the names of all items in a collection.
GetNamesU | Returns the universal names of all items in a collection.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Stat | Returns status information for an object. Read-only.


Pages Properties (Visio)

 Copy code hover
[image]

Pages Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Stat | Returns status information for an object. Read-only.


Pages.Application Property (Visio)

 Copy code hover
[image]

Pages.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Pages object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Pages.Count Property (Visio)

 Copy code hover
[image]

Pages.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Pages object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Pages.Document Property (Visio)

 Copy code hover
[image]

Pages.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Pages object.

Return Value

Document


Pages.EventList Property (Visio)

 Copy code hover
[image]

Pages.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Pages object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Pages.Item Property (Visio)

 Copy code hover
[image]

Pages.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameUIDOrIndex)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
NameUIDOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

Page

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVPages.this[object]

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Item property to get a Page object from the Pages collection of the active document, and all the Shape objects in the Shapes collection of the Page object. It prints the names of all shapes on Page1 in the Immediate window.

Before running this macro, make sure that the active document has shapes on Page1.

VBA Copy code Copy code

Public Sub Item_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.Item(1).Shapes

    Debug.Print "Shape Name List For..."
    Debug.Print "Document: "; ActiveDocument.Name
    Debug.Print "Page: "; ActiveDocument.Pages.Item(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then
        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.Item(intCounter).Name
        Next intCounter
    Else
        Debug.Print " No Shapes On Page"
    End If

End Sub


Pages.ItemFromID Property (Visio)

 Copy code hover
[image]

Pages.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item of a collection using the ID of the item. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemFromID(nID)

expression A variable that represents a Pages collection.

Parameters

Name | Required/Optional | Data Type | Description
nID | Required | Long | The ID of the object to retrieve.

Return Value

Page

Remarks

The ID of a Shape object uniquely identifies the shape within its page or master.

The ID of a Style object uniquely identifies the style within its document.

The ID of a Font object corresponds to the number stored in the Font cell of a row in a shape's Character Properties section. The ID associated with a particular font varies between systems or as fonts are installed on and removed from a given system.

The ID of an Event object uniquely identifies an event in its EventList collection for the life of the collection.


Pages.ItemU Property (Visio)

 Copy code hover
[image]

Pages.ItemU Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ItemU(NameOrIndex)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the universal name, unique ID, or index of the object to retrieve.

Return Value

Page

Remarks

You can retrieve an object in an Addons, Hyperlinks, Layers, Masters, MasterShortcuts, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

If you retrieve a Shape object by name, the ItemU property searches all shapes in the Shapes collection's containing page or containing master, in addition to the collection's containing shape. Therefore, the Shape object returned by the ItemU property can be a shape that is not in the Shapes collection.

You can also pass the unique ID string of a Master or Shape object to the ItemU property. For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

If such a string is passed to the ItemU property of a Shapes collection, all the shapes contained in the collection are searched. Shapes within the group shapes in the containing shape are not searched.

To search all shapes in the collection, plus the shapes inside groups and the containing shape of the collection, prefix the unique ID string with an asterisk (*). For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")
Note Note

  • In Visio 2000 only, vsoShapes.ItemU("{guid}") examined the Shapes collection's containing shape and all descendants, and vsoShapes.ItemU("*{guid}") examined all shapes in the Shapes collection's containing page or containing master.

  • Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

    As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

Example

This Microsoft Visual Basic macro shows how to use the ItemU property of the Pages collection to get the Shapes collection. Then it uses the ItemU property of the Shapes collection to print the universal names of all shapes on Page-1 in the Immediate window.

To run this macro, make sure the active document has shapes on Page-1.

VBA Copy code Copy code
Public Sub ItemU_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.ItemU(1).Shapes

    Debug.Print "Shapes in Document: "; ActiveDocument.Name
    Debug.Print "          on  Page: "; ActiveDocument.Pages.ItemU(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then

        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.ItemU(intCounter).Name
        Next intCounter

    Else

        Debug.Print " No Shapes On Page"

    End If

End Sub


Pages.ObjectType Property (Visio)

 Copy code hover
[image]

Pages.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Pages object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Pages.PersistsEvents Property (Visio)

 Copy code hover
[image]

Pages.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Pages object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Pages.Stat Property (Visio)

 Copy code hover
[image]

Pages.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Pages object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Pages Methods (Visio)

 Copy code hover
[image]

Pages Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.
GetNames | Returns the names of all items in a collection.
GetNamesU | Returns the universal names of all items in a collection.


Pages.Add Method (Visio)

 Copy code hover
[image]

Pages.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents a Pages object.

Return Value

Page

Remarks

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.

Example

The following macro shows how to add Master objects to the Masters collection and Page objects to the Pages collection. It also shows how to add documents, layers, styles, events, and add-ons to their corresponding collections.

Before running this macro, replace Myfile.vsd with a valid .vsd file and references to path\filename and filename with a valid path and/or file name to an execuatable add-on (EXE) in your Visio project. The add-on should take no arguments.

VBA Copy code Copy code
Public Sub Add_Example()

 Dim vsoMasters As Visio.Masters
 Dim vsoAddons As Visio.Addons
 Dim vsoPages As Visio.Pages
 Dim vsoEventList As Visio.EventList
 Dim vsoLayers As Visio.Layers
 Dim vsoLayer As Visio.Layer
 Dim vsoStyles As Visio.Styles

 Dim vsoDocument As Visio.Document
 Dim vsoEvent As Visio.Event
 Dim vsoMaster As Visio.Master
 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoStyle As Visio.Style
 Dim vsoAddon As Visio.Addon

 'Add a document based on the Basic Diagram template.
 Set vsoDocument = Documents.Add("Basic Diagram.vst")

 'Add a document based on a drawing (creates a copy of the drawing).
 Set vsoDocument = Documents.Add("Myfile.vsd")

 'Add a document based on a stencil (creates a copy of the stencil).
 Set vsoDocument = Documents.Add("Basic Shapes.vss")

 'Add a document object based on no template.
 Set vsoDocument = Documents.Add("")

 'Get the Pages collection and add a page to the collection.
 Set vsoPages = vsoDocument.Pages
 Set vsoPage = vsoPages.Add

 'Get the Masters collection and add a master to the collection.
 Set vsoMasters = vsoDocument.Masters
 Set vsoMaster = vsoMasters.Add

 'Get the Layers collection and add a layer named "MyLayer"
 'to the collection.
 Set vsoLayers = vsoPage.Layers
 Set vsoLayer = vsoLayers.Add("MyLayer")

 'Draw a rectangle.
 Set vsoShape = vsoPage.DrawRectangle(3, 3, 5, 6)

 'Add this shape to MyLayer. The second argument is required but has
 'no effect, because vsoShape is not a group shape.
 vsoLayer.Add vsoShape, 0

 'Add a style named "My FillStyle" to the Styles collection.
 'This style is based on the Basic style and includes
 'only a Fill style.
 Set vsoStyles = vsoDocument.Styles
 Set vsoStyle = vsoStyles.Add("My FillStyle", "Basic", False, False, True)

 'Add a style named "My NoStyle" to the Styles collection.
 'This style is based on no style and includes
 'Text, Line, and Fill styles.
 Set vsoStyle = vsoStyles.Add("My NoStyle", "", True, True, True)

 'Add an add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add("path\filename")

 'Add a BeforeDeleteSelection event to the EventList collection
 'of the document. The event will start your add-on, which
 'takes no arguments.
 Set vsoEventList = vsoDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtCodeBefSelDel, visActCodeRunAddon, _
 "filename", "")

End Sub


Pages.GetNames Method (Visio)

 Copy code hover
[image]

Pages.GetNames Method (Visio)
Send feedback

Published: July 16, 2012

Returns the names of all items in a collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNames(localeSpecificNameArray())

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
localeSpecificNameArray() | Required | String | Out parameter. An array that receives names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNames method succeeds, localeSpecificNameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. localeSpecificNameArray() is an out parameter that is allocated by the GetNames method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.

Example

The following macro shows how to use the GetNames method to get the names of all the Master objects in the Masters collection of the active document and print them in the Immediate window.

VBA Copy code Copy code

Public Sub GetNames_Example()

 Dim strMasterNames() As String
 Dim intLowerBound As Integer
 Dim intUpperBound As Integer

 ActiveDocument.Masters.GetNames strMasterNames
 intLowerBound = LBound(strMasterNames)
 intUpperBound = UBound(strMasterNames)
 Debug.Print ActiveDocument; " Lower bound:"; intLowerBound; "Upper bound:"; intUpperBound

 While intLowerBound <= intUpperBound

 Debug.Print strMasterNames (intLowerBound)
 intLowerBound = intLowerBound + 1

 Wend

End Sub


Pages.GetNamesU Method (Visio)

 Copy code hover
[image]

Pages.GetNamesU Method (Visio)
Send feedback

Published: July 16, 2012

Returns the universal names of all items in a collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNamesU(localeIndependentNameArray())

expression A variable that represents a Pages collection.

Parameters

Name | Required/Optional | Data Type | Description
localeIndependentNameArray() | Required | String | Out parameter. An array that receives the names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNamesU method succeeds, localeIndependentNameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. The localeIndependentNameArray() parameter is an out parameter that is allocated by the GetNamesU method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.


Pages Events (Visio)

 Copy code hover
[image]

Pages Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
AfterReplaceShapes | Occurs after a shape-replacement operation.
BeforePageDelete | Occurs before a page is deleted.
BeforeReplaceShapes | Occurs just before a shape-replacement operation.
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
CalloutRelationshipAdded | Occurs when a new callout relationship is added to a page.
CalloutRelationshipDeleted | Occurs when a callout relationship is deleted from a page.
CellChanged | Occurs after the value changes in a cell in a document.
ConnectionsAdded | Occurs after connections have been established between shapes.
ConnectionsDeleted | Occurs after connections between shapes have been removed.
ContainerRelationshipAdded | Occurs when a new container relationship is added to the document.
ContainerRelationshipDeleted | Occurs when a container relationship is deleted from the document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
PageAdded | Occurs after a new page is added to a document.
PageChanged | Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.
PageDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelPageDelete | Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelReplaceShapes | Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
ReplaceShapesCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.


Pages.AfterReplaceShapes Event (Visio)

 Copy code hover
[image]

Pages.AfterReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs after a shape-replacement operation.

Syntax

expression .AfterReplaceShapes(sel)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data type | Description
sel | Required | IVSELECTION | A Selection object that represents the replacement shape or shapes.

See also

Concepts

Pages Object

Other resources

Pages Members


Pages.BeforePageDelete Event (Visio)

 Copy code hover
[image]

Pages.BeforePageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a page is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforePageDelete(ByVal Page As [IVPAGE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.BeforeReplaceShapes Event (Visio)

 Copy code hover
[image]

Pages.BeforeReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs just before a shape-replacement operation.

Syntax

expression .BeforeReplaceShapes(replaceShapes)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.

See also

Concepts

Pages Object

Other resources

Pages Members


Pages.BeforeSelectionDelete Event (Visio)

 Copy code hover
[image]

Pages.BeforeSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before selected objects are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selected objects that are going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. To find out if a shape is locked against deletion, check the value of its LockDelete cell.

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.BeforeShapeDelete Event (Visio)

 Copy code hover
[image]

Pages.BeforeShapeDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is deleted.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeShapeDelete(ByVal Shape As [IVSHAPE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeShapeDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use the VBA WithEvents keyword to sink the BeforeShapeDelete event.

For performance considerations, the Document object's event set does not include the BeforeShapeDelete event. To sink the BeforeShapeDelete event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Pages.BeforeShapeTextEdit Event (Visio)

 Copy code hover
[image]

Pages.BeforeShapeTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is opened for text editing in the user interface.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _BeforeShapeTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be opened for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.CalloutRelationshipAdded Event (Visio)

 Copy code hover
[image]

Pages.CalloutRelationshipAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a new callout relationship is added to a page.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _CalloutRelationshipAdded(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the new callout shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event that you want to create, see Event Codes.


Pages.CalloutRelationshipDeleted Event (Visio)

 Copy code hover
[image]

Pages.CalloutRelationshipDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a callout relationship is deleted from a page.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _CalloutRelationshipDeleted(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the callout shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively. When Microsoft Visio deletes both shapes in the callout relationship simultaneously, for example when both shapes are deleted from a drawing as part of a selection, the event does not fire.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event that you want to create, see Event Codes.


Pages.CellChanged Event (Visio)

 Copy code hover
[image]

Pages.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


Pages.ConnectionsAdded Event (Visio)

 Copy code hover
[image]

Pages.ConnectionsAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections have been established between shapes.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsAdded(ByVal Connects As [IVCONNECTS])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that were established.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsAdded event. To sink the ConnectionsAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Pages.ConnectionsDeleted Event (Visio)

 Copy code hover
[image]

Pages.ConnectionsDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after connections between shapes have been removed.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _ConnectionsDeleted(ByVal Connects As [IVCONNECTS])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Connects | Required | [IVCONNECTS] | The connections that have been removed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the ConnectionsDeleted event.

For performance considerations, the Document object's event set does not include the ConnectionsDeleted event. To sink the ConnectionsDeleted event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Pages.ContainerRelationshipAdded Event (Visio)

 Copy code hover
[image]

Pages.ContainerRelationshipAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a new container relationship is added to the document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _ContainerRelationshipAdded(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the new container shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Pages.ContainerRelationshipDeleted Event (Visio)

 Copy code hover
[image]

Pages.ContainerRelationshipDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a container relationship is deleted from the document.

Version Information

Version Added: Visio 2010

Syntax

Private Sub expression _ContainerRelationshipDeleted(By Val ShapePair As RelatedShapePairEvent)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
ShapePair | Required | RelatedShapePairEvent | An object that represents the container shape-pair relationship.

Remarks

The RelatedShapePairEvent object that this event returns contains two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively. When Microsoft Visio deletes both shapes in the container relationship simultaneously, for example when both shapes are deleted from a drawing as part of a selection, the event does not fire.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the EventList.Add or EventList.AddAdvise method. To create an Event object that runs an add-on, use the EventList.Add method. To create an Event object that receives notification, use the EventList.AddAdvise method. To find an event code for the event you want to create, see Event Codes.


Pages.ConvertToGroupCanceled Event (Visio)

 Copy code hover
[image]

Pages.ConvertToGroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ConvertToGroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.FormulaChanged Event (Visio)

 Copy code hover
[image]

Pages.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Pages.GroupCanceled Event (Visio)

 Copy code hover
[image]

Pages.GroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _GroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.PageAdded Event (Visio)

 Copy code hover
[image]

Pages.PageAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new page is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageAdded(ByVal Page As [IVPAGE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was added.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This example shows how to create a class module to handle events fired by a source object in Microsoft Visio, for example, the Document object. The module consists of the function VisEventProc, which uses a Select Case block to check for three events: DocumentSaved, PageAdded, and ShapesDeleted. Other events fall under the default case (Case Else). Each Case block constructs a string (strMessage) that contains the name and event code of the event that fired. Finally, the function displays the string in the Immediate window.

Copy this sample code into a new class module in VBA or Visual Basic, naming the module clsEventSink. You can then use an event-sink module to create an instance of the clsEventSink class and Event objects that send notifications of event firings to the class instance. To see how to create an event-sink module, refer to the example for the AddAdvise method.

VBA Copy code Copy code

Implements Visio.IVisEventProc

'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000

Private Function IVisEventProc_VisEventProc( _
 ByVal nEventCode As Integer, _
 ByVal pSourceObj As Object, _
 ByVal nEventID As Long, _
 ByVal nEventSeqNum As Long, _
 ByVal pSubjectObj As Object, _
 ByVal vMoreInfo As Variant) As Variant

 Dim strMessage As String

 'Find out which event fired
 Select Case nEventCode
 Case visEvtCodeDocSave
 strMessage = "DocumentSaved (" & nEventCode & ")"
 Case (visEvtPage + visEvtAdd)
 strMessage = "PageAdded (" & nEventCode & ")"
 Case visEvtCodeShapeDelete
 strMessage = "ShapesDeleted(" & nEventCode & ")"
 Case Else
 strMessage = "Other (" & nEventCode & ")"
 End Select

 'Display the event name and the event code
 Debug.Print strMessage

End Function


Pages.PageChanged Event (Visio)

 Copy code hover
[image]

Pages.PageChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _PageChanged(ByVal Page As [IVPAGE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that changed.

Remarks

If several pages of a document have default names and any page but the last is deleted, Microsoft Visio will automatically rename the remaining pages to preserve the naming sequence, but the renaming will not trigger the PageChanged event. For example, if a document contains Page-1, Page-2, and Page-3, and then Page-1 is deleted, Page-2 will be renamed Page-1, and Page-3 will be renamed Page-2, but no PageChanged event occurs.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.PageDeleteCanceled Event (Visio)

 Copy code hover
[image]

Pages.PageDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _PageDeleteCanceled(ByVal Page As [IVPAGE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that was going to be deleted.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.QueryCancelConvertToGroup Event (Visio)

 Copy code hover
[image]

Pages.QueryCancelConvertToGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelConvertToGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be converted to a group.

Remarks

A Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • If all handlers return False (don't cancel), the conversion is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.QueryCancelGroup Event (Visio)

 Copy code hover
[image]

Pages.QueryCancelGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be grouped.

Remarks

A Microsoft Visio instance fires QueryCancelGroup after the user has directed the instance to group a selection of shapes.

  • If any event handler returns True (cancel), the instance fires GroupCanceled and not group the shapes.

  • If all handlers return False (do not cancel), the grouping is performed.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you use Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.QueryCancelPageDelete Event (Visio)

 Copy code hover
[image]

Pages.QueryCancelPageDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelPageDelete(ByVal Page As [IVPAGE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | [IVPAGE] | The page that is going to be deleted.

Remarks

A Visio instance fires QueryCancelPageDelete after the user has directed the instance to delete a page.

  • If any event handler returns True (cancel), the instance fires PageDeleteCanceled and does not delete the page.

  • If all handlers return False (don't cancel) the instance fires BeforePageDelete and then deletes the page.

While a Microsoft Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.QueryCancelReplaceShapes Event (Visio)

 Copy code hover
[image]

Pages.QueryCancelReplaceShapes Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs immediately after a shape-replacement operation is requested. If any event handler returns True, the operation is canceled.

Syntax

expression .QueryCancelReplaceShapes(replaceShapes)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.
lpboolRet | Required | BOOL |

See also

Concepts

Pages Object

Other resources

Pages Members


Pages.QueryCancelSelectionDelete Event (Visio)

 Copy code hover
[image]

Pages.QueryCancelSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelSelectionDelete after the user has directed the instance to delete one or more shapes.

  • If any event handler returns True (cancel), the instance fires SelectionDeleteCanceled and does not delete the shapes.

  • If all handlers returnFalse (don't cancel), the instance fires BeforeSelectionDelete and BeforeShapeDelete and then deletes the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.QueryCancelUngroup Event (Visio)

 Copy code hover
[image]

Pages.QueryCancelUngroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelUngroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be ungrouped.

Remarks

A Microsoft Visio instance fires QueryCancelUngroup after the user has directed the instance to ungroup one or more shapes.

  • If any event handler returns True (cancel), the instance fires UngroupCanceled and does not ungroup the shapes.

  • If all handlers return False (don't cancel), the instance fires ShapeParentChanged, BeforeSelectionDelete, and BeforeShapeDelete, and then ungroups the shapes.

While a Visio instance is firing a query or cancel event, it respondsto inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.ReplaceShapesCanceled Event (Visio)

 Copy code hover
[image]

Pages.ReplaceShapesCanceled Event (Visio)
See also Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelReplaceShapes event.

Syntax

expression .ReplaceShapesCanceled(replaceShapes)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data type | Description
replaceShapes | Required | REPLACESHAPESEVENT | An object whose properties return information about the shape-replacement operation.

See also

Concepts

Pages Object

Other resources

Pages Members


Pages.SelectionAdded Event (Visio)

 Copy code hover
[image]

Pages.SelectionAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionAdded(ByVal Selection As [IVSELECTION])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the SelectionAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the SelectionAdded event.

For performance considerations, the Document object's event set does not include the SelectionAdded event. To sink the SelectionAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Pages.SelectionDeleteCanceled Event (Visio)

 Copy code hover
[image]

Pages.SelectionDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _SelectionDeleteCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.ShapeAdded Event (Visio)

 Copy code hover
[image]

Pages.ShapeAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _ShapeAdded(ByVal Shape As [IVSHAPE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape or group of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the ShapeAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

To determine if a ShapeAdded event was triggered by a new shape or group of shapes being added to the page, by a set of existing shapes being grouped, or by a paste action, you can use the Application.IsInScope property. If IsInScope returns True when passed visCmdObjectGroup, the ShapeAdded event was triggered by a grouping action. If IsInScope returns True when passed visCmdUFEditPaste or visCmdEditPasteSpecial, the ShapeAdded event was triggered by a paste operation. If IsInScope returns False when passed all of these arguments, the event must have been triggered by new shapes being added to the page.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square. Paste the code into the active document's project in Visio.

The DocumentSaved event handler runs when the active document is saved. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentSaved(ByVal vsoDocument As Visio.IVDocument)

 'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 'the shape was created locally.
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Pages.ShapeChanged Event (Visio)

 Copy code hover
[image]

Pages.ShapeChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a property of a shape that is not stored in a cell is changed in a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _ShapeChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose property changed.

Remarks

To determine which properties have changed when ShapeChanged fires, use the EventInfo property. The string returned by the EventInfo property contains a list of substrings that identify the properties that changed.

Changes to the following shape properties cause the ShapeChanged event to fire:

  • Name (the EventInfo property contains "/name")

  • Data1 (the EventInfo property contains "/data1")

  • Data2 (the EventInfo property contains "/data2")

  • Data3 (the EventInfo property contains "/data3")

  • UniqueID (the EventInfo property contains "/uniqueid")

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection that was created by using AddAdvise, the varMoreInfo argument to VisEventProc contains the string: "/doc=1 /page=1 /shape=Sheet.3"

Note Note

You can use VBA WithEvents variables to sink the ShapeChanged event.

For performance considerations, the Document object's event set does not include the ShapeChanged event. To sink the ShapeChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Pages.ShapeDataGraphicChanged Event (Visio)

 Copy code hover
[image]

Pages.ShapeDataGraphicChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a data graphic is applied to or deleted from a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeDataGraphicChanged(ByVal Shape As IVSHAPE)

expression An expression that returns a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape to which the data graphic was applied or from which it was deleted.

Remarks

A data graphic is a Master object of type visTypeDataGraphic. When the same master that is already applied to a shape is re-applied to the shape, the ShapeDataGraphicChanged event does not fire, even if the master has been modified since it was applied originally. If, however, a different data graphic master is applied to the shape, the event does fire.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.ShapeExitedTextEdit Event (Visio)

 Copy code hover
[image]

Pages.ShapeExitedTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is no longer open for interactive text editing.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeExitedTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that was closed for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.ShapeLinkAdded Event (Visio)

 Copy code hover
[image]

Pages.ShapeLinkAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is linked to a data row.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkAdded(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long)

expression An expression that returns a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is linked to data.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row linked to the shape.
DataRowID | Required | Long | The ID of the data row linked to the shape.

Remarks

The ShapeLinkAdded event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkAdded event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.ShapeLinkDeleted Event (Visio)

 Copy code hover
[image]

Pages.ShapeLinkDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the link between a shape and a data row is deleted.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkDeleted(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long )

expression An expression that returns a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose link to a data row was broken.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row that was linked to the shape.
DataRowID | Required | Long | The ID of the data row that was linked to the shape.

Remarks

The ShapeLinkDeleted event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkDeleted event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.ShapeParentChanged Event (Visio)

 Copy code hover
[image]

Pages.ShapeParentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after shapes are grouped or a group is ungrouped.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeParentChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose parent changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Pages.TextChanged Event (Visio)

 Copy code hover
[image]

Pages.TextChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the text of a shape is changed in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _TextChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose text changed.

Remarks

The TextChanged event is fired when the raw text of a shape changes, such as when the characters Microsoft Visio stores for the shape change. If a shape's characters change because a user is typing, the TextChanged event does not fire until the text editing session terminates.

When a field is added to or removed from a shape's text, its raw text changes; hence, a TextChanged event fires. However, no TextChanged event fires when the text in a field changes. For example, a shape has a text field that shows its width. A TextChanged event does not fire when the shape's width changes, because the raw text stored for the shape has not changed, even though the apparent (expanded) text of the shape does change. Use the CellChanged event for one of the cells in the Text Fields section to detect when the text in a text field changes.

To access a shape's raw text, use the Text property. To access the text of a shape in which text fields have been expanded, use the Characters.Text property. You can determine the location and properties of text fields in a shape's text by using the Shape.Characters object.

In Visio 5.0 and earlier versions, the raw characters reported by the Text property for a field included four characters, the first being the escape character. Starting with Visio 2000, only a single escape character is present in the raw text stream.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the TextChanged event.

For performance considerations, the Document object's event set does not include the TextChanged event. To sink the TextChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Pages.UngroupCanceled Event (Visio)

 Copy code hover
[image]

Pages.UngroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _UngroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be ungrouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Path Object (Visio)

 Copy code hover
[image]

Path Object (Visio)
Send feedback

Published: July 16, 2012

Represents a sequence of one or more segments whose ends abut. A path describes where a pen would move in order to draw one shape component. Each Path object corresponds to a Geometry section of a shape.

Version Information

Version Added: Visio 5.0

Remarks

The default property of a Path object is Item.

A Curve object is an item in a Path object that is any linear or curved segment representing a consecutive sequence of rows in the Geometry section that the Path object represents. The number of Curve objects in a Path object is not necessarily the same as the number of rows in its Geometry section.

The Path object is conceptually of zero width. Line weights, patterns, and ends are ignored, but corner rounding is included. A Path object may or may not be closed, and it may intersect itself. For example, a Path object may describe a figure eight.

If you retrieve a Path object from a collection obtained by the Paths property of a shape, its coordinates are expressed in the shape's parent coordinate system. If you retrieve a Path object from a collection obtained by the PathsLocal property of a shape, its coordinates are expressed in the shape's local coordinate system. In both cases, coordinates are expressed in internal drawing units (inches).


Path Members (Visio)

 Copy code hover
[image]

Path Members (Visio)
Send feedback

Published: July 16, 2012

Represents a sequence of one or more segments whose ends abut. A path describes where a pen would move in order to draw one shape component. Each Path object corresponds to a Geometry section of a shape.

Methods

Name | Description
Points | Returns an array of points that defines a polyline that approximates a Path or Curve object within a given tolerance.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Closed | Determines if an object is closed (that is, if its begin point coincides with its endpoint). Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.
ObjectType | Returns an object's type. Read-only.


Path Properties (Visio)

 Copy code hover
[image]

Path Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Closed | Determines if an object is closed (that is, if its begin point coincides with its endpoint). Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.
ObjectType | Returns an object's type. Read-only.


Path.Application Property (Visio)

 Copy code hover
[image]

Path.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Path object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Path.Closed Property (Visio)

 Copy code hover
[image]

Path.Closed Property (Visio)
Send feedback

Published: July 16, 2012

Determines if an object is closed (that is, if its begin point coincides with its endpoint). Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .Closed

expression A variable that represents a Path object.

Return Value

Integer

Remarks

Use the Closed property of a Path or Curve object to test for equality (Microsoft Visio uses 10E-6 as its "fuzz" factor) of the object's begin and endpoints. A closed Curve object can be in a Path object that is open, and a Curve object that is open can be in a closed Path object.

The Closed property of a Path object is unrelated to a Path object's fill. A Path object is filled if its Geometryn.NoFill cell is zero (0). If you indicate to Visio to fill an open Path object, it responds as if there is a LineTo cell from the Path object's endpoint to its begin point. When filling a Path object, Visio considers a point to be inside the Path object if a ray drawn from the point in any direction crosses the Path object or any of the shape's other Path objects cross an odd number of times.


Path.Count Property (Visio)

 Copy code hover
[image]

Path.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Path object.

Return Value

Long

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Path.Item Property (Visio)

 Copy code hover
[image]

Path.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(Index)

expression A variable that represents a Path object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Contains the index of the object to retrieve.

Return Value

Curve

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


Path.ObjectType Property (Visio)

 Copy code hover
[image]

Path.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Path object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Path Methods (Visio)

 Copy code hover
[image]

Path Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Points | Returns an array of points that defines a polyline that approximates a Path or Curve object within a given tolerance.


Path.Points Method (Visio)

 Copy code hover
[image]

Path.Points Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of points that defines a polyline that approximates a Path or Curve object within a given tolerance.

Version Information

Version Added: Visio 5.0

Syntax

expression .Points(Tolerance, xyArray())

expression A variable that represents a Path object.

Parameters

Name | Required/Optional | Data Type | Description
Tolerance | Required | Double | Specifies how close the returned array of points must approximate the true path.
xyArray() | Required | Double | Out parameter. Returns an array of alternating x and y values specifying points along a path's or curve's stroke.

Return Value

Nothing

Remarks

Use the Points method of the Path or Curve object to obtain an array of x,y coordinates specifying points along the path or curve within a given tolerance. The tolerance and returned x,y values are expressed in internal drawing units (inches).

If you used the Paths property of a Shapes object to obtain the Path or Curve object being queried, the coordinates are expressed in the parent's coordinate system. If you used the PathsLocal property of a Shape object to obtain the Path or Curve object, the coordinates are expressed in the local coordinate system.

If Microsoft Visio is unable to achieve the requested tolerance, Visio approximates the points as close to the requested tolerance as possible. Generally speaking, the lower the tolerance, the more points Visio returns. Visio doesn't accept a tolerance of zero (0).

The array returned includes both the starting and ending points of the path or curve even if it is closed.

Example

This Microsoft Visual Basic for Applications (VBA) macro places a shape on the page, retrieves its Paths collection, and then uses the Points method of the Path object to return an array of points that defines a polyline approximating the Path object.

VBA Copy code Copy code

Public Sub Points_Example()

 Dim vsoShape As Visio.Shape
 Dim adblXYPoints() As Double
 Dim strPointsList As String
 Dim intOuterLoopCounter As Integer
 Dim intInnerLoopCounter As Integer

 Set vsoShape = ActivePage.DrawOval(1, 1, 4, 4)

 For intOuterLoopCounter = 1 To vsoShape.Paths.Count

 vsoShape.Paths(intOuterLoopCounter).Points 0.1, adblXYPoints
 For intInnerLoopCounter = LBound(adblXYPoints) To UBound(adblXYPoints)
 strPointsList = strPointsList & adblXYPoints(intInnerLoopCounter) & Chr(10)
 Next intInnerLoopCounter

 Next intOuterLoopCounter

 Debug.Print strPointsList

End Sub


Paths Object (Visio)

 Copy code hover
[image]

Paths Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Path object for each Geometry section for a group or shape.

Version Information

Version Added: Visio 5.0

Remarks

To retrieve a Paths collection expressed in the shape's parent coordinate system, use the Paths property of the shape. The coordinates are expressed in internal drawing units (inches).

The default property of a Paths collection is Item.

To retrieve a Paths collection expressed in the shape's local coordinate system, use the PathsLocal property of the shape. The coordinates are expressed in internal drawing units (inches).

If a Shape object is a page, foreign object, or guide, its Paths and PathsLocal properties don't contain any items.

If a Shape object is a group, its Paths and PathsLocal properties are the union of the paths of its component shapes.

If a Shape object is a shape, its Paths and PathsLocal properties include one item for each Geometry section that defines a stroke of positive length.


Paths Members (Visio)

 Copy code hover
[image]

Paths Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Path object for each Geometry section for a group or shape.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.
ObjectType | Returns an object's type. Read-only.


Paths Properties (Visio)

 Copy code hover
[image]

Paths Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.
ObjectType | Returns an object's type. Read-only.


Paths.Application Property (Visio)

 Copy code hover
[image]

Paths.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Paths object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Paths.Count Property (Visio)

 Copy code hover
[image]

Paths.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Paths object.

Return Value

Long

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Paths.Item Property (Visio)

 Copy code hover
[image]

Paths.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(Index)

expression A variable that represents a Paths collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Contains the index of the object to retrieve.

Return Value

Path

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


Paths.ObjectType Property (Visio)

 Copy code hover
[image]

Paths.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Paths object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


RelatedShapePairEvent Object (Visio)

 Copy code hover
[image]

RelatedShapePairEvent Object (Visio)
Send feedback

Published: July 16, 2012

Holds information about the shapes that are involved in a container relationship or a callout relationship.

Version Information

Version Added: Visio 2010

Remarks

A related shape pair consists of two shapes — typically a container and a member, or a callout and a target shape.

When you add or remove a member shape from a container, Microsoft Visio fires a ContainerRelationshipAdded or ContainerRelationshipDeleted event respectively, and in each case, returns a RelatedShapePairEvent object that encapsulates information about the event.

When you add or remove a callout relationship from a document, Microsoft Visio fires a CalloutRelationshipAdded or CalloutRelationshipDeleted event respectively, and in each case, returns a RelatedShapePairEvent object that encapsulates information about the event.


RelatedShapePairEvent Members (Visio)

 Copy code hover
[image]

RelatedShapePairEvent Members (Visio)
Send feedback

Published: July 16, 2012

Holds information about the shapes that are involved in a container relationship or a callout relationship.

Properties

Name | Description
ContainingPage | Returns the Page object that is associated with the RelatedShapePairEvent object. Read-only.
ContainingPageID | Returns the identifier of the Page object that is associated with the RelatedShapePairEvent object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
FromShapeID | Returrns the identifier of the first (container or callout) shape in the related shape pair. Read-only.
ObjectType | Returns visObjTypeRelatedShapePairEvent, the type of this object. Read-only.
Stat | Returns status information for an object. Read-only.
ToShapeID | Returrns the identifier of the second (member) shape in the related shape pair. Read-only.


RelatedShapePairEvent Properties (Visio)

 Copy code hover
[image]

RelatedShapePairEvent Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ContainingPage | Returns the Page object that is associated with the RelatedShapePairEvent object. Read-only.
ContainingPageID | Returns the identifier of the Page object that is associated with the RelatedShapePairEvent object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
FromShapeID | Returrns the identifier of the first (container or callout) shape in the related shape pair. Read-only.
ObjectType | Returns visObjTypeRelatedShapePairEvent, the type of this object. Read-only.
Stat | Returns status information for an object. Read-only.
ToShapeID | Returrns the identifier of the second (member) shape in the related shape pair. Read-only.


RelatedShapePairEvent.ContainingPage Property (Visio)

 Copy code hover
[image]

RelatedShapePairEvent.ContainingPage Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Page object that is associated with the RelatedShapePairEvent object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ContainingPage

expression A variable that represents a RelatedShapePairEvent object.

Return Value

Page


RelatedShapePairEvent.ContainingPageID Property (Visio)

 Copy code hover
[image]

RelatedShapePairEvent.ContainingPageID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the identifier of the Page object that is associated with the RelatedShapePairEvent object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ContainingPageID

expression A variable that represents a RelatedShapePairEvent object.

Return Value

Long


RelatedShapePairEvent.Document Property (Visio)

 Copy code hover
[image]

RelatedShapePairEvent.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Document

expression A variable that represents a RelatedShapePairEvent object.

Return Value

Document


RelatedShapePairEvent.FromShapeID Property (Visio)

 Copy code hover
[image]

RelatedShapePairEvent.FromShapeID Property (Visio)
Send feedback

Published: July 16, 2012

Returrns the identifier of the first (container or callout) shape in the related shape pair. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .FromShapeID

expression A variable that represents a RelatedShapePairEvent object.

Return Value

Long

Remarks

The first shape in the related shape pair is the container or callout shape. The second shape is the member shape.


RelatedShapePairEvent.ObjectType Property (Visio)

 Copy code hover
[image]

RelatedShapePairEvent.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeRelatedShapePairEvent, the type of this object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression A variable that represents a RelatedShapePairEvent object.

Return Value

visObjTypeRelatedShapePairEvent

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


RelatedShapePairEvent.Stat Property (Visio)

 Copy code hover
[image]

RelatedShapePairEvent.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression A variable that represents a RelatedShapePairEvent object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


RelatedShapePairEvent.ToShapeID Property (Visio)

 Copy code hover
[image]

RelatedShapePairEvent.ToShapeID Property (Visio)
Send feedback

Published: July 16, 2012

Returrns the identifier of the second (member) shape in the related shape pair. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ToShapeID

expression A variable that represents a RelatedShapePairEvent object.

Return Value

Long

Remarks

The first shape in the related shape pair is the container or callout shape. The second shape is the member shape.


ReplaceShapesEvent Object (Visio)

 Copy code hover
[image]

ReplaceShapesEvent Object (Visio)
See also Send feedback

Published: July 16, 2012

Represents a shape-replacement operation initiated by the Selection.ReplaceShape or the Shape.ReplaceShape method.

Remarks

Properties of the ReplaceShapesEvent object return information about various aspects of the shape replacement, including the shape or shapes replaced; the properties of the original shape or shapes inherited by the replacement shape; and the type of the replacement shape.

See also

Other resources

ReplaceShapesEvent Members


ReplaceShapesEvent Members (Visio)

 Copy code hover
[image]

ReplaceShapesEvent Members (Visio)
Send feedback

Published: July 16, 2012

Represents a shape-replacement operation initiated by the Selection.ReplaceShape or the Shape.ReplaceShape method.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ObjectType | Returns visObjTypeReplaceShapesEvent, the type of the specified ReplaceShapesEvent object. Read-only.
ReplaceFlags | Specifies the options for the shape replacement. Read-only.
ReplacementMaster | Returns the replacement shape to drop. Read-only.
SelectionSource | Returns a Selection object that represents the source shape or shapes whose replacement fired the event.
Stat | Returns status information for an object. Read-only.


ReplaceShapesEvent Properties (Visio)

 Copy code hover
[image]

ReplaceShapesEvent Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ObjectType | Returns visObjTypeReplaceShapesEvent, the type of the specified ReplaceShapesEvent object. Read-only.
ReplaceFlags | Specifies the options for the shape replacement. Read-only.
ReplacementMaster | Returns the replacement shape to drop. Read-only.
SelectionSource | Returns a Selection object that represents the source shape or shapes whose replacement fired the event.
Stat | Returns status information for an object. Read-only.


ReplaceShapesEvent.Application Property (Visio)

 Copy code hover
[image]

ReplaceShapesEvent.Application Property (Visio)
See also Send feedback

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Syntax

expression .Application

expression A variable that represents a ReplaceShapesEvent object.

See also

Other resources

ReplaceShapesEvent Object
ReplaceShapesEvent Members


ReplaceShapesEvent.ObjectType Property (Visio)

 Copy code hover
[image]

ReplaceShapesEvent.ObjectType Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns visObjTypeReplaceShapesEvent, the type of the specified ReplaceShapesEvent object. Read-only.

Syntax

expression .ObjectType

expression A variable that represents a ReplaceShapesEvent object.

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Property value

INT16

See also

Other resources

ReplaceShapesEvent Object
ReplaceShapesEvent Members


ReplaceShapesEvent.ReplaceFlags Property (Visio)

 Copy code hover
[image]

ReplaceShapesEvent.ReplaceFlags Property (Visio)
See also Send feedback

Published: July 16, 2012

Specifies the options for the shape replacement. Read-only.

Syntax

expression .ReplaceFlags

expression A variable that represents a ReplaceShapesEvent object.

Remarks

The value returned by ReplaceFlags is equal to a combination of one or more VisReplaceFlags constants.

Property value

INT32

See also

Other resources

ReplaceShapesEvent Object
ReplaceShapesEvent Members


ReplaceShapesEvent.ReplacementMaster Property (Visio)

 Copy code hover
[image]

ReplaceShapesEvent.ReplacementMaster Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns the replacement shape to drop. Read-only.

Syntax

expression .ReplacementMaster

expression A variable that represents a ReplaceShapesEvent object.

Remarks

The replacement shape is an object of type Master or MasterShortcut.

Property value

UNKNOWN

See also

Other resources

ReplaceShapesEvent Object
ReplaceShapesEvent Members


ReplaceShapesEvent.SelectionSource Property (Visio)

 Copy code hover
[image]

ReplaceShapesEvent.SelectionSource Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns a Selection object that represents the source shape or shapes whose replacement fired the event.

Syntax

expression .SelectionSource

expression A variable that represents a ReplaceShapesEvent object.

Property value

IVSELECTION

See also

Other resources

ReplaceShapesEvent Object
ReplaceShapesEvent Members


ReplaceShapesEvent.Stat Property (Visio)

 Copy code hover
[image]

ReplaceShapesEvent.Stat Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Syntax

expression .Stat

expression A variable that represents a ReplaceShapesEvent object.

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Property value

INT16

See also

Other resources

ReplaceShapesEvent Object
ReplaceShapesEvent Members


Row Object (Visio)

 Copy code hover
[image]

Row Object (Visio)
Send feedback

Published: July 16, 2012

Enables you to access and manipulate a row in a section.

Version Information

Version Added: Visio 2000

Remarks

The default property of a Row object is Cell.


Row Members (Visio)

 Copy code hover
[image]

Row Members (Visio)
Send feedback

Published: July 16, 2012

Enables you to access and manipulate a row in a section.

Events

Name | Description
CellChanged | Occurs after the value changes in a cell in a document.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.

Methods

Name | Description
GetPolylineData | Returns the points recorded in a polyline row.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Cell | Uses the local name or index of a cell to return the cell. Read-only.
CellU | Uses the universal name or index of a cell to return the cell. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
ContainingSection | Returns the section that contains a row. Read-only.
Count | Returns the number of objects in a collection. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Index | Gets the ordinal position of an object in a collection. Read-only.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Row object. Read/write.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.
Style | Gets the style that contains a Row object. Read-only.


Row Properties (Visio)

 Copy code hover
[image]

Row Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Cell | Uses the local name or index of a cell to return the cell. Read-only.
CellU | Uses the universal name or index of a cell to return the cell. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
ContainingSection | Returns the section that contains a row. Read-only.
Count | Returns the number of objects in a collection. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Index | Gets the ordinal position of an object in a collection. Read-only.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Row object. Read/write.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.
Style | Gets the style that contains a Row object. Read-only.


Row.Application Property (Visio)

 Copy code hover
[image]

Row.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Row object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Row.Cell Property (Visio)

 Copy code hover
[image]

Row.Cell Property (Visio)
Send feedback

Published: July 16, 2012

Uses the local name or index of a cell to return the cell. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .Cell(NameOrIndex)

expression A variable that represents a Row object.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | The local name or index of the cell.

Return Value

Cell

Remarks

The first cell in a row has an index of zero (0).

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Cell property to get a Cell object by using its local name. Use the CellU property to get a Cell object by using its universal name.


Row.CellU Property (Visio)

 Copy code hover
[image]

Row.CellU Property (Visio)
Send feedback

Published: July 16, 2012

Uses the universal name or index of a cell to return the cell. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .CellU(NameOrIndex)

expression A variable that represents a Row object.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | The universal name or index of the cell.

Return Value

Cell

Remarks

The first cell in a row has an index of zero (0).

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Cell property to get a Cell object by using its local name. Use the CellU property to get a Cell object by using its universal name.


Row.ContainingMasterID Property (Visio)

 Copy code hover
[image]

Row.ContainingMasterID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the Master object that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingMasterID

expression A variable that represents a Row object.

Return Value

Long

Remarks

If the object is not in a Master object, the ContainingMasterID property returns -1. For example, if a Shape object belongs to the Shapes collection of a Page object, the ContainingMasterID property returns -1.


Row.ContainingPageID Property (Visio)

 Copy code hover
[image]

Row.ContainingPageID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the page that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingPageID

expression A variable that represents a Row object.

Return Value

Long

Remarks

If the object is not in a Page object, the ContainingPageID property returns -1. For example, if a Shape object belongs to a Masters collection, the ContainingPageID property returns -1.


Row.ContainingSection Property (Visio)

 Copy code hover
[image]

Row.ContainingSection Property (Visio)
Send feedback

Published: July 16, 2012

Returns the section that contains a row. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .ContainingSection

expression A variable that represents a Row object.

Return Value

Section


Row.Count Property (Visio)

 Copy code hover
[image]

Row.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Row object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Row.EventList Property (Visio)

 Copy code hover
[image]

Row.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Row object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Row.Index Property (Visio)

 Copy code hover
[image]

Row.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of an object in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Row object.

Return Value

Integer

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Row.Name Property (Visio)

 Copy code hover
[image]

Row.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a Row object.

Return Value

String

Remarks

You can get, but not set, the Name property of an Addon object or a Font object.

You can get, but not set, the Name property of a Cell object. Some cells are in named rows; you can get and set the name of a named row by using the RowName property.

A cell has both a local name and a universal name. The local name differs depending on the locale for which the running version of Microsoft Windows is installed. The universal name is the same regardless of what locale is installed. To get the universal name of a cell, use the Name property. To get the local name, use the LocalName property.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Row.NameU Property (Visio)

 Copy code hover
[image]

Row.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of a Row object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .NameU

expression A variable that represents a Row object.

Return Value

String

Remarks

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Row.ObjectType Property (Visio)

 Copy code hover
[image]

Row.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Row object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Row.PersistsEvents Property (Visio)

 Copy code hover
[image]

Row.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Row object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Row.Shape Property (Visio)

 Copy code hover
[image]

Row.Shape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Shape

expression A variable that represents a Row object.

Return Value

Shape

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Shape property to get the Shape objects that own a Cell and a Characters object.

VBA Copy code Copy code

Public Sub Shape_Example()

 Dim vsoRectangle As Visio.Shape
 Dim vsoOval As Visio.Shape
 Dim vsoShapeFromCell As Visio.Shape
 Dim vsoShapeFromCharacters As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim vsoCharacters As Visio.Characters

 'Create 2 different shapes and add different text to each shape.
 Set vsoRectangle = ActivePage.DrawRectangle(2, 3, 5, 4)
 Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
 vsoRectangle.Text = "Rectangle Shape"
 vsoOval.Text = "Oval Shape"

 'Get a Cell object from the first shape.
 Set vsoCell = vsoRectangle.Cells("Width")

 'Get a Characters object from the second shape.
 Set vsoCharacters = vsoOval.Characters

 'Use the Shape property to get the Shape object.
 Set vsoShapeFromCell = vsoCell.Shape
 Set vsoShapeFromCharacters = vsoCharacters.Shape

 'Use each shape's text to verify the proper Shape
 'object was returned.
 Debug.Print vsoShapeFromCell.Text
 Debug.Print vsoShapeFromCharacters.Text

End Sub


Row.Stat Property (Visio)

 Copy code hover
[image]

Row.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Row object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Row.Style Property (Visio)

 Copy code hover
[image]

Row.Style Property (Visio)
Send feedback

Published: July 16, 2012

Gets the style that contains a Row object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Style

expression A variable that represents a Row object.

Return Value

Style

Remarks

If a style consists of different text, line, and fill styles, the Style property returns the fill style.

If a Row object is in a style, its Style property returns the style that contains the cell, and its Shape property returns Nothing.

If a Row object is in a shape, its Shape property returns the shape that contains the cell, and its Style property returns Nothing.


Row Methods (Visio)

 Copy code hover
[image]

Row Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
GetPolylineData | Returns the points recorded in a polyline row.


Row.GetPolylineData Method (Visio)

 Copy code hover
[image]

Row.GetPolylineData Method (Visio)
Send feedback

Published: July 16, 2012

Returns the points recorded in a polyline row.

Version Information

Version Added: Visio 2000

Syntax

expression .GetPolylineData(Flags, xyArray())

expression A variable that represents a Row object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Required | Integer | Flags that influence the points returned.
xyArray() | Required | Double | Out parameter. Returns an array of alternating x and y values specifying the points recorded in the row.

Return Value

Nothing

Remarks

If the row's type is not visTagPolylineTo, an exception is raised.

If the GetPolylineData method succeeds, xyArray() returns a one-dimensional array of n doubles (VT_R8) indexed from 0 to n - 1. The parameter xyArray() is an out parameter that is allocated by the GetPolylineData method, which passes ownership back to the caller. The caller should eventually perform SafeArrayDestroy on the returned array. (Microsoft Visual Basic and Visual Basic for Applications manage this for you.)

The Flags parameter is a bitmask that specifies options for returning points. Its value should be visGeomWHPct, visGeomXYLocal, or a combination of either of those values with visGeomExcludeLastPoint. If neither visGeomWHPct nor visGeomXYLocal is passed as part of the Flags parameter, an error will be generated.

Constant | Value | Description
visGeomExcludeLastPoint | &H1 | Optional. The last point of the polyline (the X and Y cells in the row) will not be included in xyArray().
visGeomWHPct | &H10 | The values returned in xyArray() will be percentages of width/height.
visGeomXYLocal | &H20 | The values returned in xyArray() will be local, internal units in the drawing.


Row Events (Visio)

 Copy code hover
[image]

Row Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
CellChanged | Occurs after the value changes in a cell in a document.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.


Row.CellChanged Event (Visio)

 Copy code hover
[image]

Row.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Row object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


Row.FormulaChanged Event (Visio)

 Copy code hover
[image]

Row.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Row object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Section Object (Visio)

 Copy code hover
[image]

Section Object (Visio)
Send feedback

Published: July 16, 2012

Enables you to access and manipulate a section of a shape. A section of a shape corresponds to a section shown in the ShapeSheet window. A section contains rows and cells.

Version Information

Version Added: Visio 2000

Remarks

The default property of a Section object is Row.


Section Members (Visio)

 Copy code hover
[image]

Section Members (Visio)
Send feedback

Published: July 16, 2012

Enables you to access and manipulate a section of a shape. A section of a shape corresponds to a section shown in the ShapeSheet window. A section contains rows and cells.

Events

Name | Description
CellChanged | Occurs after the value changes in a cell in a document.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPageID | Returns the ID of the page that contains the section. Read-only. .
Count | Returns the number of objects in a collection. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Index | Gets the ordinal position of an object in a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Row | Returns the row in a section specified by row index number. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.
Style | Gets the style that contains a Section object. Read-only.


Section Properties (Visio)

 Copy code hover
[image]

Section Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPageID | Returns the ID of the page that contains the section. Read-only. .
Count | Returns the number of objects in a collection. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Index | Gets the ordinal position of an object in a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Row | Returns the row in a section specified by row index number. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
Stat | Returns status information for an object. Read-only.
Style | Gets the style that contains a Section object. Read-only.


Section.Application Property (Visio)

 Copy code hover
[image]

Section.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Section object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Section.ContainingMasterID Property (Visio)

 Copy code hover
[image]

Section.ContainingMasterID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the Master object that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingMasterID

expression A variable that represents a Section object.

Return Value

Long

Remarks

If the object is not in a Master object, the ContainingMasterID property returns -1. For example, if a Shape object belongs to the Shapes collection of a Page object, the ContainingMasterID property returns -1.


Section.ContainingPageID Property (Visio)

 Copy code hover
[image]

Section.ContainingPageID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the page that contains the section. Read-only. .

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingPageID

expression A variable that represents a Section object.

Return Value

Long

Remarks

If the section is not in a Page object, the ContainingPageID property returns -1.


Section.Count Property (Visio)

 Copy code hover
[image]

Section.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Section object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Section.EventList Property (Visio)

 Copy code hover
[image]

Section.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Section object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Section.Index Property (Visio)

 Copy code hover
[image]

Section.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of an object in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Section object.

Return Value

Integer

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Section.ObjectType Property (Visio)

 Copy code hover
[image]

Section.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Section object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Section.PersistsEvents Property (Visio)

 Copy code hover
[image]

Section.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Section object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Section.Row Property (Visio)

 Copy code hover
[image]

Section.Row Property (Visio)
Send feedback

Published: July 16, 2012

Returns the row in a section specified by row index number. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Row(Index)

expression A variable that represents a Section object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Integer | Specifies the index number of the row to be returned.

Return Value

Row

Remarks

Row is the default property of the Section object.


Section.Shape Property (Visio)

 Copy code hover
[image]

Section.Shape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Shape

expression A variable that represents a Section object.

Return Value

Shape

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Shape property to get the Shape objects that own a Cell and a Characters object.

VBA Copy code Copy code

Public Sub Shape_Example()

 Dim vsoRectangle As Visio.Shape
 Dim vsoOval As Visio.Shape
 Dim vsoShapeFromCell As Visio.Shape
 Dim vsoShapeFromCharacters As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim vsoCharacters As Visio.Characters

 'Create 2 different shapes and add different text to each shape.
 Set vsoRectangle = ActivePage.DrawRectangle(2, 3, 5, 4)
 Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
 vsoRectangle.Text = "Rectangle Shape"
 vsoOval.Text = "Oval Shape"

 'Get a Cell object from the first shape.
 Set vsoCell = vsoRectangle.Cells("Width")

 'Get a Characters object from the second shape.
 Set vsoCharacters = vsoOval.Characters

 'Use the Shape property to get the Shape object.
 Set vsoShapeFromCell = vsoCell.Shape
 Set vsoShapeFromCharacters = vsoCharacters.Shape

 'Use each shape's text to verify the proper Shape
 'object was returned.
 Debug.Print vsoShapeFromCell.Text
 Debug.Print vsoShapeFromCharacters.Text

End Sub


Section.Stat Property (Visio)

 Copy code hover
[image]

Section.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Section object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Section.Style Property (Visio)

 Copy code hover
[image]

Section.Style Property (Visio)
Send feedback

Published: July 16, 2012

Gets the style that contains a Section object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Style

expression A variable that represents a Section object.

Return Value

Style

Remarks

If a style consists of different text, line, and fill styles, the Style property returns the fill style.

If a Section object is in a style, its Style property returns the style that contains the cell, and its Shape property returns Nothing.

If a Section object is in a shape, its Shape property returns the shape that contains the cell, and its Style property returns Nothing.


Section Events (Visio)

 Copy code hover
[image]

Section Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
CellChanged | Occurs after the value changes in a cell in a document.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.


Section.CellChanged Event (Visio)

 Copy code hover
[image]

Section.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Section object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


Section.FormulaChanged Event (Visio)

 Copy code hover
[image]

Section.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Section object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Selection Object (Visio)

 Copy code hover
[image]

Selection Object (Visio)
Send feedback

Published: July 16, 2012

Represents a subset of Shape objects for a page or master to which an operation can be applied.

Version Information

Version Added: Visio 2.0

Remarks

To retrieve a Selection object that corresponds to the set of shapes selected in a window, use the Selection property of a Window object.

The default property of a Selection object is Item.

After you retrieve a Selection object, you can add or remove shapes by using the Select method.

By default, the items reported by a Selection object do not include subselected or superselected Shape objects. Use the IterationMode property to control whether subselected and superselected Shape objects are reported. You can determine whether an individual item is subselected or superselected by using the ItemStatus property.


Selection Members (Visio)

 Copy code hover
[image]

Selection Members (Visio)
Send feedback

Published: July 16, 2012

Represents a subset of Shape objects for a page or master to which an operation can be applied.

Methods

Name | Description
AddToContainers | Adds the selection of shapes to all underlying containers that allow it as a member.
AddToGroup | Adds the selected shapes to the selected group.
Align | Aligns two or more selected shapes.
AutomaticLink | Links selected shapes to data rows in the specified data recordset automatically, without requiring you to specify the exact correspondence of all shapes and data rows. Returns the number of shapes linked.
AvoidPageBreaks | Makes small adjustments to selected shapes to move them off page breaks.
BoundingBox | Returns a rectangle that tightly encloses the shapes of a selection.
BreakLinkToData | Breaks links between all shapes in the selection and data rows in the specified data recordset.
BringForward | Brings the shape or selected shapes forward one position in the z-order.
BringToFront | Brings the shape or selected shapes to the front of the z-order.
Combine | Creates a new shape by combining selected shapes.
ConnectShapes | Connects two or more selected shapes with a dynamic connector. ReturnsNothing.
ConvertToGroup | Converts a selection or an object from another application (a linked or embedded object) to a group.
Copy | Copies a selection to the Clipboard.
Cut | Deletes a selection and places it on the Clipboard.
Delete | Deletes an object or selection.
DeleteEx | Deletes additional shapes associated with the selection, such as connectors and unselected container members, when the selection is deleted.
DeselectAll | Deselects all shapes in a window or selection.
Distribute | Distributes three or more selected shapes at regular intervals on the drawing page. The order of selection is irrelevant.
DrawRegion | Draws a new shape that represents the region containing a given point.
Duplicate | Duplicates a selection.
Export | Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.
FitCurve | Reduces the number of geometry segments in a shape or shapes by replacing them with similar spline, arc, and line segments that approximate the paths of the initial segments. Typically, this reduces the number of segments in the shape.
Flip | Flips selected shapes either as a group or individually about their pins. Returns Nothing.
FlipHorizontal | Flips an object horizontally.
FlipVertical | Flips an object vertically.
Fragment | Breaks selected shapes into smaller shapes.
GetCallouts | Returns the list of identifiers of the callout shapes in the selection.
GetContainers | Returns an array of shape identifiers (IDs) of the container shapes in the selection.
GetIDs | Gets the shape IDs of the shapes in the selection.
Group | Groups the objects that are selected in a selection, or it converts a shape into a group.
Intersect | Creates one closed shape from the area in which selected shapes overlap or intersect.
Join | Creates a new shape by joining selected shapes.
Layout | Lays out the shapes and/or reroutes the connectors for the page, master, group, or selection.
LayoutChangeDirection | Revises the layout of a selection of connected shapes by rotating or flipping the connected shapes as a unit, without rotating or flipping the individual shapes.
LayoutIncremental | Makes small adjustments to the position of shapes in the selection to better align the shapes or to space them evenly from other shapes.
LinkToData | Links a selection of shapes to a single data row in a data recordset.
MemberOfContainersIntersection | Returns an array of identifiers of the shapes that belong to the normal or list containers that contain all the shapes in the selection.
MemberOfContainersUnion | Returns an array of identifiers of the shapes that belong to the normal or list containers that contain at least one of the shapes in the selection.
Move | Moves a selection a specified distance.
MoveToSubprocess | Moves the selection to the specified page, and drops a replacement shape on the source page and links it to the target page. Returns the selection of moved shapes on the target page.
Offset | Offsets a selection a specified amount.
RemoveFromContainers | Removes the selection of shapes from all lists and containers of which the selection is a member.
RemoveFromGroup | Removes selected shapes from a group.
ReplaceShape | Replaces the specified selection with one or more instances of the master passed as the first parameter, and returns an array containing the new shape or shapes.
Resize | Resizes the selection by moving shape handles as specified.
ReverseEnds | Reverses an object by flipping it both horizontally and vertically.
Rotate | Rotates selected shapes either as a group or individually about their pins.
Rotate90 | Rotates an object 90 degrees counterclockwise.
Select | Selects or clears the selection of an object.
SelectAll | Selects all possible shapes in a window or selection.
SendBackward | Moves a shape or selected shapes back one position in the z-order.
SendToBack | Moves the shape or selected shapes to the back of the z-order.
SetContainerFormat | Changes the formatting of one aspect of all the containers in the selection, and returns an array of identifiers of shapes that belong to the containers and whose formatting was changed.
SetQuickStyle | Sets the quick style of the specified selection.
Subtract | Subtracts the areas that overlap the selected shape.
SwapEnds | Swaps the begin and endpoints of a one-dimensional (1-D) shape.
Trim | Trims selected shapes into smaller shapes.
Ungroup | Ungroups a group.
Union | Creates a new shape from the perimeter of selected shapes.
UpdateAlignmentBox | Updates the alignment box for a shape.
VisualBoundingBox |

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ContainingMaster | Returns the Master object that contains an object. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPage | Returns the page that contains an object.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
ContainingShape | Returns the Shape object that contains an object or collection. Read-only.
Count | Returns the number of objects in a collection. Read-only.
DataGraphic | Gets the data graphic master (Master object of type visTypeDataGraphic) of the primary shape in the selection. Sets the data graphic master of all shapes in the selection. Read/write.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
FillStyle | Returns or sets the fill style for an object. Read/write.
FillStyleKeepFmt | Applies a fill style to an object while preserving local formatting. Read/write.
Item | Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.
ItemStatus | Indicates if an item in a Selection object is subselected, if the group to which it belongs is selected, or if it is the primary item. Read-only.
IterationMode | Determines whether a Selection object reports subselected shapes and groups in which a shape is selected. Read/write.
LineStyle | Specifies the line style for an object. Read/write.
LineStyleKeepFmt | Applies a line style to an object while preserving local formatting. Read/write.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Picture | Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.
PrimaryItem | Returns the Shape object that is a Selection object's primary item. Read-only.
SelectionForDragCopy | Returns the Selection object that represents the collection of shapes that will participate in drag or copy operations, based on the current selection. Read-only.
Stat | Returns status information for an object. Read-only.
Style | Gets or sets the style for a Selection object. Read/write.
StyleKeepFmt | Applies a style to an object while preserving local formatting. Read/write.
TextStyle | Gets or sets the text style for an object. Read/write.
TextStyleKeepFmt | Applies a text style to an object while preserving local formatting. Read/write.


Selection Properties (Visio)

 Copy code hover
[image]

Selection Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ContainingMaster | Returns the Master object that contains an object. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPage | Returns the page that contains an object.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
ContainingShape | Returns the Shape object that contains an object or collection. Read-only.
Count | Returns the number of objects in a collection. Read-only.
DataGraphic | Gets the data graphic master (Master object of type visTypeDataGraphic) of the primary shape in the selection. Sets the data graphic master of all shapes in the selection. Read/write.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
FillStyle | Returns or sets the fill style for an object. Read/write.
FillStyleKeepFmt | Applies a fill style to an object while preserving local formatting. Read/write.
Item | Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.
ItemStatus | Indicates if an item in a Selection object is subselected, if the group to which it belongs is selected, or if it is the primary item. Read-only.
IterationMode | Determines whether a Selection object reports subselected shapes and groups in which a shape is selected. Read/write.
LineStyle | Specifies the line style for an object. Read/write.
LineStyleKeepFmt | Applies a line style to an object while preserving local formatting. Read/write.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Picture | Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.
PrimaryItem | Returns the Shape object that is a Selection object's primary item. Read-only.
SelectionForDragCopy | Returns the Selection object that represents the collection of shapes that will participate in drag or copy operations, based on the current selection. Read-only.
Stat | Returns status information for an object. Read-only.
Style | Gets or sets the style for a Selection object. Read/write.
StyleKeepFmt | Applies a style to an object while preserving local formatting. Read/write.
TextStyle | Gets or sets the text style for an object. Read/write.
TextStyleKeepFmt | Applies a text style to an object while preserving local formatting. Read/write.


Selection.Application Property (Visio)

 Copy code hover
[image]

Selection.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Selection object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Selection.ContainingMaster Property (Visio)

 Copy code hover
[image]

Selection.ContainingMaster Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Master object that contains an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ContainingMaster

expression A variable that represents a Selection object.

Return Value

Master

Remarks

If the object isn't in a Master object, the ContainingMaster property returns Nothing. For example, if a Shape object belongs to the Shapes collection of a Page object, the ContainingMaster property returns Nothing.


Selection.ContainingMasterID Property (Visio)

 Copy code hover
[image]

Selection.ContainingMasterID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the Master object that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingMasterID

expression A variable that represents a Selection object.

Return Value

Long

Remarks

If the object is not in a Master object, the ContainingMasterID property returns -1. For example, if a Shape object belongs to the Shapes collection of a Page object, the ContainingMasterID property returns -1.


Selection.ContainingPage Property (Visio)

 Copy code hover
[image]

Selection.ContainingPage Property (Visio)
Send feedback

Published: July 16, 2012

Returns the page that contains an object.

Version Information

Version Added: Visio 4.0

Syntax

expression .ContainingPage

expression A variable that represents a Selection object.

Return Value

Page

Remarks

If the object isn't in a Page object, the ContainingPage property returns Nothing. For example, if a Shape object belongs to a Masters collection, the ContainingPage property returns Nothing.


Selection.ContainingPageID Property (Visio)

 Copy code hover
[image]

Selection.ContainingPageID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the page that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingPageID

expression A variable that represents a Selection object.

Return Value

Long

Remarks

If the object is not in a Page object, the ContainingPageID property returns -1. For example, if a Shape object belongs to a Masters collection, the ContainingPageID property returns -1.


Selection.ContainingShape Property (Visio)

 Copy code hover
[image]

Selection.ContainingShape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that contains an object or collection. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ContainingShape

expression A variable that represents a Selection object.

Return Value

Shape

Remarks

If the Shape object is the member of a group, the ContainingShape property returns that group.

If the Shape object is a top-level shape in its Page or Master object (it is not a member of a group), the ContainingShape property returns the page sheet of its page or master.

If the Shape object is the page sheet of a page or master, the ContainingShape property returns Nothing.


Selection.Count Property (Visio)

 Copy code hover
[image]

Selection.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Selection object.

Return Value

Long

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Selection.DataGraphic Property (Visio)

 Copy code hover
[image]

Selection.DataGraphic Property (Visio)
Send feedback

Published: July 16, 2012

Gets the data graphic master (Master object of type visTypeDataGraphic) of the primary shape in the selection. Sets the data graphic master of all shapes in the selection. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataGraphic

expression An expression that returns a Selection object.

Return Value

Master

Remarks

If the selection has no data graphic master associated with it, the DataGraphic property returns Nothing.


Selection.Document Property (Visio)

 Copy code hover
[image]

Selection.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Selection object.

Return Value

Document


Selection.EventList Property (Visio)

 Copy code hover
[image]

Selection.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Selection object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Selection.FillStyle Property (Visio)

 Copy code hover
[image]

Selection.FillStyle Property (Visio)
Send feedback

Published: July 16, 2012

Returns or sets the fill style for an object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .FillStyle

expression A variable that represents a Selection object.

Return Value

String

Remarks

Setting the FillStyle property is equivalent to selecting a style from the Style list in the Fill dialog box (right-click the shape, point to Format, and then click Fill).

Setting a style to a nonexistent style generates an error. Setting one type of style to another type (for example, setting the FillStyle property to a line style) does nothing. Setting one type of style to another type that has more than one set of attributes changes only the appropriate attributes. For example, setting the FillStyle property to a style that has line, text, and fill attributes changes only the fill attributes.

To preserve a shape's local formatting, use the FillStyleKeepFmt property.

Beginning with Microsoft Visio 2002, setting the FillStyle property to a zero-length string ("") causes the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to draw an oval and set its FillStyle property. To run this macro, open a drawing based on the Basic Diagram template.

VBA Copy code Copy code

Public Sub FillStyle_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawOval(1.5, 10.5, 7.5, 6.5)
 vsoShape.FillStyle = "Basic"

End Sub


Selection.FillStyleKeepFmt Property (Visio)

 Copy code hover
[image]

Selection.FillStyleKeepFmt Property (Visio)
Send feedback

Published: July 16, 2012

Applies a fill style to an object while preserving local formatting. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .FillStyleKeepFmt

expression A variable that represents a Selection object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error. Setting one type of style to another type (for example, setting the FillStyleKeepFmt property to a line style) does nothing. Setting one type of style to another type that has more than one set of attributes changes only the appropriate attributes (for example, setting the FillStyleKeepFmt property to a style that has line, text, and fill attributes changes only the fill attributes).

Beginning with Microsoft Visio 2002, setting FillStyleKeepFmt to an empty string ("") causes the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.


Selection.Item Property (Visio)

 Copy code hover
[image]

Selection.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. The Item property is the default property for all collections, and for the Path and Selection objects. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(Index)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Contains the index of the object to retrieve.

Return Value

Shape

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


Selection.ItemStatus Property (Visio)

 Copy code hover
[image]

Selection.ItemStatus Property (Visio)
Send feedback

Published: July 16, 2012

Indicates if an item in a Selection object is subselected, if the group to which it belongs is selected, or if it is the primary item. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .ItemStatus(Index)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Index of the item for which you want to retrieve the status.

Return Value

Integer

Remarks

The ItemStatus property reports a combination of the following values.

Constant | Value | Description
visSelIsPrimaryItem | &H1 | The item is the primary item.
visSelIsSubItem | &H2 | The item is a subselected item.
visSelIsSuperItem | &H4 | The item is a superselected item.


Selection.IterationMode Property (Visio)

 Copy code hover
[image]

Selection.IterationMode Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a Selection object reports subselected shapes and groups in which a shape is selected. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .IterationMode

expression A variable that represents a Selection object.

Return Value

Long

Remarks

The items in a Selection object are a subset of the descendants of the Selection object's containing shape.

  • A top-level shape in a Selection object is an immediate child of the selection's containing shape.

  • A subselected shape in a Selection object is not an immediate child of the selection's containing shape.

  • A superselected shape in a Selection object has at least one immediate child that is subselected.

If a shape is subselected, each of its ancestors—except the containing shape itself—is superselected.

The value of the IterationMode property is a combination of the following values.

Constant | Value | Description
visSelModeSkipSuper | &H0100 | Selection does not report superselected shapes.
visSelModeOnlySuper | &H0200 | Selection only reports superselected shapes.
visSelModeSkipSub | &H0400 | Selection does not report subselected shapes.
visSelModeOnlySub | &H0800 | Selection only reports subselected shapes.

When a Selection object is created, its initial iteration mode is visSelModeSkipSub + visSelModeSkipSuper. It reports neither subselected nor superselected shapes and behaves identically to Selection objects in versions of Microsoft Visio prior to Visio 2000.

You can determine whether an individual item in a Selection object is a subselected or superselected item by using the ItemStatus property.


Selection.LineStyle Property (Visio)

 Copy code hover
[image]

Selection.LineStyle Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the line style for an object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .LineStyle

expression A variable that represents a Selection object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error. Setting one kind of style to an existing style of another kind (for example, setting the LineStyle property to a fill style) does nothing. Setting one kind of style to an existing style that has more than one set of attributes changes only the attributes for that component. For example, setting the LineStyle property to a style that has line, text, and fill attributes changes only the line attributes.

To preserve a shape's local formatting, use the LineStyleKeepFmt property.

Beginning with Microsoft Visio 2002, setting LineStyle to a zero-length string ("") will cause the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the LineStyle property to set the line style for a particular shape.

VBA Copy code Copy code

Public Sub LineStyle_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawLine(5, 4, 7.5, 1)
 vsoShape.LineStyle = "Guide"

End Sub


Selection.LineStyleKeepFmt Property (Visio)

 Copy code hover
[image]

Selection.LineStyleKeepFmt Property (Visio)
Send feedback

Published: July 16, 2012

Applies a line style to an object while preserving local formatting. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .LineStyleKeepFmt

expression A variable that represents a Selection object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error. Setting one kind of style to an existing style of another kind (for example, setting the LineStyleKeepFmt property to a fill style) does nothing. Setting one kind of style to an existing style that has more than one set of attributes changes only the attributes for that component (for example, setting the LineStyleKeepFmt property to a style that has line, text, and fill attributes changes only the line attributes).

Beginning with Microsoft Visio 2002, setting LineStyleKeepFmt to a zero-length string ("") will cause the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.


Selection.ObjectType Property (Visio)

 Copy code hover
[image]

Selection.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Selection object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Selection.PersistsEvents Property (Visio)

 Copy code hover
[image]

Selection.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Selection object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Selection.Picture Property (Visio)

 Copy code hover
[image]

Selection.Picture Property (Visio)
Send feedback

Published: July 16, 2012

Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .Picture

expression A variable that represents a Selection object.

Return Value

IPictureDisp

Remarks

The Picture property returns only EMF files.

COM provides a standard implementation of a picture object that has the IPictureDisp interface on top of the underlying system picture support. The IPictureDisp interface exposes a picture object's properties and is implemented in the stdole type library as a StdPicture object creatable within Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic for Applications (VBA) projects in Microsoft Visio.

Currently, only in-process solutions can use the Picture property because the IPictureDisp interface cannot be marshaled.

To get information about the StdPicture object that supports the IPictureDisp interface

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click stdole.

  4. Under Classes, examine the class named StdPicture.

For details about the IPictureDisp interface, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Selection.PrimaryItem Property (Visio)

 Copy code hover
[image]

Selection.PrimaryItem Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that is a Selection object's primary item. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .PrimaryItem

expression A variable that represents a Selection object.

Return Value

Shape

Remarks

In a drawing window, the primary selected item is shown with green selection handles and non-primary selected items are shown with blue selection handles. The outcome of some operations is affected by which selected item is the primary item. For example, the Align Shapes command aligns non-primary selected items with the primary selected item.

If a Selection object contains no Shape objects, or the primary Shape object is one that isn't enumerated given the Selection object's IterationMode property, the PrimaryItem property returns Nothing and raises no exception.


Selection.SelectionForDragCopy Property (Visio)

 Copy code hover
[image]

Selection.SelectionForDragCopy Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Selection object that represents the collection of shapes that will participate in drag or copy operations, based on the current selection. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .SelectionForDragCopy

expression A variable that represents a Selection object.

Return Value

Selection

Remarks

The Selection object that SelectionForDragCopy returns includes any unselected members of selected containers and lists, and unselected callouts that are associated with selected target shapes; all of these will also participate in the drag or copy operation.


Selection.Stat Property (Visio)

 Copy code hover
[image]

Selection.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Selection object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Selection.Style Property (Visio)

 Copy code hover
[image]

Selection.Style Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the style for a Selection object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Style

expression A variable that represents a Selection object.

Return Value

String

Remarks

If a style consists of different text, line, and fill styles, the Style property returns the fill style. If you set the Style property to a nonexistent style, your program generates an error.

To preserve local formatting, use the StyleKeepFmt property.

Beginning with Visio 2002, setting the Style propery to an empty string ("") will cause the master's style to be reapplied to the shape. (Earlier versions generate a "no such style" exception.) If the shape has no master, its style remains unchanged.


Selection.StyleKeepFmt Property (Visio)

 Copy code hover
[image]

Selection.StyleKeepFmt Property (Visio)
Send feedback

Published: July 16, 2012

Applies a style to an object while preserving local formatting. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .StyleKeepFmt

expression A variable that represents a Selection object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error.

Beginning with Microsoft Visio 2002, setting StyleKeepFmt to an empty string ("") will cause the master's style to be reapplied to the shape. (Earlier versions generate a "no such style" exception.) If the shape has no master, its style remains unchanged.


Selection.TextStyle Property (Visio)

 Copy code hover
[image]

Selection.TextStyle Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the text style for an object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .TextStyle

expression A variable that represents a Selection object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error. Setting one kind of style to an existing style of another kind (for example, setting the TextStyle property to a fill style) does nothing. Setting one kind of style to an existing style that has more than one set of attributes changes only the attributes for that component (for example, setting the TextStyle property to a style that has line, text, and fill attributes changes only the text attributes).

To preserve a shape's local formatting, use the TextStyleKeepFmt property.

Beginning with Visio 2002, setting TextStyle to an empty string ("") will cause the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.


Selection.TextStyleKeepFmt Property (Visio)

 Copy code hover
[image]

Selection.TextStyleKeepFmt Property (Visio)
Send feedback

Published: July 16, 2012

Applies a text style to an object while preserving local formatting. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .TextStyleKeepFmt

expression A variable that represents a Selection object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error. Setting one kind of style to an existing style of another kind (for example, setting the TextStyleKeepFmt property to a fill style) does nothing. Setting one kind of style to an existing style that has more than one set of attributes changes only the attributes for that component (for example, setting the TextStyleKeepFmt property to a style that has line, text, and fill attributes changes only the text attributes).

Beginning with Visio 2002, setting TextStyleKeepFmt to an empty string ("") will cause the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.


Selection Methods (Visio)

 Copy code hover
[image]

Selection Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddToContainers | Adds the selection of shapes to all underlying containers that allow it as a member.
AddToGroup | Adds the selected shapes to the selected group.
Align | Aligns two or more selected shapes.
AutomaticLink | Links selected shapes to data rows in the specified data recordset automatically, without requiring you to specify the exact correspondence of all shapes and data rows. Returns the number of shapes linked.
AvoidPageBreaks | Makes small adjustments to selected shapes to move them off page breaks.
BoundingBox | Returns a rectangle that tightly encloses the shapes of a selection.
BreakLinkToData | Breaks links between all shapes in the selection and data rows in the specified data recordset.
BringForward | Brings the shape or selected shapes forward one position in the z-order.
BringToFront | Brings the shape or selected shapes to the front of the z-order.
Combine | Creates a new shape by combining selected shapes.
ConnectShapes | Connects two or more selected shapes with a dynamic connector. ReturnsNothing.
ConvertToGroup | Converts a selection or an object from another application (a linked or embedded object) to a group.
Copy | Copies a selection to the Clipboard.
Cut | Deletes a selection and places it on the Clipboard.
Delete | Deletes an object or selection.
DeleteEx | Deletes additional shapes associated with the selection, such as connectors and unselected container members, when the selection is deleted.
DeselectAll | Deselects all shapes in a window or selection.
Distribute | Distributes three or more selected shapes at regular intervals on the drawing page. The order of selection is irrelevant.
DrawRegion | Draws a new shape that represents the region containing a given point.
Duplicate | Duplicates a selection.
Export | Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.
FitCurve | Reduces the number of geometry segments in a shape or shapes by replacing them with similar spline, arc, and line segments that approximate the paths of the initial segments. Typically, this reduces the number of segments in the shape.
Flip | Flips selected shapes either as a group or individually about their pins. Returns Nothing.
FlipHorizontal | Flips an object horizontally.
FlipVertical | Flips an object vertically.
Fragment | Breaks selected shapes into smaller shapes.
GetCallouts | Returns the list of identifiers of the callout shapes in the selection.
GetContainers | Returns an array of shape identifiers (IDs) of the container shapes in the selection.
GetIDs | Gets the shape IDs of the shapes in the selection.
Group | Groups the objects that are selected in a selection, or it converts a shape into a group.
Intersect | Creates one closed shape from the area in which selected shapes overlap or intersect.
Join | Creates a new shape by joining selected shapes.
Layout | Lays out the shapes and/or reroutes the connectors for the page, master, group, or selection.
LayoutChangeDirection | Revises the layout of a selection of connected shapes by rotating or flipping the connected shapes as a unit, without rotating or flipping the individual shapes.
LayoutIncremental | Makes small adjustments to the position of shapes in the selection to better align the shapes or to space them evenly from other shapes.
LinkToData | Links a selection of shapes to a single data row in a data recordset.
MemberOfContainersIntersection | Returns an array of identifiers of the shapes that belong to the normal or list containers that contain all the shapes in the selection.
MemberOfContainersUnion | Returns an array of identifiers of the shapes that belong to the normal or list containers that contain at least one of the shapes in the selection.
Move | Moves a selection a specified distance.
MoveToSubprocess | Moves the selection to the specified page, and drops a replacement shape on the source page and links it to the target page. Returns the selection of moved shapes on the target page.
Offset | Offsets a selection a specified amount.
RemoveFromContainers | Removes the selection of shapes from all lists and containers of which the selection is a member.
RemoveFromGroup | Removes selected shapes from a group.
ReplaceShape | Replaces the specified selection with one or more instances of the master passed as the first parameter, and returns an array containing the new shape or shapes.
Resize | Resizes the selection by moving shape handles as specified.
ReverseEnds | Reverses an object by flipping it both horizontally and vertically.
Rotate | Rotates selected shapes either as a group or individually about their pins.
Rotate90 | Rotates an object 90 degrees counterclockwise.
Select | Selects or clears the selection of an object.
SelectAll | Selects all possible shapes in a window or selection.
SendBackward | Moves a shape or selected shapes back one position in the z-order.
SendToBack | Moves the shape or selected shapes to the back of the z-order.
SetContainerFormat | Changes the formatting of one aspect of all the containers in the selection, and returns an array of identifiers of shapes that belong to the containers and whose formatting was changed.
SetQuickStyle | Sets the quick style of the specified selection.
Subtract | Subtracts the areas that overlap the selected shape.
SwapEnds | Swaps the begin and endpoints of a one-dimensional (1-D) shape.
Trim | Trims selected shapes into smaller shapes.
Ungroup | Ungroups a group.
Union | Creates a new shape from the perimeter of selected shapes.
UpdateAlignmentBox | Updates the alignment box for a shape.
VisualBoundingBox |


Selection.AddToContainers Method (Visio)

 Copy code hover
[image]

Selection.AddToContainers Method (Visio)
Send feedback

Published: July 16, 2012

Adds the selection of shapes to all underlying containers that allow it as a member.

Version Information

Version Added: Visio 2010

Syntax

expression .AddToContainers

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

When you call the AddToContainers method, Microsoft Visio uses the setting of the ContainerProperties.ResizeAsNeeded property for each container to determine how the container resizes.

Each shape in the selection is added to its underlying containers according to the position of the shape. As a result, different shapes may end up being contained by different containers. If the underlying container is a list, the shape is added as normal container member, not list member.

The AddToContainers method works only if the selection sits at least partially on top of a container that does not already contain it.


Selection.AddToGroup Method (Visio)

 Copy code hover
[image]

Selection.AddToGroup Method (Visio)
Send feedback

Published: July 16, 2012

Adds the selected shapes to the selected group.

Version Information

Version Added: Visio 2.0

Syntax

expression .AddToGroup

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

The current selection must contain both the shapes to add and the group to which you want to add them. The group must be the primary selection or the only group in the selection.

Example

The following macro shows how to use the AddToGroup method to add selected shapes to a selected group.

Before running this macro, open the Basic Shapes stencil or a document based on the Basic Diagram template.

VBA Copy code Copy code

Public Sub AddToGroup_Example()

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Square"), 3, 8

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 4, 8

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Square"), visSelect
 ActiveWindow.Selection.Group

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 5, 6

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Sheet.3"), visSelect
 ActiveWindow.Selection.AddToGroup

End Sub


Selection.Align Method (Visio)

 Copy code hover
[image]

Selection.Align Method (Visio)
Send feedback

Published: July 16, 2012

Aligns two or more selected shapes.

Version Information

Version Added: Visio 2003

Syntax

expression .Align(AlignHorizontal, AlignVertical, GlueToGuide)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
AlignHorizontal | Required | VisHorizontalAlignTypes | Aligns selected shapes along a horizontal axis. See Remarks for possible values.
AlignVertical | Required | VisVerticalAlignTypes | Aligns selected shapes along a vertical axis. See Remarks for possible values.
GlueToGuide | Optional | Boolean | If True, creates a guide and glues selected shapes to it; if False, it does not. The default is False.

Return Value

Nothing

Remarks

The following possible values for AlignHorizontal are declared in VisHorizontalSelectionTypes in the Visio type library.

Constant | Value | Description
visHorzAlignCenter | 2 | Aligns to the center of the primary selected shape.
visHorzAlignLeft | 1 | Aligns to the left of the primary selected shape.
visHorzAlignNone | 0 | Does not align horizontally.
visHorzAlignRight | 3 | Aligns to the right of the primary selected shape.

The following possible values for AlignVertical are declared in VisVerticalSelectionTypes in the Visio type library.

Constant | Value | Description
visVertAlignBottom | 3 | Aligns to bottom of primary selected shape.
visVertAlignMiddle | 2 | Aligns to middle of primary selected shape.
visVertAlignNone | 0 | Does not align vertically.
visVertAlignTop | 1 | Aligns to top of primary selected shape.

If you pass non-zero values for both AlignHorizontal and AlignVertical, the selected shapes appear superimposed. The most recently created shape appears at the front of the z-order.

Calling the Align method is equivalent to clicking Position on the Home tab and then setting options under Align Shapes.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Align method to align three shapes vertically.

VBA Copy code Copy code
Public Sub Align_Example()

    Dim vsoShape1 As Visio.Shape
    Dim vsoShape2 As Visio.Shape
    Dim vsoShape3 As Visio.Shape

    Set vsoShape1 = Application.ActiveWindow.Page.DrawRectangle(1, 9, 3, 7)
    Set vsoShape2 = Application.ActiveWindow.Page.DrawRectangle(3, 6, 5, 5)
    Set vsoShape3 = Application.ActiveWindow.Page.DrawRectangle(6, 4, 8, 2)

    ActiveWindow.DeselectAll

    ActiveWindow.Select vsoShape1, visSelect
    ActiveWindow.Select vsoShape2, visSelect
    ActiveWindow.Select vsoShape3, visSelect

    Application.ActiveWindow.Selection.Align visHorzAlignRight, visVertAlignNone, False

End Sub


Selection.AutomaticLink Method (Visio)

 Copy code hover
[image]

Selection.AutomaticLink Method (Visio)
Send feedback

Published: July 16, 2012

Links selected shapes to data rows in the specified data recordset automatically, without requiring you to specify the exact correspondence of all shapes and data rows. Returns the number of shapes linked.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .AutomaticLink(DataRecordsetID, ColumnNames(), AutoLinkFieldTypes(), FieldNames(), AutoLinkBehavior, ShapeIDs())

expression An expression that returns a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The value of the ID property of the DataRecordset object that contains the data rows to link to.
ColumnNames() | Required | String | An array of strings that correspond to names of columns in the data recordset.
AutoLinkFieldTypes() | Required | Long | An array of Long values from the VisAutoLinkFieldTypes enumeration, consisting of shape attribute types. At least one position in the array must have a value that corresponds to the values in the same position in the ColumnNames and FieldNames arrays.
FieldNames() | Required | String | An array of strings that represent shape values.
AutoLinkBehavior | Required | Long | A combination of one or more constants from the VisAutoLinkBehavior enumeration that specify how the linking will occur. See Remarks for possible values.
ShapeIDs() | Required | Long | Out parameter. An array of IDs of shapes (of type Long) that were linked by the method.

Return Value

Long

Remarks

For the ColumnNames() parameter, pass a string array consisting of names of columns in the database. At least one position in the array must have a value that corresponds to the values in the same position in the AutoLinkFieldTypes() and FieldNames() arrays.

For the AutoLinkFieldTypes() parameter, pass an array of Long values from the VisAutoLinkFieldTypes enumeration, consisting of shape attribute types. Among the shape attributes enumerated are height, width, text, and the name of the master the shape was derived from. At least one position in the array must have a value that corresponds to the values in the same position in the ColumnNames() and FieldNames() arrays.

For the FieldNames() parameter, pass an array of strings that represent shape values. At least one position in the FieldNames() array must have a value that corresponds to the values in the same position in the ColumnNames() and AutoLinkFieldTypes() arrays.

For most values of AutoLinkFieldTypes(), for example, for visAutoLinkShapeText, it is not necessary to specify the FieldNames() value; you can pass an empty string instead. However, when you pass the visAutoLinkCustPropsLabel, visAutoLinkUserRowName, visAutoLinkPropRowNameU, or visAutoLinkUserRowNameU values of AutoLinkFieldTypes, you must pass a value for FieldNames() that fully specifies the shape data item (called custom property value in some previous versions of Visio) to compare to the data column name.

For the optional AutoLinkBehavior parameter, you can pass a combination of one or more values from the VisAutoLinkBehaviors enumeration that specify how the linking will occur. The following table shows possible values.

Constant | Value | Description
visAutoLinkDontReplaceExistingLinks | 16 | Do not replace existing links.
visAutoLinkGenericProgressBar | 2 | Show generic progress bar instead of more detailed one.
visAutoLinkIncludeHiddenProps | 64 | Include hidden properties.
visAutoLinkNoApplyDataGraphic | 4 | Do not apply the default data graphic to linked shapes.
visAutoLinkNullMatchesNoFormula | 32 | Allow null database values to map to "No Formula" in the Visio ShapeSheet spreadsheet.
visAutoLinkReplaceExistingLinks | 8 | Replace existing links.
visAutoLinkSelectedShapesOnly | 1 | Link selected shapes only, not sub-shapes of selected shapes.

You cannot pass a value that includes both visAutoLinkDontReplaceExistingLinks and visAutoLinkReplaceExistingLinks. The method returns an error if you attempt to do so.

If you pass a value for AutoLinkBehavior, it modifies the default behavior, which is as follows:

  • Use the data recordset's LinkReplaceBehavior setting to determine whether to break existing links. If the setting is visLinkReplacePrompt, it is treated as if it were visLinkReplaceAlways.

  • Link selected shapes and their subshapes.

  • Do not replace the detailed progress bar with the generic progress bar.

  • Apply data graphics.

For the ShapeIDs() parameter, pass an empty, dimensionless array of type Long. Visio will return the array filled with the IDs of the shapes that were linked to data by the method.

To provide Visio with enough information to create the links, you must supply at least one set of matching data: the name of a column in the data recordset, a shape attribute type, and, if necessary, a shape value, all at the same index position of the corresponding arrays you pass to the method. The shape attribute type indicates the attribute of the shape to base the matching upon. The attribute can be the value of a shape data item, shape text, or another of the values specified in the VisAutoLinkFieldTypes enumeration.

For example, say that your drawing contains a selection of shapes representing different employees and that the shape text, which in this case displays the respective employee's names, identifies the shapes. As shown in the example in this topic, you would pass the method the following parameters:

  • For the ColumnNames() parameter, an array that contains the "EmployeeName" column name at array position 0.

  • For the AutoLinkFieldTypes() parameter, enumeration value visAutoLinkShapeText at array position 0.

  • For the FieldNames() parameter, an empty string (''") at array position 0, because, when AutoLinkFieldTypes() is visAutoLinkShapeText, it is not necessary to specify the FieldNames() value.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AutomaticLink method to automatically link shapes in a drawing to data in a data recordset. It links data for employees contained in a data recordset to shapes in the drawing whose shape text corresponds to the employee names.

Before running this macro, create a data recordset that contains a column named "EmployeeName" that lists employee names, as well as any other columns you want to include, and then assign those employee names as shape text to corresponding shapes in your Visio drawing. Use the DataRecordsets.Add method to add the data recordset to the DataRecordsets collection of the active document. Make sure that the data recordset is the one that you added most recently to the collection.

VBA Copy code Copy code
Public Sub AutomaticLink_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim vsoSelection As Visio.Selection
    Dim astrColumnNames(1) As String
    Dim alngFieldTypes(1) As Long
    Dim astrFieldNames(1) As String
    Dim alngShapesLinked() As Long
    Dim intCount As Integer

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount )

    astrColumnNames(0) = "EmployeeName"
    alngFieldTypes(0) = Visio.VisAutoLinkFieldTypes.visAutoLinkShapeText
    astrFieldNames(0) = ""

    ActiveWindow.DeselectAll
    ActiveWindow.SelectAll

    Set vsoSelection = ActiveWindow.Selection
    vsoSelection.AutomaticLink vsoDataRecordset.ID, _
                    astrColumnNames, _
                    alngFieldTypes, _
                    astrFieldNames, 0, alngShapesLinked

End Sub


Selection.AvoidPageBreaks Method (Visio)

 Copy code hover
[image]

Selection.AvoidPageBreaks Method (Visio)
Send feedback

Published: July 16, 2012

Makes small adjustments to selected shapes to move them off page breaks.

Version Information

Version Added: Visio 2010

Syntax

expression .AvoidPageBreaks

expression A variable that represents a Selection object.

Return Value

Nothing


Selection.BoundingBox Method (Visio)

 Copy code hover
[image]

Selection.BoundingBox Method (Visio)
Send feedback

Published: July 16, 2012

Returns a rectangle that tightly encloses the shapes of a selection.

Version Information

Version Added: Visio 4.5

Syntax

expression .BoundingBox(Flags, lpr8Left, lpr8Bottom, lpr8Right, lpr8Top)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Required | Integer | Flags that influence the bounding box calculated for each shape that contributes to the resulting bounding box.
lpr8Left | Required | Double | Returns the x-coordinate of the left edge of the bounding box.
lpr8Bottom | Required | Double | Returns the y-coordinate of the bottom edge of the bounding box.
lpr8Right | Required | Double | Returns the x-coordinate of the right edge of the bounding box.
lpr8Top | Required | Double | Returns the y-coordinate of the top edge of the bounding box.

Return Value

Nothing

Remarks

For a Shape object, the BoundingBox method returns a rectangle that tightly encloses the shape and its subshapes.

For a Page, Master, or Selection object, the BoundingBox method returns a rectangle that tightly encloses the page's, master's, or selection's shapes and their subshapes.

If the BoundingBox method returns an error, or if it is asked to return the rectangle enclosing zero shapes, the rectangle returned is { left: 0, bottom: 0, right: -1, top: -1 }; otherwise, the rectangle returned has left less than or equal to (<=) right, and bottom less than or equal to (<=) top. The numbers returned are in internal units (inches).

The bounding rectangle returned for an individual shape depends on its Type property.

Constant | Description
visTypePage | Equivalent to Page.BoundingBox or Master.BoundingBox.
visTypeGroup | Rectangle that tightly encloses the group and its subshapes.
visTypeShape | Determined rectangle depends on flags. See the following table.
visTypeForeignObject | Determined rectangle depends on flags. See the following table.
visTypeGuide | Determined rectangle depends on flags. See the following table.

The method will raise an exception for object type visTypeDoc.

The Flags argument has several bits that control the bounding box retrieved for each shape. If more than one of the bits described in the following table is set, the rectangle determined for the shape covers all rectangles implied by the bits.

Flag | Value | Description
visBBoxUprightWH | &H1 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the shape's width-height box.If the shape is not rotated, its upright width-height box and its width-height box are the same. Paths in the shape's geometry need not and often do not lie entirely within the shape's width-height box.
visBBoxUprightText | &H2 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the shape's text.
visBBoxExtents | &H4 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the paths stroked by the shape's geometry.This may be larger or smaller than the shape's upright width-height box. The extents box determined for a shape of type visTypeForeignObject equals that shape's upright width-height box.
visBBoxIncludeHidden | &H10 | Includes hidden geometry.
visBBoxIgnoreVisible | &H20 | Ignores visible geometry.
visBBoxIncludeDataGraphics | &H10000 | Includes data-graphic callout shapes (and their sub-shapes) that are applied to the shapes in the selection. Off by default.
visBBoxIncludeGuides | &H1000 | Includes extents for shapes of type visTypeguide. By default, the extents of shapes of type visTypeGuide are ignored.If you request guide extents, then only the x positions of vertical guides and the y positions of horizontal guides contribute to the rectangle that is returned. If any vertical guides are reported on, an infinite y extent is returned. If any horizontal guides are reported on, an infinite x extent is returned. If any rotated guides are reported on, infinite x and y extents are returned.
visBBoxDrawingCoords | &H2000 | Returns numbers in the drawing coordinate system of the page or master whose shapes are being considered. By default, the returned numbers are drawing units in the local coordinate system of the parent of the considered shapes.
visBBoxNoNonPrint | &H4000 | Ignores the extents of shapes that are nonprinting. A shape is nonprinting if the value of its NonPrinting cell is non-zero or it belongs only to nonprinting layers.

The extents rectangle is determined using the center of the shape's strokes; it does not take into account the width of the strokes. Nor does the rectangle include any area covered by shadows or line end markers. Microsoft Visio does not expose a means to determine a shape's "black bits" box, that is, the extents box adjusted to account for stroke widths, shadows, and line ends.

A shape may have control points or connection points that lie outside any of the bounding rectangles reported by the shape. You can determine the position of control points and connection points by querying results of the shape's cells.

Example

The following procedure prints the dimensions of the bounding box of the selected shape in the Immediate window. If more than one shape is selected in the active window, a message box indicating an error is displayed. In all cases, results are reported in the drawing units of the page or master to which the shape belongs. This means that if the shape is a subshape of a group, visBBoxDrawingCoords is passed as a flag to the BoundingBox method.

If the shape is a guide, the procedure passes visBBoxIncludeGuides to the BoundingBox method so that the shape will be considered to have extent. Three rectangles are reported for the shape:

  • visBBoxUprightWH: an upright box that encloses the shape's width-height box

  • visBBoxUprightText: an upright box that encloses the shape's text box

  • visBBoxExtents: an upright box that encloses the shape's paths

To run this macro, make sure exactly one shape is selected on the Visio drawing page.

VBA Copy code Copy code

Public Sub BoundingBox_Example()

 Dim vsoSelection As Visio.Selection
 Set vsoSelection = ActiveWindow.Selection
 vsoSelection.IterationMode = visSelModeSkipSub

 If vsoSelection.Count <> 1 Then
 MsgBox "BoundingBox_Example() expects exactly one selected shape."

 Else

 Dim vsoShape As Visio.Shape
 Set vsoShape = vsoSelection(1)
 Dim intFlags As Integer
 intFlags = 0

 If vsoShape.ContainingShape.Type = visTypeGroup Then

 intFlags = visBBoxDrawingCoords

 End If

 If vsoShape.Type = visTypeGuide Then

 intFlags = intFlags + visBBoxIncludeGuides

 End If

 Dim dblTop As Double
 Dim dblBottom As Double
 Dim dblLeft As Double
 Dim dblRight As Double

 vsoShape.BoundingBox intFlags + visBBoxUprightWH, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Upright WH "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 vsoShape.BoundingBox intFlags + visBBoxUprightText, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Upright text "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 vsoShape.BoundingBox intFlags + visBBoxExtents, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Bounding Box "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 End If

End Sub

The following macro uses the BoundingBox method and the ShapesOverlap() function to determine if one shape (vsoShape2) overlaps another (vsoShape1).

VBA Copy code Copy code
Public Sub OverlappingShapes_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim blsIsOverlapping As Boolean

 Set vsoShape1 = Application.ActiveWindow.Page.Drop(Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Square"), 3, 9)

 Set vsoShape2 = Application.ActiveWindow.Page.Drop(Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3, 8)

 blsIsOverlapping = ShapesOverlap(vsoShape2, vsoShape1)

 If blsIsOverlapping Then
 Debug.Print "Shapes overlap."
 Else
 Debug.Print "Shapes do not overlap."
 End If

End Sub

Private Function ShapesOverlap(vsoShape1 As IVShape, vsoShape2 As IVShape) As Boolean

 Dim dblLeft1 As Double
 Dim dblLeft2 As Double
 Dim dblBottom1 As Double
 Dim dblBottom2 As Double
 Dim dblRight1 As Double
 Dim dblRight2 As Double
 Dim dblTop1 As Double
 Dim dblTop2 As Double

 vsoShape1.BoundingBox Flags + visBBoxExtents, dblLeft1, dblBottom1, dblRight1, dblTop1
 vsoShape2.BoundingBox Flags + visBBoxExtents, dblLeft2, dblBottom2, dblRight2, dblTop2

 If ((dblLeft2 >= dblLeft1 And dblLeft2 <= dblRight1) Or _
 (dblRight2 >= dblLeft1 And dblRight2 <= dblRight1)) And _
 ((dblTop2 >= dblBottom1 And dblTop2 <= dblTop1) Or _
 (dblBottom2 >= dblBottom1 And dblBottom2 <= dblTop1)) Then
 ShapesOverlap = True
 Else
 ShapesOverlap = False
 End If

End Function


Selection.BreakLinkToData Method (Visio)

 Copy code hover
[image]

Selection.BreakLinkToData Method (Visio)
Send feedback

Published: July 16, 2012

Breaks links between all shapes in the selection and data rows in the specified data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .BreakLinkToData(DataRecordsetID)

expression An expression that returns a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of the data recordset containing the data rows with which to break links.

Return Value

Nothing

Remarks

If Microsoft Visio cannot break the link between a shape in the selection and the data row, or if the link does not exist, Visio skips that shape and goes on to the next shape in the selection. After you run the method, to determine if anyshapes in the selection are still linked to a data row, call the Shape.GetLinkedDataRow method on each shape in the selection. If the GetLinkedDataRow method fails for any shape, it indicates that the shape either no longer is linked to the data row, or never was linked to the data row.

Note that breaking links between shapes and data does not remove shape data (called custom properties in some previous versions of Visio) from shapes, nor does it remove data graphics associated with shapes.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the BreakLinkToData method to break all links between the shapes in a selection and data rows in a data recordset.

Before running this macro, place several shapes on the page, add at least one data recordset to the DataRecordsets collection of the document, and use any linking method to link several shapes to one or more data rows in the data recordset you most recently added to the collection.

VBA Copy code Copy code
Public Sub BreakLinkToData_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim vsoSelection As Visio.Selection
    Dim intCount As Integer

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount)

    ActiveWindow.DeselectAll
    ActiveWindow.SelectAll

    Set vsoSelection = ActiveWindow.Selection
    Call vsoSelection.BreakLinkToData(vsoDataRecordset.ID)

End Sub


Selection.BringForward Method (Visio)

 Copy code hover
[image]

Selection.BringForward Method (Visio)
Send feedback

Published: July 16, 2012

Brings the shape or selected shapes forward one position in the z-order.

Version Information

Version Added: Visio 2.0

Syntax

expression .BringForward

expression A variable that represents a Selection object.

Return Value

Nothing

Example

The following macro shows how to bring a shape forward in the z-order on a page.

VBA Copy code Copy code

Public Sub BringForward_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape

 'Draw three rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 1, 4, 4)
 vsoShape1.Text = "1"
 Set vsoShape2 = ActivePage.DrawRectangle(2, 2, 5, 5)
 vsoShape2.Text = "2"
 Set vsoShape3 = ActivePage.DrawRectangle(3, 3, 6, 6)
 vsoShape3.Text = "3"

 'Bring vsoShape1 forward one position in the z-order.
 vsoShape1.BringForward

End Sub


Selection.BringToFront Method (Visio)

 Copy code hover
[image]

Selection.BringToFront Method (Visio)
Send feedback

Published: July 16, 2012

Brings the shape or selected shapes to the front of the z-order.

Version Information

Version Added: Visio 2.0

Syntax

expression .BringToFront

expression A variable that represents a Selection object.

Return Value

Nothing

Example

The following macro shows how to bring a shape to the front of the z-order on a page.

VBA Copy code Copy code
Public Sub BringToFront_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape

 'Draw three rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 1, 4, 4)
 vsoShape1.Text = "1"
 Set vsoShape2 = ActivePage.DrawRectangle(2, 2, 5, 5)
 vsoShape2.Text = "2"
 Set vsoShape3 = ActivePage.DrawRectangle(3, 3, 6, 6)
 vsoShape3.Text = "3"

 'Bring vsoShape1 to the front of the z-order.
 vsoShape1.BringToFront

End Sub


Selection.Combine Method (Visio)

 Copy code hover
[image]

Selection.Combine Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape by combining selected shapes.

Version Information

Version Added: Visio 2.0

Syntax

expression .Combine

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

Calling the Combine method is equivalent to clicking Combine in the Microsoft Visio user interface (click Operations in the Shape Design group on the Developer tab). The produced shape will be the topmost shape in its containing shape and will inherit the text and formatting of the first selected shape. The original shapes are deleted and no shapes are selected when the operation is complete.

The Combine method is similar to the Join method but differs in the following ways:

  • The Combine method produces a shape with one Geometry section for each original shape. The resulting shape will have holes in regions where the original shapes overlapped.

  • The Join method differs from Combine in that it will coalesce abutting line and curve segments in the original shapes into a single Geometry section in the resulting shape.


Selection.ConnectShapes Method (Visio)

 Copy code hover
[image]

Selection.ConnectShapes Method (Visio)
Send feedback

Published: July 16, 2012

Connects two or more selected shapes with a dynamic connector. ReturnsNothing.

Version Information

Version Added: Visio 2003

Syntax

expression .ConnectShapes

expression A variable that represents a Selection object.

Return Value

Nothing

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ConnectShapes method to connect two shapes.

VBA Copy code Copy code
Public Sub ConnectShapes_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape

 Set vsoShape1 = Application.ActiveWindow.Page.DrawRectangle(2, 9, 4, 7)
 Set vsoShape2 = Application.ActiveWindow.Page.DrawRectangle(5, 6, 7, 3)

 ActiveWindow.DeselectAll
 ActiveWindow.Select vsoShape1, visSelect
 ActiveWindow.Select vsoShape2, visSelect
 Application.ActiveWindow.Selection.ConnectShapes

End Sub


Selection.ConvertToGroup Method (Visio)

 Copy code hover
[image]

Selection.ConvertToGroup Method (Visio)
Send feedback

Published: July 16, 2012

Converts a selection or an object from another application (a linked or embedded object) to a group.

Version Information

Version Added: Visio 2.0

Syntax

expression .ConvertToGroup

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

If the object to convert is a metafile, it will be converted into basic shapes.


Selection.Copy Method (Visio)

 Copy code hover
[image]

Selection.Copy Method (Visio)
Send feedback

Published: July 16, 2012

Copies a selection to the Clipboard.

Version Information

Version Added: Visio 2002

Syntax

expression .Copy(Flags)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Optional | Variant | Determines how shapes are translated during the copy operation.

Return Value

Nothing

Remarks

Possible values for Flags are declared by the Visio type library in VisCutCopyPasteCodes, and are described in the following table.

Flag | Value | Description
visCopyPasteNormal | &H0 | Follow default copying behavior.
visCopyPasteNoTranslate | &H1 | Copy shapes to their original coordinate locations.
visCopyPasteCenter | &H2 | Copy shapes to the center of the page.
visCopyPasteNoHealConnectors | &H4 | Do not clean up connectors attached to cut shapes.
visCopyPasteNoContainerMembers | &H8 | Do not cut and copy unselected members of containers or lists.
visCopyPasteNoAssociatedCallouts | &H16 | Do not cut and copy unselected callouts associated with shapes.
visCopyPasteDontAddToContainers | &H32 | Do not add pasted shapes to any underlying containers.
visCopyPasteNoCascade | &H64 | Do not offset shapes on copy.

Setting Flags to visCopyPasteNormal is the equivalent of the behavior in the user interface. You should use visCopyPasteNormal and the other flags consistently. For example, if you use the value visCopyPasteNoTranslate to copy, you should also use that value to paste, because that is the only way to ensure that shapes are pasted to their original coordinate location.

To make a copy without using the Clipboard, use the Duplicate method.


Selection.Cut Method (Visio)

 Copy code hover
[image]

Selection.Cut Method (Visio)
Send feedback

Published: July 16, 2012

Deletes a selection and places it on the Clipboard.

Version Information

Version Added: Visio 2002

Syntax

expression .Cut(Flags)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Optional | Variant | Determines how shapes are translated during the cut operation.

Return Value

Nothing

Remarks

Possible values for Flags are declared by the Visio type library in VisCutCopyPasteCodes, and are described in the following table.

Flag | Value | Description
visCopyPasteNormal | &H0 | Follow default copying behavior.
visCopyPasteNoTranslate | &H1 | Copy shapes to their original coordinate locations.
visCopyPasteCenter | &H2 | Copy shapes to the center of the page.
visCopyPasteNoHealConnectors | &H4 | Do not clean up connectors attached to cut shapes.
visCopyPasteNoContainerMembers | &H8 | Do not cut and copy unselected members of containers or lists.
visCopyPasteNoAssociatedCallouts | &H16 | Do not cut and copy unselected callouts associated with shapes.
visCopyPasteDontAddToContainers | &H32 | Do not add pasted shapes to any underlying containers.
visCopyPasteNoCascade | &H64 | Do not offset shapes on copy.

Setting Flags to visCopyPasteNormal is the equivalent of the behavior in the user interface. You should use visCopyPasteNormal and the other flags consistently. For example, if you use the value visCopyPasteNoTranslate to copy, you should also use that value to paste, because that is the only way to ensure that shapes are pasted to their original coordinate location.


Selection.Delete Method (Visio)

 Copy code hover
[image]

Selection.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object or selection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a Selection object.

Return Value

Nothing


Selection.DeleteEx Method (Visio)

 Copy code hover
[image]

Selection.DeleteEx Method (Visio)
Send feedback

Published: July 16, 2012

Deletes additional shapes associated with the selection, such as connectors and unselected container members, when the selection is deleted.

Version Information

Version Added: Visio 2010

Syntax

expression .DeleteEx(DelFlags)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
DelFlags | Required | Long | The additional shapes to delete. See Remarks for possible values.

Return Value

Nothing

Remarks

DelFlags must be one or a bitwise combination of the following VisDeleteFlags constants.

Constant | Value | Description
visDeleteNormal | 0 | Match the deletion behavior in the user interface.
visDeleteHealConnectors | 1 | Delete connectors attached to deleted shapes.
visDeleteNoHealConnectors | 2 | Do not delete connectors attached to deleted shapes.
visDeleteNoContainerMembers | 4 | Do not delete unselected members of containers or lists.
visDeleteNoAssociatedCallouts | 8 | Do not delete unselected callouts associated with shapes.

In a bitwise combination of DelFlags constants, you cannot combine visDeleteHealConnectors and visDeleteNoHealConnectors. If you attempt to do so, Microsoft Visio returns an Invalid Parameter error.


Selection.DeselectAll Method (Visio)

 Copy code hover
[image]

Selection.DeselectAll Method (Visio)
Send feedback

Published: July 16, 2012

Deselects all shapes in a window or selection.

Version Information

Version Added: Visio 2.0

Syntax

expression .DeselectAll

expression A variable that represents a Selection object.

Return Value

Nothing


Selection.Distribute Method (Visio)

 Copy code hover
[image]

Selection.Distribute Method (Visio)
Send feedback

Published: July 16, 2012

Distributes three or more selected shapes at regular intervals on the drawing page. The order of selection is irrelevant.

Version Information

Version Added: Visio 2003

Syntax

expression .Distribute(Distribute, GlueToGuide)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Distribute | Required | VisDistributeTypes | Specifies how the shapes are distributed. See Remarks for possible values.
GlueToGuide | Optional | Boolean | If True, creates guides and glues selected shapes to them. If False, does not. Default is False.

Return Value

Nothing

Remarks

The following possible values for Distribute are declared in VisDistributeTypes in the Visio type library.

Constant | Value | Description
visDistHorzCenter | 2 | Distributes shapes horizontally so that their bottom edges are uniformly spaced.
visDistHorzLeft | 1 | Distributes shapes horizontally so that their left edges are uniformly spaced.
visDistHorzRight | 3 | Distributes shapes horizontally so that their right edges are uniformly spaced.
visDistHorzSpace | 0 | Distributes shapes horizontally so that there is a uniform space between shapes.
visDistVertBottom | 7 | Distributes shapes vertically so that their bottom edges are uniformly spaced.
visDistVertMiddle | 6 | Distributes shapes vertically so that their centers are uniformly spaced.
visDistVertSpace | 4 | Distributes shapes vertically so that there is a uniform space between shapes.
visDistVertTop | 5 | Distributes shapes vertically so that their top edges are uniformly spaced.

Calling the Distribute method is equivalent to setting options in the Distribute Shapes dialog box (on the Home tab, click Position, point to Space Shapes, and then click More Distribute Options).

Passing True for the optional GlueToGuide argument is the equivalent of selecting the Create guides and glue shapes to them check box in the Distribute Shapes dialog box.

When you pass True for GlueToGuide, Visio creates guides to retain the distribution of the shapes. You can select and move the outermost guides to move the shapes without changing their distribution.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Distribute method to distribute three shapes vertically so that their right edges are uniformally spaced and glued to guides.

VBA Copy code Copy code
Public Sub Distribute_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape

 Set vsoShape1 = Application.ActiveWindow.Page.DrawRectangle(1, 9, 3, 7)
 Set vsoShape2 = Application.ActiveWindow.Page.DrawRectangle(3, 6, 5, 5)
 Set vsoShape3 = Application.ActiveWindow.Page.DrawRectangle(6, 4, 8, 2)

 ActiveWindow.DeselectAll

 ActiveWindow.Select vsoShape1, visSelect
 ActiveWindow.Select vsoShape2, visSelect
 ActiveWindow.Select vsoShape3, visSelect

 Application.ActiveWindow.Selection.Distribute visDistVertRight, True

End Sub


Selection.DrawRegion Method (Visio)

 Copy code hover
[image]

Selection.DrawRegion Method (Visio)
Send feedback

Published: July 16, 2012

Draws a new shape that represents the region containing a given point.

Version Information

Version Added: Visio 2000

Syntax

expression .DrawRegion(Tolerance, Flags, x, y, ResultsMaster)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Tolerance | Required | Double | Error tolerance when determining the coincidence of points. A distance expressed in internal units in the coordinate space of the Selection object's containing shape; the maximum gap between paths that is tolerated when constructing the boundaries of a region.
Flags | Required | Integer | A constant or integer that specifies how to draw the region.
x | Optional | Variant | x-coordinate in internal units in the coordinate space of the Selection object.
y | Optional | Variant | y-coordinate in internal units in the coordinate space of the Selection object.
ResultsMaster | Optional | Variant | The Master object which the new Shape object should be an instance of.

Return Value

Shape

Remarks

The DrawRegion method creates a new Shape object from pieces of the paths in the Selection object.

  • If both x and y are specified, the resulting shape is the smallest region that contains the point (x,y).

  • In the absence of either x or y, or if the point (x,y) is not contained in any region enclosed by the paths of the selected shapes, the result is the union of all the shapes that would have been created by using the Fragment operation.

  • If no closed region is defined by the selected shapes, the DrawRegion method returns Nothing and raises no exception.

The Flags argument can be one or a combination of the following constants declared by the Visio type library in VisDrawRegionFlags .

Name | Value | Description
visDrawRegionDeleteInput | &H4 | Delete items in selection.
visDrawRegionIgnoreVisible | &H20 | Exclude visible geometry.
visDrawRegionIncludeDataGraphics | &H40 | Include data graphic callout shapes and their sub-shapes.
visDrawRegionIncludeHidden | &H10 | Include hidden geometry.

If the DrawRegion method is passed a ResultsMaster of type VT_EMPTY or VT_ERROR (which is how VBA passes an unspecified optional argument), the new shape is not an instance of a master and the fill, line, and text styles of the new region are set to the document's default styles.

If the DrawRegion method is passed a reference to a Master object in ResultsMaster (type VT_UNKNOWN or VT_DISPATCH), the DrawRegion method instances that Master object and adds geometry computed given the Selection object.

The new Shape object has no text other than text already in ResultsMaster.


Selection.Duplicate Method (Visio)

 Copy code hover
[image]

Selection.Duplicate Method (Visio)
Send feedback

Published: July 16, 2012

Duplicates a selection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Duplicate

expression A variable that represents a Selection object.

Return Value

Selection

Remarks

The Duplicate method duplicates the specified object or selection and adds a copy to the same page as the original. Using the Duplicate method is equivalent to clicking Duplicate on the Paste menu on the Home tab.

When used with a Shape object, the Duplicate method duplicates the shape.

When used with a Selection object, the Duplicate method duplicates the selection.

Example

The following example shows how to duplicate Shape objects. The code also works for Selection objects.

Before running this macro, make sure a drawing page is active in the Microsoft Visio window.

VBA Copy code Copy code

Public Sub Duplicate_Example()

 Dim vsoOriginalShape As Visio.Shape
 Dim vsoDuplicateShape As Visio.Shape

 Set vsoOriginalShape = ActivePage.DrawLine(1, 1, 5, 5)

 Set vsoDuplicateShape = vsoOriginalShape.Duplicate
 vsoDuplicateShape.Cells("BeginY") = "2"

End Sub


Selection.Export Method (Visio)

 Copy code hover
[image]

Selection.Export Method (Visio)
Send feedback

Published: July 16, 2012

Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.

Version Information

Version Added: Visio 3.0

Syntax

expression .Export(FileName)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The fully qualified path and name of the file to receive the exported object.

Return Value

Nothing

Remarks

The file name extension indicates which export filter to use. If the filter is not installed, the Export method returns a compiler error in your Visual Basic or VBA project. The Export method uses the default preference settings for the specified filter and does not prompt the user for non-default arguments.

The Export method of a Page object supports saving to HTML file format using the extension .htm or .html. When pages are exported, Visio uses the settings that were last selected in the Save As dialog box.

If the specified file already exists, Visio replaces it without prompting the user.

Starting with Microsoft Visio 2010, you can use various properties and methods of the ApplicationSettings object that relate to raster images to configure settings for export to .bmp, .gif, .jpg, .png, and .tif file types.

Example

This example shows how to export a Visio page as a bitmap (.bmp) file. It assumes a drawing page is open and active in Microsoft Visio.

VBA Copy code Copy code
Public Sub Export_Example()
 Dim vsoPage As Visio.Page
 Set vsoPage = ActivePage
 vsoPage.Export ("C:\\myExportedPage.bmp")
End Sub


Selection.FitCurve Method (Visio)

 Copy code hover
[image]

Selection.FitCurve Method (Visio)
Send feedback

Published: July 16, 2012

Reduces the number of geometry segments in a shape or shapes by replacing them with similar spline, arc, and line segments that approximate the paths of the initial segments. Typically, this reduces the number of segments in the shape.

Version Information

Version Added: Visio 4.1

Syntax

expression .FitCurve(Tolerance, Flags)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Tolerance | Required | Double | How closely the resulting paths must match the shape's original paths.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Nothing

Remarks

The FitCurve method of a Selection object optimizes each of the shapes in the selection. It does not combine the selected shapes into a single shape.

The paths resulting from the FitCurve method fall within the given tolerance of the initial paths. Tolerance should be in internal drawing units (inches). To match the initial paths exactly, specify a tolerance of zero (0).

The Flags argument is a bitmask that specifies options for optimizing the paths. Its value should either be zero or a combination of one or more of the following values.

Constant | Value | Description
visSplinePeriodic | &H1 | Produce periodic splines if appropriate.
visSplineDoCircles | &H2 | Recognize circular segments in the shape(s) and generate circular arcs instead of spline rows for those segments.
visSplineAbrupt | &H4 | Break the resulting splines whenever an abrupt change of direction or curvature in a path is detected.


Selection.Flip Method (Visio)

 Copy code hover
[image]

Selection.Flip Method (Visio)
Send feedback

Published: July 16, 2012

Flips selected shapes either as a group or individually about their pins. Returns Nothing.

Version Information

Version Added: Visio 2003

Syntax

expression .Flip(FlipDirection, FlipType, BlastGuards, PinX, PinY, PinUnitsNameOrCode)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
FlipDirection | Required | VisFlipDirection | Specifies the direction in which to flip the selection. See Remarks for possible values.
FlipType | Optional | VisFlipTypes | Specifes how selection is to be flipped. See Remarks for possible values.
BlastGuards | Optional | Boolean | True to override formulas in the ShapeSheet of any of the selected shapes to which the GUARD function has been applied; False to leave guarded formulas unchanged. The default is False.
PinX | Optional | Double | When FlipType is visFlipSelectionWithPin , specifies the X-position of the pin about which the selection is to be flipped.
PinY | Optional | Double | When FlipType is visFlipSelectionWithPin , specifies the Y-position of the pin about which the selection is to be flipped.
PinUnitsNameOrCode | Optional | Variant | Specifies the units to use for PinX and PinY. See Remarks for possible values. The default is inches.

Return Value

Nothing

Remarks

The following possible values for FlipDirection are declared in VisFlipDirection in the Visio type library.

Constant | Value | Description
visFlipHorizontal | 1 | Flip the selection horizontally.
visFlipVertical | 2 | Flip the selection vertically.

The following possible values for FlipType are declared in VisFlipTypes in the Visio type library.

Constant | Value | Description
visFlipSelectionWithPin | 1 | Flip the selection about a pin.
visFlipSelection | 0 | Flip the selection about its center.
visFlipShapes | 2 | Flip the selected shapes about their pins.

You can specify PinUnitsNameOrCode as an integer (a member of VisUnitCodes) or a string value such as "inches". If the string is invalid or the unit code is inappropriate (nontextual), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About units of measure.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Flip method to flip a selection horizontally.

VBA Copy code Copy code
Public Sub Flip_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape

 Set vsoShape1 = Application.ActiveWindow.Page.DrawRectangle(1, 9, 3, 7)
 Set vsoShape2 = Application.ActiveWindow.Page.DrawRectangle(3, 6, 5, 5)

 ActiveWindow.DeselectAll

 ActiveWindow.Select vsoShape1, visSelect
 ActiveWindow.Select vsoShape2, visSelect

 Application.ActiveWindow.Selection.Flip visFlipHorizontal, visFlipSelection, False

End Sub


Selection.FlipHorizontal Method (Visio)

 Copy code hover
[image]

Selection.FlipHorizontal Method (Visio)
Send feedback

Published: July 16, 2012

Flips an object horizontally.

Version Information

Version Added: Visio 2.0

Syntax

expression .FlipHorizontal

expression A variable that represents a Selection object.

Return Value

Nothing


Selection.FlipVertical Method (Visio)

 Copy code hover
[image]

Selection.FlipVertical Method (Visio)
Send feedback

Published: July 16, 2012

Flips an object vertically.

Version Information

Version Added: Visio 2.0

Syntax

expression .FlipVertical

expression A variable that represents a Selection object.

Return Value

Nothing


Selection.Fragment Method (Visio)

 Copy code hover
[image]

Selection.Fragment Method (Visio)
Send feedback

Published: July 16, 2012

Breaks selected shapes into smaller shapes.

Version Information

Version Added: Visio 2.0

Syntax

expression .Fragment

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

Calling the Fragment method is equivalent to clicking Fragment in the Microsoft Visio user interface (click Operations in the Shape Design group on the Developer tab). The produced shapes are the topmost shapes in the containing shape of the selected shapes. They inherit the formatting of the first selected shape and have no text.

The original shapes are deleted and there aren't any shapes selected when the operation is complete.


Selection.GetCallouts Method (Visio)

 Copy code hover
[image]

Selection.GetCallouts Method (Visio)
Send feedback

Published: July 16, 2012

Returns the list of identifiers of the callout shapes in the selection.

Version Information

Version Added: Visio 2010

Syntax

expression .GetCallouts(NestedOptions)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
NestedOptions | Required | VisContainerNested | Indicates whether to exclude shapes in the selection that are contained by containers or lists. See Remarks for possible values.

Return Value

Long()

Remarks

The NestedOptions parameter must be one of the following VisContainerNested constants.

Constant | Value | Description
visContainerIncludeNested | 0 | Include shapes that are in nested containers.
visContainerExcludeNested | 1 | Exclude shapes that are in nested containers.


Selection.GetContainers Method (Visio)

 Copy code hover
[image]

Selection.GetContainers Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of shape identifiers (IDs) of the container shapes in the selection.

Version Information

Version Added: Visio 2010

Syntax

expression .GetContainers(NestedOptions)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
NestedOptions | Required | VisContainerNested | Indicates whether to exclude shapes in nested containers. See Remarks for possible values.

Return Value

Long()

Remarks

The NestedOptions parameter must be one of the following VisContainerNested constants.

Constant | Value | Description
visContainerIncludeNested | 0 | Include shapes that are in nested containers.
visContainerExcludeNested | 1 | Exclude shapes that are in nested containers..

You can use the Shapes.ItemFromID property to get the actual shapes from the IDs returned by GetContainers.


Selection.GetIDs Method (Visio)

 Copy code hover
[image]

Selection.GetIDs Method (Visio)
Send feedback

Published: July 16, 2012

Gets the shape IDs of the shapes in the selection.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetIDs(ShapeIDs())

expression An expression that returns a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
ShapeIDs() | Required | Long | Out parameter. An array of shape IDs of type Long corresponding to the shapes in the selection.

Return Value

Nothing

Remarks

Microsoft Visio uses ID numbers to identify shapes, recordsets, and data rows. Shape IDs are unique only within the scope of the page they are on. After you determine these shape IDs, you can pass them to the Page.LinkShapesToDataRows method to specify exactly how the shapes in your diagram should link to data rows in the available data recordsets. Shape IDs are unique within the scope of a particular page.

To determine the shape ID for a shape that is part of a selection, use the Selection.GetIDs method.

The set of shape IDs returned is determined by the setting of the Selection.IterationMode property.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetIDs method to get the IDs of shapes in a selection and print the IDs in the Immediate window. It selects all the shapes in the active window.

VBA Copy code Copy code
Public Sub GetIDs_Example()

    Dim vsoSelection As Visio.Selection
    Dim lngShapeIDs() As Long
    Dim lngShapeID As Long

    ActiveWindow.DeselectAll
    ActiveWindow.SelectAll

    Set vsoSelection = ActiveWindow.Selection

    Call vsoSelection.GetIDs(lngShapeIDs)

    For lngShapeID = LBound(lngShapeIDs) To UBound(lngShapeIDs)
        Debug.Print lngShapeID
    Next

End Sub


Selection.Group Method (Visio)

 Copy code hover
[image]

Selection.Group Method (Visio)
Send feedback

Published: July 16, 2012

Groups the objects that are selected in a selection, or it converts a shape into a group.

Version Information

Version Added: Visio 2.0

Syntax

expression .Group

expression A variable that represents a Selection object.

Return Value

Shape

Example

The following example shows how to group Shape objects.

VBA Copy code Copy code

Public Sub Group_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoGroupShape As Visio.Shape
 Dim vsoSelection As Visio.Selection

 'Draw two rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 2, 2, 1)
 Set vsoShape2 = ActivePage.DrawRectangle(1, 4, 2, 3)

 'Deselect all shapes, and then select the two rectangles.
 Set vsoSelection = ActiveWindow.Selection
 vsoSelection.Select vsoShape1, visDeselectAll + visSelect
 vsoSelection.Select vsoShape2, visSelect

 'Group the rectangles into a group shape.
 Set vsoGroupShape = vsoSelection.Group

End Sub


Selection.Intersect Method (Visio)

 Copy code hover
[image]

Selection.Intersect Method (Visio)
Send feedback

Published: July 16, 2012

Creates one closed shape from the area in which selected shapes overlap or intersect.

Version Information

Version Added: Visio 4.0

Syntax

expression .Intersect

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

Calling the Intersect method is equivalent to clicking Intersect in the Microsoft Visio user interface (click Operations in the Shape Design group on the Developer tab). The produced shape will be the topmost shape in its containing shape and will inherit the text and formatting of the first selected shape.

The original shapes are deleted and no shapes are selected when the operation is complete.


Selection.Join Method (Visio)

 Copy code hover
[image]

Selection.Join Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape by joining selected shapes.

Version Information

Version Added: Visio 4.1

Syntax

expression .Join

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

Calling the Join method is equivalent to clicking Join in the Microsoft Visio user interface (click Operations in the Shape Design group on the Developer tab). The new shape inherits the text and formatting of the first selected shape and is the topmost shape in its container—the nth shape in the Shapes collection of its containing shape, where n = Count.

The original shapes are deleted and no shapes are selected when the operation is complete.

The Join method and the Combine method are similar but differ in the following ways:

  • Join coalesces abutting line and curve segments in the original shapes into a single Geometry section in the resulting shape.

  • Combine produces a shape that has one Geometry section for each original shape. The resulting shape has holes in regions where the original shapes overlapped.

You might want to join shapes after importing a non-Visio drawing in which apparent polylines are represented by many independent shapes, each possessing a single line or curve segment. By joining the shapes that constitute a polyline in such a drawing, you can replace many single-segment shapes with one multiple-segment shape.


Selection.Layout Method (Visio)

 Copy code hover
[image]

Selection.Layout Method (Visio)
Send feedback

Published: July 16, 2012

Lays out the shapes and/or reroutes the connectors for the page, master, group, or selection.

Version Information

Version Added: Visio 4.5

Syntax

expression .Layout

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

Using the Layout method is equivalent to clicking Re-Layout Page in the Layout group on the Design tab and then clicking More Layout Options and configuring options in the Configure Layout dialog box.

Behavior of the Layout method can be influenced by setting the formulas or results of cells in the Page Layout and Shape Layout ShapeSheet sections of the page, master, or group to be laid out. You can infer how these cells influence the behavior of the Layout method by examining the effect of various Configure Layout dialog box options on the values of these cells.

To lay out a subset of the shapes of a page, master, or group, establish a Selection object in which the shapes to be laid out are selected, and then call the Layout method. If the Layout method is performed on a Selection object and the object has no shapes selected, all shapes in the page, master, or group of the selection are laid out.


Selection.LayoutChangeDirection Method (Visio)

 Copy code hover
[image]

Selection.LayoutChangeDirection Method (Visio)
Send feedback

Published: July 16, 2012

Revises the layout of a selection of connected shapes by rotating or flipping the connected shapes as a unit, without rotating or flipping the individual shapes.

Version Information

Version Added: Visio 2010

Syntax

expression .LayoutChangeDirection(Direction)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | VisLayoutDirection | The layout action to take. See Remarks for possible values.

Return Value

Nothing

Remarks

The Direction parameter must be one of the following VisLayoutDirection constants.

Constant | Value | Description
visLayoutDirRotateRight | 0 | Rotates the selection 90 degrees clockwise.
visLayoutDirRotateLeft | 1 | Rotates the selection 90 degrees counterclockwise.
visLayoutDirFlipVert | 2 | Flips the selection vertically.
visLayoutDirFlipHorz | 3 | Flips the selection horizontally.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the LayoutChangeDirection method to flip a selection of connected shapes vertically, without flipping the individual shapes.

VBA Copy code Copy code
Public Sub SelectionLayoutChangeDirection_Example()
    Dim vsoSelection As Visio.Selection
    Set vsoSelection = ActiveWindow.Selection

    vsoSelection.LayoutChangeDirection (visLayoutDirFlipVert)

End Sub


Selection.LayoutIncremental Method (Visio)

 Copy code hover
[image]

Selection.LayoutIncremental Method (Visio)
Send feedback

Published: July 16, 2012

Makes small adjustments to the position of shapes in the selection to better align the shapes or to space them evenly from other shapes.

Version Information

Version Added: Visio 2010

Syntax

expression .LayoutIncremental(AlignOrSpace, AlignHorizontal, AlignVertical, SpaceHorizontal, SpaceVertical, UnitCode)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
AlignOrSpace | Required | VisLayoutIncrementalType | The type of incremental layout action to perform (alignment, spacing, or both). See Remarks for possible values.
AlignHorizontal | Required | VisLayoutHorzAlignType | Indicates how Microsoft Visio aligns shapes horizontally when it aligns incrementally. See Remarks for possible values.
AlignVertical | Required | VisLayoutVertAlignType | Indicates how Visio aligns shapes vertically when it aligns incrementally (except if layout style is circular). See Remarks for possible values.
SpaceHorizontal | Required | Double | The edge-to-edge horizontal spacing. Must be greater than or equal to zero.
SpaceVertical | Required | Double | The edge-to-edge vertical spacing (except if layout style is circular). Must be greater than or equal to zero.
UnitCode | Required | VisUnitCodes | The units for the spacing values.

Return Value

Nothing

Remarks

The AlignOrSpace parameter must be one or the combination of both (3) of the following VisLayoutIncrementalType constants.

Constant | Value | Description
visLayoutIncrAlign | 1 | Align shapes.
visLayoutIncrSpace | 2 | Space shapes evenly.

The AlignHorizontal parameter must be one of the following VisLayoutHorzAlignType constants.

Constant | Value | Description
visLayoutHorzAlignNone | 0 | Do not align horizontally.
visLayoutHorzAlignDefault | 1 | Visio chooses how to align horizontally.
visLayoutHorzAlignLeft | 2 | Align the left edges of the shapes.
visLayoutHorzAlignCenter | 3 | Align the centers of the shapes.
visLayoutHorzAlignRight | 4 | Align the right edges of the shapes.

The AlignVertical parameter must be one of the following VisLayoutVertAlignType constants.

Constant | Value | Description
visLayoutVertAlignNone | 0 | Do not align vertically.
visLayoutVertAlignDefault | 1 | Visio chooses how to align vertically.
visLayoutVertAlignTop | 2 | Align the top edges of the shapes.
visLayoutVertAlignMiddle | 3 | Align the middles of the shapes.
visLayoutVertAlignBottom | 4 | Align the bottom edges of the shapes.

If AlignOrSpace is visLayoutIncrAlign, either AlignHorizontal must be a value other than visLayoutHorzAlignNone, or AlignVertical must be a value other than visLayoutVertAlignNone.

If AlignOrSpace is visLayoutIncrSpace, both AlignHorizontal and AlignVertical must be greater than zero.

If AlignOrSpace is a combination of visLayoutIncrAlign and visLayoutIncrSpace, both of these conditions must be true.

If the page layout style is circular, Visio uses only the AlignHorizontal value to determine whether to align, and only the SpaceHorizontal parameter value to determine whether to space, ignoring the AlignVertical and SpaceVertical parameter values, respectively. In this case, if you pass a value other than visLayoutHorzAlignNone for AlignHorizontal, Visio performs the alignment. Similarly, if you pass any value greater than zero for SpaceHorizontal, Visio performs the spacing.


Selection.LinkToData Method (Visio)

 Copy code hover
[image]

Selection.LinkToData Method (Visio)
Send feedback

Published: July 16, 2012

Links a selection of shapes to a single data row in a data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .LinkToData(DataRecordsetID, DataRowID, AutoApplyDataGraphics)

expression An expression that returns a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of the data recordset containing the data to link to.
DataRowID | Required | Long | The ID of the row in the data recordset containing the particular data record to link to.
AutoApplyDataGraphics | Optional | Boolean | Whether to automatically apply a data graphic to the linked shapes. See Remarks for more information.

Return Value

Nothing

Remarks

The Selection.LinkToData method functions much like the same method of the Shape object, Shape.LinkToData, except that it links a selection of shapes, instead of a single shape, to a single data row.

If Visio cannot establish a link between a shape and the data row, Visio skips that shape and goes on to the next shape in the selection. After you run the method, to determine if all shapes in the selection are actually linked to the data row, call the Shape.GetLinkedDataRow method on each shape in the selection. If that method fails for any shape, it indicates that the shape is not linked to the data row. Visio will usually succeed in linking a row to a shape unless the shape is already linked to data and the link-replacement-behavior setting for the data recordset specifies that the link should not be replaced.

If you pass True for the AutoApplyDataGraphics parameter, Visio re-applies the existing data graphic to shapes that already had data graphics applied before you called the method. For shapes that previously had no data graphic, Visio applies the data graphic most recently applied to any other shape in the current document.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the LinkToData method to link the shapes in a selection to a data row.

Before running this macro, place several shapes on the page and add at least one data recordset to the DataRecordsets collection of the document. The macro uses the ID of the data recordset most recently added to the collection. It links selected shapes to the data in the first row of the data recordset.

VBA Copy code Copy code
Public Sub LinkToData_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim vsoSelection As Visio.Selection
    Dim intCount As Integer

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount)

    ActiveWindow.DeselectAll
    ActiveWindow.SelectAll

    Set vsoSelection = ActiveWindow.Selection
    vsoSelection.LinkToData vsoDataRecordset.ID, 1, True

End Sub


Selection.MemberOfContainersIntersection Method (Visio)

 Copy code hover
[image]

Selection.MemberOfContainersIntersection Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of identifiers of the shapes that belong to the normal or list containers that contain all the shapes in the selection.

Version Information

Version Added: Visio 2010

Syntax

expression .MemberOfContainersIntersection

expression An expression that returns a Selection object.

Return Value

Long()


Selection.MemberOfContainersUnion Method (Visio)

 Copy code hover
[image]

Selection.MemberOfContainersUnion Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of identifiers of the shapes that belong to the normal or list containers that contain at least one of the shapes in the selection.

Version Information

Version Added: Visio 2010

Syntax

expression .MemberOfContainersUnion

expression An expression that returns a Selection object.

Return Value

Long()


Selection.Move Method (Visio)

 Copy code hover
[image]

Selection.Move Method (Visio)
Send feedback

Published: July 16, 2012

Moves a selection a specified distance.

Version Information

Version Added: Visio 2003

Syntax

expression .Move(dx, dy, UnitsNameOrCode)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
dx | Required | Double | Specifies the amount to move in the x-direction.
dy | Required | Double | Specifies the amount to move in the y-direction.
UnitsNameOrCode | Optional | Variant | Specifies the units to use for dx and dy. See Remarks for possible values. The default is inches.

Return Value

Nothing

Remarks

You can specify UnitsNameOrCode as an integer (a member of VisUnitCodes) or a string value such as "inches". If the string is invalid or the unit code is inappropriate (nontextual), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About units of measure.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Move method to move a selection by a specified amount.

VBA Copy code Copy code
Public Sub Move_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape

 Set vsoShape1 = Application.ActiveWindow.Page.DrawRectangle(1, 9, 3, 7)
 Set vsoShape2 = Application.ActiveWindow.Page.DrawRectangle(3, 6, 5, 5)

 ActiveWindow.DeselectAll

 ActiveWindow.Select vsoShape1, visSelect
 ActiveWindow.Select vsoShape2, visSelect
 Application.ActiveWindow.Selection.Move 2, 2

End Sub


Selection.MoveToSubprocess Method (Visio)

 Copy code hover
[image]

Selection.MoveToSubprocess Method (Visio)
Send feedback

Published: July 16, 2012

Moves the selection to the specified page, and drops a replacement shape on the source page and links it to the target page. Returns the selection of moved shapes on the target page.

Version Information

Version Added: Visio 2010

Syntax

expression .MoveToSubprocess(Page, ObjectToDrop, NewShape)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | Page | The subprocess page to which the selection should be moved. You cannot pass the current page.
ObjectToDrop | Required | [UNKNOWN] | The replacement shape to drop.
NewShape | Optional | Shape | Out parameter. Returns the shape that is linked to the new page.

Return Value

Selection

Remarks

The ObjectToDrop parameter is typically a Microsoft Visio object, such as a Master or MasterShortcut object. However, it can be any OLE object that provides an IDataObject interface. If ObjectToDrop is null, Visio drops a default shape.


Selection.Offset Method (Visio)

 Copy code hover
[image]

Selection.Offset Method (Visio)
Send feedback

Published: July 16, 2012

Offsets a selection a specified amount.

Version Information

Version Added: Visio 2003

Syntax

expression .Offset(Distance)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Distance | Required | Double | Specifies the distance to offset the selection.

Return Value

Nothing

Remarks

Calling the Offset method is equivalent to clicking Offset in the Microsoft Visio user interface (click Operations in the Shape Design group on the Developer tab).

For a specified line or curve, the offset is implemented as a pair of lines or curves that are equidistant from the original line or curve. Offset shapes inherit line patterns from the original shapes. They do not inherit any fill patterns or text from the original shapes.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Offset method to offset a line shape by a specified amount.

VBA Copy code Copy code
Public Sub Offset_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = Application.ActiveWindow.Page.DrawLine(3, 3, 6, 6)

 ActiveWindow.DeselectAll
 ActiveWindow.Select vsoShape, visSelect
 vsoShape.Offset(2)

End Sub


Selection.RemoveFromContainers Method (Visio)

 Copy code hover
[image]

Selection.RemoveFromContainers Method (Visio)
Send feedback

Published: July 16, 2012

Removes the selection of shapes from all lists and containers of which the selection is a member.

Version Information

Version Added: Visio 2010

Syntax

expression .RemoveFromContainers

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

When you call the RemoveFromContainers method, Microsoft Visio uses the setting of the ContainerProperties.ResizeAsNeeded property for each container to determine how the container resizes.


Selection.RemoveFromGroup Method (Visio)

 Copy code hover
[image]

Selection.RemoveFromGroup Method (Visio)
Send feedback

Published: July 16, 2012

Removes selected shapes from a group.

Version Information

Version Added: Visio 2.0

Syntax

expression .RemoveFromGroup

expression A variable that represents a Selection object.

Return Value

Nothing


Selection.ReplaceShape Method (Visio)

 Copy code hover
[image]

Selection.ReplaceShape Method (Visio)
See also Send feedback

Published: July 16, 2012

Replaces the specified selection with one or more instances of the master passed as the first parameter, and returns an array containing the new shape or shapes.

Syntax

expression .ReplaceShape(MasterOrMasterShortcutToDrop,ReplaceFlags)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data type | Description
MasterOrMasterShortcutToDrop | Required | UNKNOWN | Specifies the replacement shape or shapes to drop. Must be either a Master or MasterShortcut object.
ReplaceFlags | Optional | INT32 | Specifies the properties of the original shape or shapes to retain in the new shape or shapes. Possible values include any of the VisReplaceFlags constants, and certain combinations of those constants. See Remarks for more information.

Return value

SAFE-ARRAY

Remarks

Allowable values to pass for the ReplaceFlags parameter include either visReplaceShapeDefault or any combination of one or more of the remaining four flags.

See also

Concepts

Selection Object

Other resources

Selection Members


Selection.Resize Method (Visio)

 Copy code hover
[image]

Selection.Resize Method (Visio)
Send feedback

Published: July 16, 2012

Resizes the selection by moving shape handles as specified.

Version Information

Version Added: Visio 2010

Syntax

expression .Resize(Direction, Distance, UnitCode)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | VisResizeDirection | The direction that corresponds to the shape handle. See Remarks for possible values.
Distance | Required | Double | The distance to move the selection edge or corner, where positive values move outward, and negative values move inward.
UnitCode | Required | VisUnitCodes | The unit of measure for the resize distance.

Return Value

Nothing

Remarks

The Direction parameter must be one of the following VisResizeDirection constants.

Constant | Value | Description
visResizeDirE | 0 | Right, middle shape handle.
visResizeDirNE | 1 | Right, top shape handle.
visResizeDirN | 2 | Center, top shape handle.
visResizeDirNW | 3 | Left, top shape handle.
visResizeDirW | 4 | Left, middle shape handle.
visResizeDirSW | 5 | Left, bottom shape handle.
visResizeDirS | 6 | Center, bottom shape handle.
visResizeDirSE | 7 | Right, bottom shape handle.

When you resize a selection in a diagonal direction (that is, NE, NW, SE, or SW), the specified distance is applied along both the horizontal and vertical axes (as opposed to along the compass direction).


Selection.ReverseEnds Method (Visio)

 Copy code hover
[image]

Selection.ReverseEnds Method (Visio)
Send feedback

Published: July 16, 2012

Reverses an object by flipping it both horizontally and vertically.

Version Information

Version Added: Visio 2.0

Syntax

expression .ReverseEnds

expression A variable that represents a Selection object.

Return Value

Nothing


Selection.Rotate Method (Visio)

 Copy code hover
[image]

Selection.Rotate Method (Visio)
Send feedback

Published: July 16, 2012

Rotates selected shapes either as a group or individually about their pins.

Version Information

Version Added: Visio 2003

Syntax

expression .Rotate(Angle, AngleUnitsNameOrCode, BlastGuards, RotationType, PinX, PinY, PinUnitsNameOrCode)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Angle | Required | Double | Specifies the angle to rotate the selection. See Remarks for possible values.
AngleUnitsNameOrCode | Optional | Variant | Specifies the units to use for Angle. See Remarks for possible values. The default is degrees.
BlastGuards | Optional | Boolean | True to override formulas in the ShapeSheet of any of the selected shapes to which the GUARD function has been applied; False to leave guarded formulas unchanged. The default is False.
RotationType | Optional | VisRotationTypes | Specifes how the selection is to be rotated. See Remarks for possible values.
PinX | Optional | Double | When RotationType is visRotateSelectionWithPin, specifies the X-position of the pin about which the selection is to be rotated.
PinY | Optional | Double | When RotationType is visRotateSelectionWithPin, specifies the Y-position of the pin about which the selection is to be rotated.
PinUnitsNameOrCode | Optional | Variant | Specifies the units to use for PinX and PinY. See Remarks for possible values. The default is inches.

Return Value

Nothing

Remarks

The following possible values for RotationType are declared in VisRotationTypes in the Visio type library.

Constant | Value | Description
visRotateSelectionWithPin | 1 | Rotates the selection around a pin.
visRotateSelection | 0 | Rotates the selection relative to the center of the selection.
visRotateShapes | 2 | Rotates the selected shapes around their pins relative to their current angle.

Passing True for the optional BlastGuards argument overrides formulas in the ShapeSheet of any of the selected shapes to which the GUARD function has been applied.

The default value for RotationType is visRotateSelection .

You can specify AngleUnitsNameOrCode or PinUnitsNameOrCode as an integer (a member of VisUnitCodes) or a string value such as "radians" or "inches". If the string is invalid or the unit code is inappropriate (nontextual), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About units of measure.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Rotate method to rotate a selection 45 degrees relative to the center of the selection.

VBA Copy code Copy code
Public Sub Rotate_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape

 Set vsoShape1 = Application.ActiveWindow.Page.DrawRectangle(1, 9, 3, 7)
 Set vsoShape2 = Application.ActiveWindow.Page.DrawRectangle(3, 6, 5, 5)

 ActiveWindow.DeselectAll

 ActiveWindow.Select vsoShape1, visSelect
 ActiveWindow.Select vsoShape2, visSelect

 Application.ActiveWindow.Selection.Rotate 45, visDegrees

End Sub


Selection.Rotate90 Method (Visio)

 Copy code hover
[image]

Selection.Rotate90 Method (Visio)
Send feedback

Published: July 16, 2012

Rotates an object 90 degrees counterclockwise.

Version Information

Version Added: Visio 2.0

Syntax

expression .Rotate90

expression A variable that represents a Selection object.

Return Value

Nothing


Selection.Select Method (Visio)

 Copy code hover
[image]

Selection.Select Method (Visio)
Send feedback

Published: July 16, 2012

Selects or clears the selection of an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Select(SheetObject, SelectAction)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
SheetObject | Required | [IVSHAPE] | An expression that returns a Shape object to select or clear.
SelectAction | Required | Integer | The type of selection action to take.

Return Value

Nothing

Remarks

When used with the Window object, the Select method will affect the selection in the Microsoft Visio window. The Selection object, however, is independent of the selection in the window. Therefore, using the Select method with a Selection object only affects the state of the object in memory; the Visio window is unaffected.

The following constants declared by the Visio type library in VisSelectArgs show valid values for selection types.

Constant | Value | Description
visDeselect | 1 | Cancels the selection of a shape but leaves the rest of the selection unchanged.
visSelect | 2 | Selects a shape but leaves the rest of the selection unchanged.
visSubSelect | 3 | Selects a shape whose parent is already selected.
visSelectAll | 4 | Selects a shape and all its peers.
visDeselectAll | 256 | Cancels the selection of a shape and all its peers.

If SelectAction is visSubSelect, the parent shape of SheetObject must already be selected.

You can combine visDeselectAll with visSelect and visSubSelect to cancel the selection of all shapes prior to selecting or subselecting other shapes.

If the object being operated on is a Selection object, and if the Select method selects a Shape object whose ContainingShape property is different from the ContainingShape property of the Selection object, the Select method clears everything, even if the selection type value does not specify canceling the selection.

If the object being operated on is a Window object, and if SelectAction is not visSubSelect, the parent shape of SheetObject must be the same shape as that returned by the ContainingShape property of the Window.Selection object.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to select, clear, and subselect shapes.

VBA Copy code Copy code

Public Sub Select_Example()

 Const MAX_SHAPES = 6
 Dim vsoShapes(1 To MAX_SHAPES) As Visio.Shape
 Dim intCounter As Integer

 'Draw six rectangles.
 For intCounter = 1 To MAX_SHAPES
 Set vsoShapes(intCounter) = ActivePage.DrawRectangle(intCounter, intCounter + 1, intCounter + 1, intCounter)
 Next intCounter

 'Cancel the selection of all the shapes on the page.
 ActiveWindow.DeselectAll

 'Create a Selection object.
 Dim vsoSelection As Visio.Selection
 Set vsoSelection = ActiveWindow.Selection

 'Select the first three shapes on the page.
 For intCounter = 1 To 3
 vsoSelection.Select vsoShapes(intCounter), visSelect
 Next intCounter

 'Group the selected shapes.
 'Although the first three shapes are now grouped, the
 'array vsoShapes() still contains them.
 Dim vsoGroup As Visio.Shape
 Set vsoGroup = vsoSelection.Group

 'There are now four shapes on the page—a group that contains three
 'subshapes, and three ungrouped shapes. Subselection is
 'accomplished by selecting the parent shape first or one of the
 'group's shapes already subselected.

 'Select parent (group) shape.
 ActiveWindow.Select vsoGroup, visDeselectAll + visSelect

 'Subselect two of the shapes in the group.
 ActiveWindow.Select vsoShapes(1), visSubSelect
 ActiveWindow.Select vsoShapes(3), visSubSelect

 'At this point two shapes are subselected, but we want to
 'start a new selection that includes the last two shapes
 'added to the page and the group.

 'Note that the subselections that were made in the group
 'are canceled by selecting another shape that is
 'at the same level as the parent of the subselected shapes.

 'Select just one shape.
 ActiveWindow.Select vsoShapes(MAX_SHAPES), _
 visDeselectAll + visSelect

 'Select another shape.
 ActiveWindow.Select vsoShapes(MAX_SHAPES - 1), visSelect

 'Select the group.
 ActiveWindow.Select vsoGroup, visSelect

 'Select all but one shape on the page.
 ActiveWindow.SelectAll
 ActiveWindow.Select vsoShapes(MAX_SHAPES - 1), visDeselect

End Sub


Selection.SelectAll Method (Visio)

 Copy code hover
[image]

Selection.SelectAll Method (Visio)
Send feedback

Published: July 16, 2012

Selects all possible shapes in a window or selection.

Version Information

Version Added: Visio 2.0

Syntax

expression .SelectAll

expression A variable that represents a Selection object.

Return Value

Nothing

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to select all the shapes on the page.

VBA Copy code Copy code

Public Sub SelectAll_Example()

 Const MAX_SHAPES = 6
 Dim vsoShapes(1 To MAX_SHAPES) As Visio.Shape
 Dim intCounter As Integer

 'Draw six rectangles.
 For intCounter = 1 To MAX_SHAPES
 Set vsoShapes(intCounter) = ActivePage.DrawRectangle(intCounter, intCounter + 1, intCounter + 1, intCounter)
 Next intCounter

 'Deselect all the shapes on the page.
 ActiveWindow.DeselectAll

 'Select all the shapes on the page.
 ActiveWindow.SelectAll

End Sub


Selection.SendBackward Method (Visio)

 Copy code hover
[image]

Selection.SendBackward Method (Visio)
Send feedback

Published: July 16, 2012

Moves a shape or selected shapes back one position in the z-order.

Version Information

Version Added: Visio 2.0

Syntax

expression .SendBackward

expression A variable that represents a Selection object.

Return Value

Nothing

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to move a shape back one position in the z-order on a page.

VBA Copy code Copy code

Public Sub SendBackward_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape

 'Draw three rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 1, 5, 5)
 vsoShape1.Text = "1"
 Set vsoShape2 = ActivePage.DrawRectangle(2, 2, 6, 6)
 vsoShape2.Text = "2"
 Set vsoShape3 = ActivePage.DrawRectangle(3, 3, 7, 7)
 vsoShape3.Text = "3"

 'Move vsoShape2 back one position in the z-order.
 vsoShape2.SendBackward

End Sub


Selection.SendToBack Method (Visio)

 Copy code hover
[image]

Selection.SendToBack Method (Visio)
Send feedback

Published: July 16, 2012

Moves the shape or selected shapes to the back of the z-order.

Version Information

Version Added: Visio 2.0

Syntax

expression .SendToBack

expression A variable that represents a Selection object.

Return Value

Nothing

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to move a shape to the back of the z-order on a page.

VBA Copy code Copy code

Public Sub SendToBack_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape

 'Draw three rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 1, 5, 5)
 vsoShape1.Text = "1"
 Set vsoShape2 = ActivePage.DrawRectangle(2, 2, 6, 6)
 vsoShape2.Text = "2"
 Set vsoShape3 = ActivePage.DrawRectangle(3, 3, 7, 7)
 vsoShape3.Text = "3"

 'Move vsoShape3 to the back of the z-order.
 vsoShape3.SendToBack

End Sub


Selection.SetContainerFormat Method (Visio)

 Copy code hover
[image]

Selection.SetContainerFormat Method (Visio)
Send feedback

Published: July 16, 2012

Changes the formatting of one aspect of all the containers in the selection, and returns an array of identifiers of shapes that belong to the containers and whose formatting was changed.

Version Information

Version Added: Visio 2010

Syntax

expression .SetContainerFormat(FormatType, [FormatValue])

expression An expression that returns a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
FormatType | Required | VisContainerFormatType | The container formatting to change. See Remarks for possible values.
FormatValue | Optional | Variant | The new format to apply.

Return Value

Long()

Remarks

The FormatType parameter must be one of the following VisContainerFormatType constants.

Constant | Value | Description
visContainerFormatLockMembership | 0 | Apply one of the LockMembership property values, as specified in FormatValue. FormatValue is required, and must be of type Boolean (preferred) or or another type that can be converted to Boolean.
visContainerFormatContainerAutoResize | 1 | Apply one of the ResizeAsNeeded property values, as specified in FormatValue. Applies to normal containers only. FormatValue is required, must be of type Short (preferred) or of another type that can be converted to Short, and must be equal to a constant in the range of those in the VisContainerAutoResize enumeration.
visContainerFormatFitToContents | 2 | Fit contents to the container. FormatValue is ignored.

If the selection does not include any containers, this method has no effect.

If FormatType is of an incorrect type or is out of the range of VisContainerFormatType, Microsoft Visio returns an Invalid Parameter error.


Selection.SetQuickStyle Method (Visio)

 Copy code hover
[image]

Selection.SetQuickStyle Method (Visio)
See also Send feedback

Published: July 16, 2012

Sets the quick style of the specified selection.

Syntax

expression .SetQuickStyle(lineMatrix,fillMatrix,effectsMatrix,fontMatrix,lineColor,fillColor,shadowColor,fontColor)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data type | Description
lineMatrix | Required | VISQUICKSTYLEMATRIXINDICES | Specifies the shape style index that determines the line-formatting properties (for example, dash type or weight) to retrieve from the active theme and variant.
fillMatrix | Required | VISQUICKSTYLEMATRIXINDICES | Specifies the shape style index that determines the fill-formatting properties (for example, fill type or gradient stops) to retrieve from the active theme and variant.
effectsMatrix | Required | VISQUICKSTYLEMATRIXINDICES | Specifies the shape style index that determines the effects-formatting properties (for example, shadows or bevels) to retrieve from the active theme and variant.
fontMatrix | Required | VISQUICKSTYLEMATRIXINDICES | Specifies the shape style index that determines the font-formatting properties (for example, font style) to retrieve from the active theme and variant.
lineColor | Required | VISQUICKSTYLECOLORS | Specifies the color index that determines the line color to retrieve from the active theme and variant to use in line formatting.
fillColor | Required | VISQUICKSTYLECOLORS | Specifies the color index that determines the fill color to retrieve from the active theme and variant to use in fill formatting.
shadowColor | Required | VISQUICKSTYLECOLORS | Specifies the color index that determines the shadow color to retrieve from the active theme and variant to use in shadows.
fontColor | Required | VISQUICKSTYLECOLORS | Specifies the color index that determines the font color to retrieve from the active theme and variant to use in shape text.

Return value

VOID

Remarks

Calling the SetQuickStyle method corresponds to setting a quick style in the Shape Styles gallery on the Home tab of the ribbon.

See also

Concepts

Selection Object

Other resources

Selection Members


Selection.Subtract Method (Visio)

 Copy code hover
[image]

Selection.Subtract Method (Visio)
Send feedback

Published: July 16, 2012

Subtracts the areas that overlap the selected shape.

Version Information

Version Added: Visio 4.0

Syntax

expression .Subtract

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

Calling the Subtract method is equivalent to clicking Subtract in the Microsoft Visio user interface (click Operations in the Shape Design group on the Developer tab). The first selected shape is the one that will have the other selected shapes subtracted from it. The other shapes will be deleted and no shapes are selected when the operation is complete.


Selection.SwapEnds Method (Visio)

 Copy code hover
[image]

Selection.SwapEnds Method (Visio)
Send feedback

Published: July 16, 2012

Swaps the begin and endpoints of a one-dimensional (1-D) shape.

Version Information

Version Added: Visio 2002

Syntax

expression .SwapEnds

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

The type of glue associated with the endpoints is also swapped. For example, if the begin point of a 1-D shape is glued to object A and the endpoint of the 1-D shape is not glued, after invoking the SwapEnds method, the endpoint is glued to object A and the begin point is not glued.


Selection.Trim Method (Visio)

 Copy code hover
[image]

Selection.Trim Method (Visio)
Send feedback

Published: July 16, 2012

Trims selected shapes into smaller shapes.

Version Information

Version Added: Visio 4.1

Syntax

expression .Trim

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

Calling the Trim method is equivalent to clicking Trim in the Microsoft Visio user interface (click Operations in the Shape Design group on the Developer tab).

The new shapes inherit the formatting of the first selected shape, have no text, and are the topmost shapes in their container—the nth shape, nth - 1 shape, nth - 2 shape, and so forth in the Shapes collection of their containing shape, where n = count. The original shapes are deleted and no shapes are selected when the operation is complete.

The Trim method is similar to the Fragment method but differs in the following ways:

  • Shapes produced by the Trim method coincide with the distinct paths of the selected shapes, taking overlap into account.

  • Shapes produced by the Fragment method coincide with the distinct regions of the selected shapes, also taking overlap into account.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Trim method to trim selected shapes into smaller shapes along their intersections.

VBA Copy code Copy code
Public Sub Trim_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim shapeCount As Integer

 'Draw two shapes that intersect
 Set vsoShape1 = ActivePage.DrawRectangle(1, 4, 4, 1)
 Set vsoShape2 = ActivePage.DrawOval(2, 6, 3, 2)

 'Deselect the oval and then select both of the new shapes on the page
 ActiveWindow.DeselectAll
 ActiveWindow.SelectAll

 'Create a selection object and assign the selected shapes to it
 Dim vsoSelection As Visio.Selection
 Set vsoSelection = ActiveWindow.Selection

 'Trim the selected shapes
 vsoSelection.Trim

 'Move one of the newly created shapes
 ActiveWindow.DeselectAll
 shapeCount = ActivePage.Shapes.Count

 Set vsoShape1 = ActivePage.Shapes(shapeCount - 2)
 ActiveWindow.Select vsoShape1, visSelect
 ActiveWindow.Selection.Move 2, 2

End Sub


Selection.Ungroup Method (Visio)

 Copy code hover
[image]

Selection.Ungroup Method (Visio)
Send feedback

Published: July 16, 2012

Ungroups a group.

Version Information

Version Added: Visio 2.0

Syntax

expression .Ungroup

expression A variable that represents a Selection object.

Return Value

Nothing

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Ungroup method.

VBA Copy code Copy code

Sub Ungroup_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape
 Dim vsoGroup As Visio.Shape
 Dim vsoSelection As Visio.Selection

 'Draw two rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 2, 2, 1)
 Set vsoShape2 = ActivePage.DrawRectangle(1, 4, 2, 3)

 'Add a copy of one of the rectangles to the page.
 ActivePage.Drop vsoShape1, 3.5, 3.5
 Set vsoShape3 = ActivePage.Shapes(3)

 'Deselect all shapes, and then select all the shapes on the page.
 Set vsoSelection = ActiveWindow.Selection
 vsoSelection.Select vsoShape1, visDeselectAll + visSelect
 vsoSelection.Select vsoShape2, visSelect
 vsoSelection.Select vsoShape3, visSelect

 'Group all the shapes into a group shape.
 Set vsoGroup = vsoSelection.Group

 'Ungroup the shapes.
 vsoGroup.Ungroup

End Sub


Selection.Union Method (Visio)

 Copy code hover
[image]

Selection.Union Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape from the perimeter of selected shapes.

Version Information

Version Added: Visio 2.0

Syntax

expression .Union

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

Calling the Union method is equivalent to clicking Union in the Microsoft Visio user interface (click Operations in the Shape Design group on the Developer tab). The produced shape will be the topmost shape in its containing shape and will inherit the text and formatting of the first selected shape.

When the operation is complete, the original shapes are deleted and no shapes are selected.


Selection.UpdateAlignmentBox Method (Visio)

 Copy code hover
[image]

Selection.UpdateAlignmentBox Method (Visio)
Send feedback

Published: July 16, 2012

Updates the alignment box for a shape.

Version Information

Version Added: Visio 2000

Syntax

expression .UpdateAlignmentBox

expression A variable that represents a Selection object.

Return Value

Nothing

Remarks

The UpdateAlignmentBox method alters the width and height of a shape, often a group. For example, after you move a shape in a group, the shape may be outside the group's alignment box. The UpdateAlignmentBox method updates the alignment box so that it encloses all the shapes in the group.

Note Note

Many shapes are designed so that their alignment boxes don't coincide with their geometric extents. Using the UpdateAlignmentBox method on such shapes defeats the intentions of the shape designer.


ServerPublishOptions Object (Visio)

 Copy code hover
[image]

ServerPublishOptions Object (Visio)
Send feedback

Published: July 16, 2012

Represents the settings to apply when you save a Web Drawing (as a .vdw file) to use on a Microsoft SharePoint site in conjunction with Visio Services.

Version Information

Version Added: Visio 2010

Remarks

To get a ServerPublishOptions object, you can use the ServerPublishOptions property of the Document object.


ServerPublishOptions Members (Visio)

 Copy code hover
[image]

ServerPublishOptions Members (Visio)
Send feedback

Published: July 16, 2012

Represents the settings to apply when you save a Web Drawing (as a .vdw file) to use on a Microsoft SharePoint site in conjunction with Visio Services.

Methods

Name | Description
ExcludePage | Excludes the specified page from being published when the document is published as a VDW file.
GetPagesToPublish | Returns an array of pages that are set to be published to a server.
GetRecordsetsToPublish | Returns the identifiers (IDs) of the data recordsets that are set to be published to a server.
IncludePage | Includes the specified page for publication when the document is published as a VDW file.
SetPagesToPublish | Specifies the pages to publish to a server.
SetRecordsetsToPublish | Sets the data recordsets to be published to a server.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
IsPublishedPage | Returns True if the specified page is designated to be included when the document is published as a .vdw file. Read-only.
ObjectType | Returns visObjTypeServerPublishOptions, the type of this object. Read-only.
Stat | Returns status information for an object. Read-only.


ServerPublishOptions Properties (Visio)

 Copy code hover
[image]

ServerPublishOptions Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
IsPublishedPage | Returns True if the specified page is designated to be included when the document is published as a .vdw file. Read-only.
ObjectType | Returns visObjTypeServerPublishOptions, the type of this object. Read-only.
Stat | Returns status information for an object. Read-only.


ServerPublishOptions.Application Property (Visio)

 Copy code hover
[image]

ServerPublishOptions.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2010

Syntax

expression .Application

expression A variable that represents a ServerPublishOptions object.

Return Value

Application


ServerPublishOptions.Document Property (Visio)

 Copy code hover
[image]

ServerPublishOptions.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2010

Syntax

expression .Document

expression A variable that represents a ServerPublishOptions object.

Return Value

Document


ServerPublishOptions.IsPublishedPage Property (Visio)

 Copy code hover
[image]

ServerPublishOptions.IsPublishedPage Property (Visio)
Send feedback

Published: July 16, 2012

Returns True if the specified page is designated to be included when the document is published as a .vdw file. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .IsPublishedPage(PageNameFlags)

expression A variable that represents a ServerPublishOptions object.

Parameters

Name | Required/Optional | Data Type | Description
PageName | Required | String | The page to check for publish status.
Flags | Required | VisLangFlags | Specifies whether the page name is a local or a universal name.

Return Value

Boolean

Remarks

The setting of the IsPublishedPage property corresponds to the status (selected or cleared) of the box that represents the specified page in the Pages list in the Publish Settings dialog box. (Click the File tab, click Save & Send, click Save to SharePoint, click Web Drawing (*.vdw), click Save As, and then click Options.) The default is for all pages in the document to be designated for publishing.

To change the publish status of a page, you can use the IncludePage and ExcludePage methods of the ServerPublishOptions object.


ServerPublishOptions.ObjectType Property (Visio)

 Copy code hover
[image]

ServerPublishOptions.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeServerPublishOptions, the type of this object. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression A variable that represents a ServerPublishOptions object.

Return Value

visObjTypeServerPublishOptions

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


ServerPublishOptions.Stat Property (Visio)

 Copy code hover
[image]

ServerPublishOptions.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression A variable that represents a ServerPublishOptions object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


ServerPublishOptions Methods (Visio)

 Copy code hover
[image]

ServerPublishOptions Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ExcludePage | Excludes the specified page from being published when the document is published as a VDW file.
GetPagesToPublish | Returns an array of pages that are set to be published to a server.
GetRecordsetsToPublish | Returns the identifiers (IDs) of the data recordsets that are set to be published to a server.
IncludePage | Includes the specified page for publication when the document is published as a VDW file.
SetPagesToPublish | Specifies the pages to publish to a server.
SetRecordsetsToPublish | Sets the data recordsets to be published to a server.


ServerPublishOptions.ExcludePage Method (Visio)

 Copy code hover
[image]

ServerPublishOptions.ExcludePage Method (Visio)
Send feedback

Published: July 16, 2012

Excludes the specified page from being published when the document is published as a VDW file.

Version Information

Version Added: Visio 2010

Syntax

expression .ExcludePage(PageNameU,Flags )

expression A variable that represents a ServerPublishOptions object.

Parameters

Name | Required/Optional | Data Type | Description
PageName | Required | String | The name of the page to exclude.
Flags | Required | VisLangFlags | Specifies whether PageName is local or universal.

Return Value

Nothing

Remarks

The Flags parameter must be one of the following VisLangFlags constants.

Constant | Value | Description
visLangLocal | 0 | The page name is a local name.
visLangUniversal | 1 | The page name is a universal name.
Note Note

Excluding a page does not remove that page from the document—it merely prevents that page from appearing in the browser when the file is published as a VDW file. Because excluded pages remain in the document, they increase the size of the document and, hence, may negatively affect performance. For this reason, it is a good idea to use the Page.Delete method to permanently delete unwanted pages from the document.

Calling the ExcludePage method corresponds to clearing the check box for a page in the Pages list in the Publish Settings dialog box (click the File tab, click Save & Send, click Save to SharePoint, click Web Drawing (*.vdw), click Save As, and then click Options).


ServerPublishOptions.GetPagesToPublish Method (Visio)

 Copy code hover
[image]

ServerPublishOptions.GetPagesToPublish Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array of pages that are set to be published to a server.

Version Information

Version Added: Visio 2010

Syntax

expression .GetPagesToPublish(Flags,PublishPages, NamesArray())

expression A variable that represents a ServerPublishOptions object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Required | VisLangFlags | Out parameter. Indicates whether universal or local page names are returned in NamesArray. See Remarks for possible values.
PublishPages | Required | VisPublishPages | Out parameter. Indicates whether all pages or selected pages are set to be published. See Remarks for possible values.
NamesArray() | Required | String | Out parameter. Returns the names of the pages set to be published.

Return Value

Nothing

Remarks

The Flags parameter can be one of the following VisLangFlags constants.

Constant | Value | Description
visLangLocal | 0 | The page name is a local name.
visLangUniversal | 1 | The page name is a universal name.

The PublishPages parameter can be one of the following VisPublishPages constants.

Constant | Value | Description
visPublishPageAll | 0 | Publish all pages.
visPublishPageSelect | 1 | Publish selected pages.


ServerPublishOptions.GetRecordsetsToPublish Method (Visio)

 Copy code hover
[image]

ServerPublishOptions.GetRecordsetsToPublish Method (Visio)
Send feedback

Published: July 16, 2012

Returns the identifiers (IDs) of the data recordsets that are set to be published to a server.

Version Information

Version Added: Visio 2010

Syntax

expression .GetRecordsetsToPublish(PublishDataRecordsets, DataRecordsetIDs())

expression A variable that represents a ServerPublishOptions object.

Parameters

Name | Required/Optional | Data Type | Description
PublishDataRecordsets | Required | VisPublishDataRecordsets | Out parameter. Returns whether all, no, or selected data recordsets are set to be published. See Remarks for possible values.
DataRecordsetIDs() | Required | Long | Out parameter. Returns the IDs of the data recordsets that are set to be published.

Return Value

Nothing

Remarks

The PublishDataRecordsets parameter can be one of the following VisPublishDataRecordsets constants.

Constant | Value | Description
visPublishDataRecordsetsAll | 0 | Publish all data recordsets in the document.
visPublishDataRecordsetsNone | 1 | Publish none of the data recordsets in the document.
visPublishDataRecordsetsSelect | 2 | Publish selected data recordsets.


ServerPublishOptions.IncludePage Method (Visio)

 Copy code hover
[image]

ServerPublishOptions.IncludePage Method (Visio)
Send feedback

Published: July 16, 2012

Includes the specified page for publication when the document is published as a VDW file.

Version Information

Version Added: Visio 2010

Syntax

expression .IncludePage(PageName, Flags)

expression A variable that represents a ServerPublishOptions object.

Parameters

Name | Required/Optional | Data Type | Description
PageName | Required | String | The name of the page to be published.
Flags | Required | VisLangFlags | Indicates whether a universal or local page name is specified in PageName. See Remarks for possible values.

Return Value

Nothing

Remarks

The Flags parameter must be one of the following VisLangFlags constants.

Constant | Value | Description
visLangLocal | 0 | The page name is a local name.
visLangUniversal | 1 | The page name is a universal name.

Calling the IncludePage method corresponds to selecting a page in the Pages list in the Publish Settings dialog box (click the File tab, click Save & Send, click Save to SharePoint, click Web Drawing (*.vdw), click Save As, and then click Options).


ServerPublishOptions.SetPagesToPublish Method (Visio)

 Copy code hover
[image]

ServerPublishOptions.SetPagesToPublish Method (Visio)
Send feedback

Published: July 16, 2012

Specifies the pages to publish to a server.

Version Information

Version Added: Visio 2010

Syntax

expression .SetPagesToPublish(PublishPages, NamesArray(), Flags)

expression A variable that represents a ServerPublishOptions object.

Parameters

Name | Required/Optional | Data Type | Description
PublishPages | Required | VisPublishPages | Indicates whether all pages or selected pages are to be published. See Remarks for possible values.
NamesArray() | Required | String | The names of the pages to be published, if PublishPages is visPublishPageSelect.
Flags | Required | VisLangFlags | Indicates whether universal or local page names are specified in NamesArray. See Remarks for possible values.

Return Value

Nothing

Remarks

The PublishPages parameter must be one of the following VisPublishPages constants.

Constant | Value | Description
visPublishPageAll | 0 | Publish all pages.
visPublishPageSelect | 1 | Publish selected pages.

The Flags parameter must be one of the following VisLangFlags constants.

Constant | Value | Description
visLangLocal | 0 | The page name is a local name.
visLangUniversal | 1 | The page name is a universal name.


ServerPublishOptions.SetRecordsetsToPublish Method (Visio)

 Copy code hover
[image]

ServerPublishOptions.SetRecordsetsToPublish Method (Visio)
Send feedback

Published: July 16, 2012

Sets the data recordsets to be published to a server.

Version Information

Version Added: Visio 2010

Syntax

expression .SetRecordsetsToPublish(PublishDataRecordsets, DataRecordsetIDs())

expression A variable that represents a ServerPublishOptions object.

Parameters

Name | Required/Optional | Data Type | Description
PublishDataRecordsets | Required | VisPublishDataRecordsets | Specifies whether all, no, or selected data recordsets are to be published. See Remarks for possible values.
DataRecordsetIDs() | Required | Long | Specifies the identifiers of the data recordsets that are set to be published if PublishDataRecordsets is visPublishDataRecordsetsSelect.

Return Value

Nothing

Remarks

The PublishDataRecordsets parameter must be one of the following VisPublishDataRecordsets constants.

Constant | Value | Description
visPublishDataRecordsetsAll | 0 | Publish all data recordsets in the document.
visPublishDataRecordsetsNone | 1 | Publish none of the data recordsets in the document.
visPublishDataRecordsetsSelect | 2 | Publish selected data recordsets.


Shape Object (Visio)

 Copy code hover
[image]

Shape Object (Visio)
Send feedback

Published: July 16, 2012

Represents anything you can select in a drawing window: a basic shape, a group, a guide, or an object from another application embedded or linked in Microsoft Visio.

Remarks

The default property of a Shape object is Name.

You can retrieve a particular Shape object from the Shapes collection of the following objects:

  • Page object

  • Master object

  • Shape object that represents a group

To retrieve Cell objects and Connect objects, use the Cells and Connects properties of a Shape object, respectively.

Note Note

The PageSheet property of a Page object and Master object returns a Shape object whose Type property returns visTypePage. It has cells that specify properties such as drawing size and drawing scale. The DocumentSheet property of a Document object also returns a Shape object whose Type property returns visTypeDoc. It has cells that specify properties of the document.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this object maps to the following types:

  • Microsoft.Office.Interop.Visio.EShape_Event (to access events on the Shape object.


Shape Members (Visio)

 Copy code hover
[image]

Shape Members (Visio)
Send feedback

Published: July 16, 2012

Represents anything you can select in a drawing window: a basic shape, a group, a guide, or an object from another application embedded or linked in Microsoft Visio.

Events

Name | Description
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
CellChanged | Occurs after the value changes in a cell in a document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Methods

Name | Description
AddGuide | Adds a guide to a group shape.
AddHyperlink | Adds a Hyperlink object to a Microsoft Visio shape.
AddNamedRow | Adds a row that has the specified name to the specified ShapeSheet section.
AddRow | Adds a row to a ShapeSheet section at a specified position.
AddRows | Adds the specified number of rows to a ShapeSheet section at a specified position.
AddSection | Adds a new section to a ShapeSheet spreadsheet.
AddToContainers | Adds the shape to all underlying containers that allow it as a member.
AutoConnect | Automatically draws a connection in the specified direction between the shape and another shape on the drawing page.
BoundingBox | Returns a rectangle that tightly encloses a shape.
BreakLinkToData | Breaks the link between the shape and the data row to which it is linked in the specified data recordset.
BringForward | Brings the shape or selected shapes forward one position in the z-order.
BringToFront | Brings the shape or selected shapes to the front of the z-order.
CenterDrawing | Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .
ChangePicture | Replaces the specified shape's current picture with a new picture.
ConnectedShapes | Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape.
ConvertToGroup | Converts a selection or an object from another application (a linked or embedded object) to a group.
Copy | Copies a shape to the Clipboard.
CreateSelection | Creates various types of Selection objects.
CreateSubProcess | Creates and returns a new sub-process page that is linked to the shape.
Cut | Deletes an object or selection and places it on the Clipboard.
Delete | Deletes an object or selection.
DeleteEx | Deletes the additional shapes that are associated with the shape, such as connectors and unselected container members, when the shape is deleted.
DeleteRow | Deletes a row from a section in a ShapeSheet spreadsheet.
DeleteSection | Deletes a ShapeSheet section.
Disconnect | Unglues the specified connector end points and offsets them the specified amount from the shapes to which they were joined.
DrawArcByThreePoints | Creates a shape whose path consists of an arc defined by the three points passed as parameters.
DrawBezier | Creates a shape whose path is defined by the supplied sequence of Bezier control points.
DrawCircularArc | Creates a new shape whose path consists of a circular arc defined by its center, radius, and start and end angles.
DrawLine | Adds a line to the Shapes collection of a group shape.
DrawNURBS | Creates a new shape whose path consists of a single NURBS (nonuniform rational B-spline) segment.
DrawOval | Adds an oval (ellipse) to the Shapes collection of a group shape.
DrawPolyline | Creates a shape whose path is a polyline along a given set of points.
DrawQuarterArc | Creates a new shape whose path consists of an elliptical arc defined by the two points and the flag passed in as arguments.
DrawRectangle | Adds a rectangle to the Shapes collection of a page, master, or group.
DrawSpline | Creates a new shape whose path follows a given sequence of points.
Drop | Creates one or more new Shape objects by dropping an object onto a receiving object such as a master, drawing page, shape, or group.
DropMany | Creates one or more new Shape objects in a group. It returns an array of the IDs of the Shape objects it produces.
DropManyU | Creates one or more new Shape objects on a page, in a master, or in a group. It returns an array of the IDs of the Shape objects it produces.
Duplicate | Duplicates an object.
Export | Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.
FitCurve | Reduces the number of geometry segments in a shape or shapes by replacing them with similar spline, arc, and line segments that approximate the paths of the initial segments. Typically, this reduces the number of segments in the shape.
FlipHorizontal | Flips an object horizontally.
FlipVertical | Flips an object vertically.
GetCustomPropertiesLinkedToData | Gets the IDs of the shape-data-item (custom property) rows in the Shape Data section of the shape's ShapeSheet spreadsheet linked to the specified data recordset.
GetCustomPropertyLinkedColumn | Gets the name of the data column linked to the shape data (custom property) row in the shape's ShapeSheet spreadsheet specified by the custom property index.
GetFormulas | Returns the formulas of many cells.
GetFormulasU | Returns the formulas of many cells.
GetLinkedDataRecordsetIDs | Gets the IDs of all the data recordsets that contain data rows linked to the shape.
GetLinkedDataRow | Gets the ID of the data row in the specified data recordset linked to the shape.
GetResults | Gets the results or formulas of many cells.
GluedShapes | Returns an array that contains the identifiers of the shapes that are glued to a shape.
Group | Groups the objects that are selected in a selection, or it converts a shape into a group.
HasCategory | Returns True if the specified category is in the shape categories list.
HitTest | Determines if a given x,y position hits outside, inside, or on the boundary of a shape.
Import | Imports a file into the current document.
InsertFromFile | Adds a linked or embedded object to a page, master, or group.
InsertObject | Adds a new embedded object or ActiveX control to a page, master, or group.
IsCustomPropertyLinked | Returns whether the shape data (custom property) row in the Shape Data section of the shape's ShapeSheet spreadsheet is linked to a data row in the specified data recordset.
Layout | Lays out the shapes or reroutes the connectors (or both) for the page, master, group, or selection.
LinkToData | Links a shape to a data row in a data recordset.
MoveToSubprocess | Moves the shape to the specified page and drops a replacement shape on the source page, then links it to the target page. Returns the selection of moved shapes on the target page.
Offset | Offsets a shape a specified amount.
OpenDrawWindow | Opens a new drawing window that displays a group.
OpenSheetWindow | Opens a ShapeSheet window for a Shape object.
Paste | Pastes the contents of the Clipboard into an object.
PasteSpecial | Inserts the contents of the Clipboard, allowing you to control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Word document).
RemoveFromContainers | Removes the shape from all lists and containers of which it is a member.
ReplaceShape | Replaces the specified shape with an instance of the master passed as the first parameter, and returns the new shape.
Resize | Resizes the shape by moving shape handles as specified.
ReverseEnds | Reverses an object by flipping it both horizontally and vertically.
Rotate90 | Rotates an object 90 degrees counterclockwise.
SendBackward | Moves a shape or selected shapes back one position in the z-order.
SendToBack | Moves the shape or selected shapes to the back of the z-order.
SetBegin | Moves the begin point of a one-dimensional (1-D) shape to the coordinates represented by xPos and yPos.
SetCenter | Moves a shape so that its pin is positioned at the coordinates represented by xPos and yPos. .
SetEnd | Moves the endpoint of a one-dimensional (1-D) shape to the coordinates represented by xPos and yPos.
SetFormulas | Sets the formulas of one or more cells.
SetQuickStyle | Sets the quick style of the specified shape.
SetResults | Sets the results or formulas of one or more cells.
SwapEnds | Swaps the begin and endpoints of a one-dimensional (1-D) shape.
TransformXYFrom | Transforms a point expressed in the local coordinate system of one Shape object from an equivalent point expressed in the local coordinate system of another Shape object.
TransformXYTo | Transforms a point expressed in the local coordinate system of one Shape object to an equivalent point expressed in the local coordinate system of another Shape object.
Ungroup | Ungroups a group.
UpdateAlignmentBox | Updates the alignment box for a shape.
VisualBoundingBox |
XYFromPage | Transforms a point expressed in the local coordinate system of its Page or Master object to an equivalent point expressed in the local coordinate system of the Shape object.
XYToPage | Transforms a point expressed in the local coordinate system of a Shape object to an equivalent point expressed in the local coordinate system of its Page or Master object.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
AreaIU | Returns the area of a Shape object in internal units (square inches). Read-only.
CalloutsAssociated | Returns an array of Long values that represent the collection of identifiers for all of the callout shapes that are associated with the target shape by a callout relationship. Read-only.
CalloutTarget | Gets or sets the target shape that is associated with the callout shape by a callout relationship. Read/write.
CellExists | Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.
CellExistsU | Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.
Cells | Returns a Cell object that represents a ShapeSheet cell. Read-only.
CellsRowIndex | Returns the index of a row to which a cell belongs. Read-only.
CellsRowIndexU | Returns the index of a row to which a cell belongs. Read-only.
CellsSRC | Returns a Cell object that represents a ShapeSheet cell identified by section, row, and column indices. Read-only.
CellsSRCExists | Determines whether a ShapeSheet cell exists in the scope of a search. Read-only.
CellsU | Returns a Cell object that represents a ShapeSheet cell. Read-only.
Characters | Returns a Characters object that represents the text of a shape. Read-only.
CharCount | Returns the number of characters in an object. Read-only.
ClassID | Returns the class ID string of a shape that represents an ActiveX control or an embedded or linked OLE object. Read-only.
Comments | Returns a Comments object that represents the collection of all the reviewer comments on the shape. Read-only.
Connects | Returns a Connects collection for a shape, page, or master. Read-only.
ContainerProperties | Returns the ContainerProperties object associated with the shape. Read-only.
ContainingMaster | Returns the Master object that contains an object. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPage | Returns the page that contains an object.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
ContainingShape | Returns the Shape object that contains an object or collection. Read-only.
Data1 | Gets or sets the value of the Data1 field for a Shape object. Read/write.
Data2 | Gets or sets the value of the Data2 field for a Shape object. Read/write.
Data3 | Gets or sets the value of the Data3 field for a Shape object. Read/write.
DataGraphic | Gets or sets the data graphic master (Master of type visTypeDataGraphic) that is associated with the shape. Read/write.
DistanceFrom | Returns the distance from one shape to another, measured between the closest points on the two shapes. Both shapes must be on the same page or in the same master. Read-only.
DistanceFromPoint | Returns the distance from a shape to a point. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
FillStyle | Returns or sets the fill style for an shape. Read/write.
FillStyleKeepFmt | Applies a fill style to an object while preserving local formatting. Read/write.
ForeignData | Returns metafile, bitmap, or OLE data for a shape that represents a foreign object. Read-only.
ForeignType | Returns the subtype of a Shape object that represents a foreign object. Read-only.
FromConnects | Returns a Connects collection of the shapes connected to a shape. Read-only.
GeometryCount | Returns the number of Geometry sections for a shape. Read-only.
Help | Gets or sets the Help string for a shape. Read/write.
Hyperlinks | Returns the Hyperlinks collection for a Shape object. Read-only.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a Shape object in the Shapes collection. Read-only.
IsCallout | Indicates whether the shape is a callout shape. Read-only.
IsDataGraphicCallout | Specifes whether a shape is a data graphic callout. Read-only.
IsOpenForTextEdit | Indicates whether a shape is currently open for interactive text editing. Read-only.
Language | Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.
Layer | Returns the layer to which a shape is assigned. Read-only.
LayerCount | Returns the number of layers to which a shape is assigned. Read-only.
LengthIU | Returns the length (perimeter) of the shape in internal units. Read-only.
LineStyle | Specifies the line style for an object. Read/write.
LineStyleKeepFmt | Applies a line style to an object while preserving local formatting. Read/write.
Master | Returns the master from which the Shape object was created. Read-only.
MasterShape | If this shape is part of a master instance, returns the shape in the master that this shape inherits from. Read-only.
MemberOfContainers | Returns an array of Long values that represent the identifiers of the container shapes that include the shape as a member. Read-only.
Name | Specifies the name of an object. Read-only.
NameID | Returns a unique name for a shape. Read-only.
NameU | Specifies the universal name of a Shape object. Read/write.
Object | Returns an IDispatch interface on the ActiveX control or embedded or linked OLE 2.0 object represented by a Shape object or an OLEObject object. Read-only.
ObjectIsInherited | Indicates if a shape represents an ActiveX or OLE object that is inherited from the shape's master. Read-only.
ObjectType | Returns an object's type. Read-only.
OneD | Determines whether an object behaves as a one-dimensional (1-D) object. Read-only.
Parent | Determines the parent of a Shape object. Read/write.
Paths | Returns a Paths collection that reports the coordinates of a shape's paths in the coordinate system of the shape's parent. Read-only.
PathsLocal | Returns a Paths collection that reports the coordinates of a shape's paths in the shape's local coordinate system. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Picture | Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.
ProgID | Returns the programmatic identifier of a shape that represents an ActiveX control, an embedded object, or linked object. Read-only.
RootShape | Returns the top-level shape of an instance if this shape is part of a master instance. Read-only.
RowCount | Returns the number of rows in a ShapeSheet section. Read-only.
RowExists | Determines whether a ShapeSheet row exists. Read-only.
RowsCellCount | Returns the number of cells in a row of a ShapeSheet section. Read-only.
RowType | Gets or sets the type of a row in a Geometry, Connection Points, Controls, or Tabs ShapeSheet section. Read/write.
Section | Returns the requested Section object belonging to a shape. Read-only.
SectionExists | Determines whether a ShapeSheet section exists for a particular shape. Read-only.
Shapes | Returns the Shapes collection for a page, master, or group. Read-only.
SpatialNeighbors | Returns a Selection object that represents the shapes that meet certain criteria in relation to a specified shape. Read-only.
SpatialRelation | Returns an integer that represents the spatial relationship of one shape to another shape. Both shapes must be on the same page or in the same master. Read-only.
SpatialSearch | Returns a Selection object whose shapes meet certain criteria in relation to a point that is expressed in the coordinate space of a page, master, or group. Read-only.
Stat | Returns status information for an object. Read-only.
Style | Gets or sets the style for a Shape object. Read/write.
StyleKeepFmt | Applies a style to an object while preserving local formatting. Read/write.
Text | Returns all of the shape's text. Read/write.
TextStyle | Gets or sets the text style for an object. Read/write.
TextStyleKeepFmt | Applies a text style to an object while preserving local formatting. Read/write.
Type | Returns the type of the object. Read-only.
UniqueID | Gets, deletes, or makes the GUID that uniquely identifies the shape within the scope of the application. Read-only.


Shape Properties (Visio)

 Copy code hover
[image]

Shape Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
AreaIU | Returns the area of a Shape object in internal units (square inches). Read-only.
CalloutsAssociated | Returns an array of Long values that represent the collection of identifiers for all of the callout shapes that are associated with the target shape by a callout relationship. Read-only.
CalloutTarget | Gets or sets the target shape that is associated with the callout shape by a callout relationship. Read/write.
CellExists | Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.
CellExistsU | Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.
Cells | Returns a Cell object that represents a ShapeSheet cell. Read-only.
CellsRowIndex | Returns the index of a row to which a cell belongs. Read-only.
CellsRowIndexU | Returns the index of a row to which a cell belongs. Read-only.
CellsSRC | Returns a Cell object that represents a ShapeSheet cell identified by section, row, and column indices. Read-only.
CellsSRCExists | Determines whether a ShapeSheet cell exists in the scope of a search. Read-only.
CellsU | Returns a Cell object that represents a ShapeSheet cell. Read-only.
Characters | Returns a Characters object that represents the text of a shape. Read-only.
CharCount | Returns the number of characters in an object. Read-only.
ClassID | Returns the class ID string of a shape that represents an ActiveX control or an embedded or linked OLE object. Read-only.
Comments | Returns a Comments object that represents the collection of all the reviewer comments on the shape. Read-only.
Connects | Returns a Connects collection for a shape, page, or master. Read-only.
ContainerProperties | Returns the ContainerProperties object associated with the shape. Read-only.
ContainingMaster | Returns the Master object that contains an object. Read-only.
ContainingMasterID | Returns the ID of the Master object that contains an object. Read-only.
ContainingPage | Returns the page that contains an object.
ContainingPageID | Returns the ID of the page that contains an object. Read-only.
ContainingShape | Returns the Shape object that contains an object or collection. Read-only.
Data1 | Gets or sets the value of the Data1 field for a Shape object. Read/write.
Data2 | Gets or sets the value of the Data2 field for a Shape object. Read/write.
Data3 | Gets or sets the value of the Data3 field for a Shape object. Read/write.
DataGraphic | Gets or sets the data graphic master (Master of type visTypeDataGraphic) that is associated with the shape. Read/write.
DistanceFrom | Returns the distance from one shape to another, measured between the closest points on the two shapes. Both shapes must be on the same page or in the same master. Read-only.
DistanceFromPoint | Returns the distance from a shape to a point. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
FillStyle | Returns or sets the fill style for an shape. Read/write.
FillStyleKeepFmt | Applies a fill style to an object while preserving local formatting. Read/write.
ForeignData | Returns metafile, bitmap, or OLE data for a shape that represents a foreign object. Read-only.
ForeignType | Returns the subtype of a Shape object that represents a foreign object. Read-only.
FromConnects | Returns a Connects collection of the shapes connected to a shape. Read-only.
GeometryCount | Returns the number of Geometry sections for a shape. Read-only.
Help | Gets or sets the Help string for a shape. Read/write.
Hyperlinks | Returns the Hyperlinks collection for a Shape object. Read-only.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a Shape object in the Shapes collection. Read-only.
IsCallout | Indicates whether the shape is a callout shape. Read-only.
IsDataGraphicCallout | Specifes whether a shape is a data graphic callout. Read-only.
IsOpenForTextEdit | Indicates whether a shape is currently open for interactive text editing. Read-only.
Language | Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.
Layer | Returns the layer to which a shape is assigned. Read-only.
LayerCount | Returns the number of layers to which a shape is assigned. Read-only.
LengthIU | Returns the length (perimeter) of the shape in internal units. Read-only.
LineStyle | Specifies the line style for an object. Read/write.
LineStyleKeepFmt | Applies a line style to an object while preserving local formatting. Read/write.
Master | Returns the master from which the Shape object was created. Read-only.
MasterShape | If this shape is part of a master instance, returns the shape in the master that this shape inherits from. Read-only.
MemberOfContainers | Returns an array of Long values that represent the identifiers of the container shapes that include the shape as a member. Read-only.
Name | Specifies the name of an object. Read-only.
NameID | Returns a unique name for a shape. Read-only.
NameU | Specifies the universal name of a Shape object. Read/write.
Object | Returns an IDispatch interface on the ActiveX control or embedded or linked OLE 2.0 object represented by a Shape object or an OLEObject object. Read-only.
ObjectIsInherited | Indicates if a shape represents an ActiveX or OLE object that is inherited from the shape's master. Read-only.
ObjectType | Returns an object's type. Read-only.
OneD | Determines whether an object behaves as a one-dimensional (1-D) object. Read-only.
Parent | Determines the parent of a Shape object. Read/write.
Paths | Returns a Paths collection that reports the coordinates of a shape's paths in the coordinate system of the shape's parent. Read-only.
PathsLocal | Returns a Paths collection that reports the coordinates of a shape's paths in the shape's local coordinate system. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Picture | Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.
ProgID | Returns the programmatic identifier of a shape that represents an ActiveX control, an embedded object, or linked object. Read-only.
RootShape | Returns the top-level shape of an instance if this shape is part of a master instance. Read-only.
RowCount | Returns the number of rows in a ShapeSheet section. Read-only.
RowExists | Determines whether a ShapeSheet row exists. Read-only.
RowsCellCount | Returns the number of cells in a row of a ShapeSheet section. Read-only.
RowType | Gets or sets the type of a row in a Geometry, Connection Points, Controls, or Tabs ShapeSheet section. Read/write.
Section | Returns the requested Section object belonging to a shape. Read-only.
SectionExists | Determines whether a ShapeSheet section exists for a particular shape. Read-only.
Shapes | Returns the Shapes collection for a page, master, or group. Read-only.
SpatialNeighbors | Returns a Selection object that represents the shapes that meet certain criteria in relation to a specified shape. Read-only.
SpatialRelation | Returns an integer that represents the spatial relationship of one shape to another shape. Both shapes must be on the same page or in the same master. Read-only.
SpatialSearch | Returns a Selection object whose shapes meet certain criteria in relation to a point that is expressed in the coordinate space of a page, master, or group. Read-only.
Stat | Returns status information for an object. Read-only.
Style | Gets or sets the style for a Shape object. Read/write.
StyleKeepFmt | Applies a style to an object while preserving local formatting. Read/write.
Text | Returns all of the shape's text. Read/write.
TextStyle | Gets or sets the text style for an object. Read/write.
TextStyleKeepFmt | Applies a text style to an object while preserving local formatting. Read/write.
Type | Returns the type of the object. Read-only.
UniqueID | Gets, deletes, or makes the GUID that uniquely identifies the shape within the scope of the application. Read-only.


Shape.Application Property (Visio)

 Copy code hover
[image]

Shape.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Shape object.

Return Value

Application

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShape.Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

    Dim vsoApplication As Visio.Application
    Dim vsoDocument As Visio.Document

    Set vsoDocument = ActiveDocument

    'Get the instance of Visio associated with the Document object.
    Set vsoApplication = vsoDocument.Application
    Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Shape.AreaIU Property (Visio)

 Copy code hover
[image]

Shape.AreaIU Property (Visio)
Send feedback

Published: July 16, 2012

Returns the area of a Shape object in internal units (square inches). Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .AreaIU(fIncludeSubShapes)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
fIncludeSubShapes | Optional | Boolean | False to exclude the area of subshapes. Area of subshapes is included by default.

Return Value

Double

Remarks

Data graphic callout shapes (and their sub-shapes) that are applied to the parent shape are excluded from area calculations. If the parent shape is itself a data graphic callout shape, its geometry (and that of its sub-shapes) is not excluded from area calculations.

In versions before Microsoft Office Visio 2003, this property took no arguments.


Shape.CalloutsAssociated Property (Visio)

 Copy code hover
[image]

Shape.CalloutsAssociated Property (Visio)
Send feedback

Published: July 16, 2012

Returns an array of Long values that represent the collection of identifiers for all of the callout shapes that are associated with the target shape by a callout relationship. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .CalloutsAssociated

expression A variable that represents a Shape object.

Return Value

Long()

Remarks

If there are no callouts associated with the target shape, the CalloutsAssociated property returns an empty array.


Shape.CalloutTarget Property (Visio)

 Copy code hover
[image]

Shape.CalloutTarget Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the target shape that is associated with the callout shape by a callout relationship. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .CalloutTarget

expression A variable that represents a Shape object.

Return Value

Shape

Remarks

If you attempt to get or set the CalloutTarget property value on a shape that is not a callout, Microsoft Visio will return an Inappropriate Source Object error.

If no target shape is associated with the callout shape, the CalloutTarget property returns Nothing. Setting the property value to Nothing removes any target shapes that are associated with the callout shape.

Example

The following Visual Basic for Applications (VBA) example shows how to use the CalloutTarget property to set the target shape of a callout.

VBA Copy code Copy code
Set vsoShape = vsoCalloutShape.CalloutTarget


Shape.CellExists Property (Visio)

 Copy code hover
[image]

Shape.CellExists Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CellExists(localeSpecificCellName, fExistsLocally)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
localeSpecificCellName | Required | String | The local or universal name of the ShapeSheet cell for which you want to search.
fExistsLocally | Required | Integer | The scope of the search.

Return Value

Integer

Remarks

The localeSpecificCellName argument can specify a cell name in either local or universal syntax. To search for a cell by section, row, and column index, use the CellsSRCExists property.

The fExistsLocally argument specifies the scope of the search.

  • If fExistsLocally is non-zero (True), the CellExists property value is True only if the object contains the cell locally; if the cell is inherited, the CellExists property value is False.

  • If fExistsLocally is zero (False), the CellExists property value is True if the object either contains or inherits the cell.

For a list of cell index values, view the Visio type library for the members of class VisCellIndices.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the CellExists property to determine if a cell exists by passing either the cell's local name or its universal name. Use the CellExistsU property to determine if a cell exists by passing the cell's universal name.


Shape.CellExistsU Property (Visio)

 Copy code hover
[image]

Shape.CellExistsU Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CellExistsU(localeIndependentCellName, fExistsLocally)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
localeIndependentCellName | Required | String | The universal name of the ShapeSheet cell for which you want to search.
fExistsLocally | Required | Integer | The scope of the search.

Return Value

Integer

Remarks

The localeIndependentCellName argument must specify a universal cell name. To search for a cell by section, row, and column index, use the CellsSRCExists property.

The fExistsLocally argument specifies the scope of the search.

  • If fExistsLocally is non-zero (True), the CellExistsU property value is True only if the object contains the cell locally; if the cell is inherited, the CellExistsU property value is False.

  • If fExistsLocally is zero (False), the CellExistsU property value is True if the object either contains or inherits the cell.

For a list of cell index values, view the Visio type library for the members of class VisCellIndices.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the CellExists property to determine if a cell exists by passing either the cell's local name or its universal name. Use the CellExistsU property to determine if a cell exists by passing the cell's universal name.


Shape.Cells Property (Visio)

 Copy code hover
[image]

Shape.Cells Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Cell object that represents a ShapeSheet cell. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Cells(localeSpecificCellName)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
localeSpecificCellName | Required | String | The name of a ShapeSheet cell.

Return Value

Cell

Remarks

Cells("somestring") raises an "Unexpected end of file" exception if "somestring" does not name an actual cell. You can use the CellExists property to determine if a cell with the name "somestring" exists.

The cells in a shape's User-Defined Cells and Shape Data sections belong to rows whose names have been assigned by the user or a program. You can use the Cells property to access cells in named rows.

For example, if "Row_1" is the name of a row in a shape's User-Defined Cells section, you can use this statement to access the first cell in this row (the cell in column zero, which holds the name of the row):

VBA Copy code Copy code
vsoCell = vsoShape.Cells("User.Row_1")

You can use this statement to access the prompt cell in Row_1:

VBA Copy code Copy code
vsoCell = vsoShape.Cells("User.Row_1.Prompt")

Next, assume that Row_1 is in the Shape Data section instead of the User- Defined Cells section. You can use this statement to access the first cell in this row (the cell in column zero, which holds the name of the row):

VBA Copy code Copy code
vsoCell = vsoShape.Cells("Prop.Row_1")

You can use this statement to access other cells in the row:

VBA Copy code Copy code
vsoCell = vsoShape.Cells("Prop.Row_1.xxx")

where xxx is one of these cells: Label, Prompt, SortKey, Type, Format, Invisible, or Ask.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Cells property to get a Cell object by using the cell's local name. Use the CellsU property to get a Cell object by using the cell's universal name.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Cells property to get a particular ShapeSheet cell by its name. It draws a rectangle on a page and bows, or curves the lines of the rectangle by changing the shape's lines to arcs. This is accomplished by changing the ShapeSheet row types for each side of the rectangle from LineTo to ArcTo and then changing the values of the X and Y cells in each of these rows.

VBA Copy code Copy code

Public Sub Cells_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim strBowCell As String
 Dim strBowFormula As String
 Dim intCounter As Integer

 'Set the value of the strBowCell string.
 strBowCell = "Scratch.X1"

 'Set the value of the strBowFormula string.
 strBowFormula = "=Min(Width, Height) / 5"

 Set vsoPage = ActivePage

 'If there isn't an active page, set vsoPage
 'to the first page of the active document.
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle on the active page.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section and add a row to the scratch section.
 vsoShape.AddSection visSectionScratch
 vsoShape.AddRow visSectionScratch, visRowScratch, 0

 'Set vsoCell to the Scratch.X1 cell and set its formula.
 Set vsoCell = vsoShape.Cells(strBowCell)
 vsoCell.Formula = strBowFormula

 'Bow in or curve the rectangle's lines by changing
 'each row type from LineTo to ArcTo and entering the bow value.
 For intCounter = 1 To 4
 vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
 Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
 vsoCell.Formula = "-" & strBowCell
 Next intCounter

End Sub


Shape.CellsRowIndex Property (Visio)

 Copy code hover
[image]

Shape.CellsRowIndex Property (Visio)
Send feedback

Published: July 16, 2012

Returns the index of a row to which a cell belongs. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .CellsRowIndex(localeSpecificCellName)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
localeSpecificCellName | Required | String | The name of a ShapeSheet cell.

Return Value

Integer

Remarks

The CellRowIndex property searches by local cell names first; if it doesn't find the name, it will search by universal cell name.

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the CellsRowIndex property to get a cell's row index by using the cell's local name. Use the CellsRowIndexU property to get a cell's row index by using the cell's universal name.


Shape.CellsRowIndexU Property (Visio)

 Copy code hover
[image]

Shape.CellsRowIndexU Property (Visio)
Send feedback

Published: July 16, 2012

Returns the index of a row to which a cell belongs. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .CellsRowIndexU(localeIndependentCellName)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
localeIndependentCellName | Required | String | The universal name of a ShapeSheet cell.

Return Value

Integer

Remarks

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the CellsRowIndex property to get a cell's row index by using the cell's local name. Use the CellsRowIndexU property to get a cell's row index by using the cell's universal name.


Shape.CellsSRC Property (Visio)

 Copy code hover
[image]

Shape.CellsSRC Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Cell object that represents a ShapeSheet cell identified by section, row, and column indices. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .CellsSRC(Section, Row, Column)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The cell's section index.
Row | Required | Integer | The cell's row index.
Column | Required | Integer | The cell's column index.

Return Value

Cell

Remarks

To access any shape formula by its section, row, and column indices, use the CellsSRC property. Constants for section, row, and column indices are declared by the Visio type library as members of VisSectionIndices, VisRowIndices, and VisCellIndices, respectively.

The CellsSRC property might raise an exception if index values for section, row, and column do not identify an actual cell, depending on the section. However, even if no exception is raised, subsequent methods invoked on the returned object fail. You can determine if a cell with particular index values exists by using the CellsSRCExists property.

The CellsSRC property is typically used to iterate through the cells in a section or row. To retrieve a single cell, use the Cells property and specify a cell name. For example:

VBA Copy code Copy code
Set vsoCell = Cells("PinX")

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShape.get_CellsSRC

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the CellsSRC property to set a particular ShapeSheet cell by its section, row, and column indices. It draws a rectangle on a page and bows, or curves the lines of the rectangle by changing the shape's lines to arcs. The macro then draws an inner rectangle within the bowed lines of the first rectangle.

VBA Copy code Copy code

Public Sub CellsSRC_Example()

    Dim vsoPage As Visio.Page
    Dim vsoShape As Visio.Shape
    Dim vsoCell As Visio.Cell
    Dim strBowCell As String
    Dim strBowFormula As String
    Dim intIndex As Integer
    Dim intCounter As Integer

    'Set the value of the strBowCell string.
    strBowCell = "Scratch.X1"

    'Set the value of the strBowFormula string.
    strBowFormula = "=Min(Width, Height) / 5"

    Set vsoPage = ActivePage

    'If there isn't an active page, set vsoPage
    'to the first page of the active document.
    If vsoPage Is Nothing Then
        Set vsoPage = ActiveDocument.Pages(1)
    End If

    'Draw a rectangle on the active page.
    Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

    'Add a scratch section to the shape's ShapeSheet
    vsoShape.AddSection visSectionScratch

    'Add a row to the scratch section.
    vsoShape.AddRow visSectionScratch, visRowScratch, 0

    'Set vsoCell to the Scratch.X1 cell and set its formula.
    Set vsoCell = vsoShape.Cells(strBowCell)
    vsoCell.Formula = strBowFormula

    'Bow in or curve the rectangle's lines by changing
    'each row type from LineTo to ArcTo and entering the bow value.
    For intCounter = 1 To 4
        vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
        Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
        vsoCell.Formula = "-" & strBowCell
    Next intCounter

    'Create an inner rectangle.
    'Set the section index for the inner rectangle's Geometry section.
    intIndex = visSectionFirstComponent + 1

    'Add an inner rectangle Geometry section.
    vsoShape.AddSection intIndex

    'Add the first 2 rows to the section.
    vsoShape.AddRow intIndex, visRowComponent, visTagComponent
    vsoShape.AddRow intIndex, visRowVertex, visTagMoveTo

    'Add 4 LineTo rows to the section
    For intCounter = 1 To 4
        vsoShape.AddRow intIndex, visRowLast, visTagLineTo
    Next intCounter

    'Set the inner rectangle start point cell formulas.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 0)
    vsoCell.Formula = "Width * 0 + " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 1)
    vsoCell.Formula = "Height * 0 + " & strBowCell

    'Draw the inner rectangle bottom line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 0)
    vsoCell.Formula = "Width * 1 - " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 1)
    vsoCell.Formula = "Height * 0 + " & strBowCell

    'Draw the inner rectangle right side line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 0)
    vsoCell.Formula = "Width * 1 - " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 1)
    vsoCell.Formula = "Height * 1 - " & strBowCell

    'Draw the inner rectangle top line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 0)
    vsoCell.Formula = "Width * 0 + " & strBowCell
    Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 1)
    vsoCell.Formula = "Height * 1 - " & strBowCell

    'Draw the inner rectangle left side line.
    Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 0)
    vsoCell.Formula = "Geometry2.X1"
    Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 1)
    vsoCell.Formula = "Geometry2.Y1"

End Sub


Shape.CellsSRCExists Property (Visio)

 Copy code hover
[image]

Shape.CellsSRCExists Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a ShapeSheet cell exists in the scope of a search. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CellsSRCExists(Section, Row, Column, fExistsLocally)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The cell's section index.
Row | Required | Integer | The cell's row index.
Column | Required | Integer | The cell's column index.
fExistsLocally | Required | Integer | The scope of the search.

Return Value

Integer

Remarks

Constants for section, row, and column indices are declared by the Visio type library as members of VisSectionIndices, VisRowIndices, and VisCellIndices, respectively.

The fExistsLocally argument specifies the scope of the search:

  • If fExistsLocally is non-zero (True), the CellsSRCExists property returns True only if the object contains the cell locally; if the cell is inherited, the CellsSRCExists property returns False.

  • If fExistsLocally is zero (False), the CellsSRCExists property returns True if the object either contains or inherits the cell.

To search for a cell by name, use the CellExists or CellExistsU property.


Shape.CellsU Property (Visio)

 Copy code hover
[image]

Shape.CellsU Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Cell object that represents a ShapeSheet cell. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .CellsU(localeIndependentCellName)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
localeIndependentCellName | Required | String | The name of a ShapeSheet cell.

Return Value

Cell

Remarks

CellsU("somestring") raises an "Unexpected end of file" exception if "somestring" does not name an actual cell. You can use the CellExistsU property to determine if a cell with the universal name "somestring" exists.

The cells in a shape's User-Defined Cells and Shape Data sections belong to rows whose names have been assigned by the user or a program. You can use the CellsU property to access cells in named rows.

For example, if "Row_1" is the name of a row in a shape's User-Defined Cells section, you can use this statement to access the first cell in this row (the cell in column zero, which holds the name of the row):

VBA Copy code Copy code
vsoCell = vsoShape.CellsU("User.Row_1")

You can use this statement to access the prompt cell in Row_1:

VBA Copy code Copy code
vsoCell = vsoShape.CellsU("User.Row_1.Prompt")

Next, assume that Row_1 is in the Shape Data section instead of the User- Defined Cells section. You can use this statement to access the first cell in the row (the cell in column zero, which holds the name of the row):

VBA Copy code Copy code
vsoCell = vsoShape.CellsU("Prop.Row_1")

You can use this statement to access other cells in the row:

VBA Copy code Copy code
vsoCell = vsoShape.CellsU("Prop.Row_1.xxx")

where xxx is one of these cells: Label, Prompt, SortKey, Type, Format, Invisible, or Ask.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Cells property to get a Cell object by using the cell's local name. Use the CellsU property to get a Cell object by using the cell's universal name.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the CellsU property to get a particular ShapeSheet cell by its universal name. It draws a rectangle on a page and bows, or curves the lines of the rectangle by changing the shape's lines to arcs. This is accomplished by changing the ShapeSheet row types for each side of the rectangle from LineTo to ArcTo and then changing the values of the X and Y cells in each of these rows.

VBA Copy code Copy code

Public Sub CellsU_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim strBowCell As String
 Dim strBowFormula As String
 Dim intCounter As Integer

 'Set the value of the strBowCell string.
 strBowCell = "Scratch.X1"

 'Set the value of the strBowFormula string.
 strBowFormula = "=Min(Width, Height) / 5"

 Set vsoPage = ActivePage

 'If there isn't an active page, set vsoPage
 'to the first page of the active document.
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle on the active page.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section and add a row to the scratch section.
 vsoShape.AddSection visSectionScratch
 vsoShape.AddRow visSectionScratch, visRowScratch, 0

 'Set vsoCell to the Scratch.X1 cell and set its formula.
 Set vsoCell = vsoShape.CellsU(strBowCell)
 vsoCell.Formula = strBowFormula

 'Bow in or curve the rectangle's lines by changing
 'each row type from LineTo to ArcTo and entering the bow value.
 For intCounter = 1 To 4
 vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
 Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
 vsoCell.Formula = "-" & strBowCell
 Next intCounter

End Sub


Shape.Characters Property (Visio)

 Copy code hover
[image]

Shape.Characters Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Characters object that represents the text of a shape. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Characters

expression A variable that represents a Shape object.

Return Value

Characters

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShape.Characters

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Characters property of a shape to get a Characters object. Once a Characters object has been retrieved, the example uses the Shape property of the Characters object to get the shape that contains the characters and demonstrates that the containing shape has been retrieved by printing its text in the Immediate window.

VBA Copy code Copy code

Public Sub Characters_Example()

    Dim vsoOval As Visio.Shape
    Dim vsoShapeFromCharacters As Visio.Shape
    Dim vsoCharacters As Visio.Characters

    'Create a shape and add text to it.
    Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
    vsoOval.Text = "Rectangular Shape"

    'Get a Characters object from the oval shape.
    Set vsoCharacters = vsoOval.Characters

    'Set the Begin and End properties so that we can
    'replace the word "Rectangular" with "Oval"
    vsoCharacters.Begin = 0
    vsoCharacters.End = 11
    vsoCharacters.Text = "Oval"

    'Use the Shape property of the Characters object
    'to get the Shape object.
    Set vsoShapeFromCharacters = vsoCharacters.Shape

    'Print the shape's text to verify that the proper Shape
    'object was returned.
    Debug.Print vsoShapeFromCharacters.Text

End Sub


Shape.CharCount Property (Visio)

 Copy code hover
[image]

Shape.CharCount Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of characters in an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .CharCount

expression A variable that represents a Shape object.

Return Value

Long

Remarks

For a Shape object, the CharCount property returns the number of characters in the shape's text. For a Characters object, the CharCount property returns the number of characters in the text range represented by that object.

The value returned by the CharCount property includes the expanded number of characters for any fields in the object's text. For example, if the text contains a field that displays the file name of a drawing, the CharCount property includes the number of characters in the file name, rather than the one-character escape sequence used to represent a field in the Text property of a Shape object.


Shape.ClassID Property (Visio)

 Copy code hover
[image]

Shape.ClassID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the class ID string of a shape that represents an ActiveX control or an embedded or linked OLE object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ClassID

expression A variable that represents a Shape object.

Return Value

String

Remarks

The ClassID property raises an exception if the shape doesn't represent an ActiveX control or an OLE 2.0 embedded or linked object. A shape represents an ActiveX control or an OLE 2.0 embedded or linked object if the visTypeIsOLE2 bit (&H8000) is set in the value returned by Shape.ForeignType.

ClassID returns a string of the form:

VBA Copy code Copy code
{2287DC42-B167-11CE-88E9-002AFDDD917}

This identifies the application that services the object. It might, for example, identify an embedded object on a Microsoft Visio page as a Microsoft Excel object.

After using a shape's Object property to obtain an Automation interface on the object the shape represents, you might want to obtain the shape's ClassID or ProgID property to determine the methods and properties provided by the interface.


Shape.Comments Property (Visio)

 Copy code hover
[image]

Shape.Comments Property (Visio)
See also Send feedback

Published: July 16, 2012

Returns a Comments object that represents the collection of all the reviewer comments on the shape. Read-only.

Syntax

expression .Comments

expression A variable that represents a Shape object.

Property value

IVCOMMENTS

See also

Concepts

Shape Object

Other resources

Shape Members


Shape.Connects Property (Visio)

 Copy code hover
[image]

Shape.Connects Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Connects collection for a shape, page, or master. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Connects

expression A variable that represents a Shape object.

Return Value

Connects

Remarks

The Connects collection of a shape contains every Connect object for which the shape is returned by the FromSheet property. This tells you all the shapes to which the shape is connected.

To obtain a Connects collection that contains every Connect object for which the shape is the ToSheet property, use the shape's FromConnects property. This tells you all the shapes that are connected to this shape.

The Connects collection of a page contains a Connect object for every connection on the page.

The Connects collection of a master contains a Connect object for every connection in the master.


Shape.ContainerProperties Property (Visio)

 Copy code hover
[image]

Shape.ContainerProperties Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ContainerProperties object associated with the shape. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ContainerProperties

expression A variable that represents a Shape object.

Return Value

ContainerProperties

Remarks

If the shape is not a container, the ContainerProperties property returns Nothing.


Shape.ContainingMaster Property (Visio)

 Copy code hover
[image]

Shape.ContainingMaster Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Master object that contains an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ContainingMaster

expression A variable that represents a Shape object.

Return Value

Master

Remarks

If the object isn't in a Master object, the ContainingMaster property returns Nothing. For example, if a Shape object belongs to the Shapes collection of a Page object, the ContainingMaster property returns Nothing.


Shape.ContainingMasterID Property (Visio)

 Copy code hover
[image]

Shape.ContainingMasterID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the Master object that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingMasterID

expression A variable that represents a Shape object.

Return Value

Long

Remarks

If the object is not in a Master object, the ContainingMasterID property returns -1. For example, if a Shape object belongs to the Shapes collection of a Page object, the ContainingMasterID property returns -1.


Shape.ContainingPage Property (Visio)

 Copy code hover
[image]

Shape.ContainingPage Property (Visio)
Send feedback

Published: July 16, 2012

Returns the page that contains an object.

Version Information

Version Added: Visio 4.0

Syntax

expression .ContainingPage

expression A variable that represents a Shape object.

Return Value

Page

Remarks

If the object isn't in a Page object, the ContainingPage property returns Nothing. For example, if a Shape object belongs to a Masters collection, the ContainingPage property returns Nothing.


Shape.ContainingPageID Property (Visio)

 Copy code hover
[image]

Shape.ContainingPageID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the page that contains an object. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ContainingPageID

expression A variable that represents a Shape object.

Return Value

Long

Remarks

If the object is not in a Page object, the ContainingPageID property returns -1. For example, if a Shape object belongs to a Masters collection, the ContainingPageID property returns -1.


Shape.ContainingShape Property (Visio)

 Copy code hover
[image]

Shape.ContainingShape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that contains an object or collection. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ContainingShape

expression A variable that represents a Shape object.

Return Value

Shape

Remarks

If the Shape object is the member of a group, the ContainingShape property returns that group.

If the Shape object is a top-level shape in its Page or Master object (it is not a member of a group), the ContainingShape property returns the page sheet of its page or master.

If the Shape object is the page sheet of a page or master, the ContainingShape property returns Nothing.


Shape.Data1 Property (Visio)

 Copy code hover
[image]

Shape.Data1 Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the value of the Data1 field for a Shape object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Data1

expression A variable that represents a Shape object.

Return Value

String

Remarks

Use the Data1 property to supply additional information about a shape. The property can contain up to 64 KB of characters. Text controls should be used with care with a string that is greater than 3,000 characters. Setting the Data1 property is equivalent to entering information in the Data 1 box in the Special dialog box (click Shape Name in the Shape Design group on the Developertab).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to set a shape's Data1, Data2, and Data3 properties. It prints the values of these properties in the Immediate window. You can also verify that these values have been set by opening the Special dialog box.

VBA Copy code Copy code
Public Sub Data123_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape

 Set vsoPage = Documents.Add("").Pages(1)
 Set vsoShape = vsoPage.DrawRectangle(3, 3, 5, 5)

 'Use the Data1, Data2, and Data3 properties to set
 'the shape's Data fields.
 vsoShape.Data1 = "Data1_String"
 vsoShape.Data2 = "Data2_String"
 vsoShape.Data3 = "Data3_String"

 'Use the Data1, Data2, and Data3 properties to verify
 'the shape's Data field values.
 Debug.Print vsoShape.Data1
 Debug.Print vsoShape.Data2
 Debug.Print vsoShape.Data3

End Sub


Shape.Data2 Property (Visio)

 Copy code hover
[image]

Shape.Data2 Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the value of the Data2 field for a Shape object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Data2

expression A variable that represents a Shape object.

Return Value

String

Remarks

Use the Data2 property to supply additional information about a shape. The property can contain up to 64 KB of characters. Text controls should be used with care with a string that is greater than 3,000 characters. Setting the Data2 property is equivalent to entering information in the Data 2 box in the Special dialog box (click Shape Name in the Shape Design group on the Developertab).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to set a shape's Data1, Data2, and Data3 properties. It prints the values of these properties in the Immediate window. You can also verify that these values have been set by opening the Special dialog box.

VBA Copy code Copy code
Public Sub Data123_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape

 Set vsoPage = Documents.Add("").Pages(1)
 Set vsoShape = vsoPage.DrawRectangle(3, 3, 5, 5)

 'Use the Data1, Data2, and Data3 properties to set
 'the shape's Data fields.
 vsoShape.Data1 = "Data1_String"
 vsoShape.Data2 = "Data2_String"
 vsoShape.Data3 = "Data3_String"

 'Use the Data1, Data2, and Data3 properties to verify
 'the shape's Data field values.
 Debug.Print vsoShape.Data1
 Debug.Print vsoShape.Data2
 Debug.Print vsoShape.Data3

End Sub


Shape.Data3 Property (Visio)

 Copy code hover
[image]

Shape.Data3 Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the value of the Data3 field for a Shape object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Data3

expression A variable that represents a Shape object.

Return Value

String

Remarks

Use the Data3 property to supply additional information about a shape. The property can contain up to 64 KB of characters. Text controls should be used with care with a string that is greater than 3,000 characters. Setting the Data3 property is equivalent to entering information in the Data 3 box in the Special dialog box (click Shape Name in the Shape Design group on the Developertab).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to set a shape's Data1, Data2, and Data3 properties. It prints the values of these properties in the Immediate window. You can also verify that these values have been set by opening the Special dialog box.

VBA Copy code Copy code
Public Sub Data123_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape

 Set vsoPage = Documents.Add("").Pages(1)
 Set vsoShape = vsoPage.DrawRectangle(3, 3, 5, 5)

 'Use the Data1, Data2, and Data3 properties to set
 'the shape's Data fields.
 vsoShape.Data1 = "Data1_String"
 vsoShape.Data2 = "Data2_String"
 vsoShape.Data3 = "Data3_String"

 'Use the Data1, Data2, and Data3 properties to verify
 'the shape's Data field values.
 Debug.Print vsoShape.Data1
 Debug.Print vsoShape.Data2
 Debug.Print vsoShape.Data3

End Sub


Shape.DataGraphic Property (Visio)

 Copy code hover
[image]

Shape.DataGraphic Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the data graphic master (Master of type visTypeDataGraphic) that is associated with the shape. Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .DataGraphic

expression An expression that returns a Shape object.

Return Value

Master

Remarks

If the shape has no data graphic master associated with it, the DataGraphic property returns Nothing.


Shape.DistanceFrom Property (Visio)

 Copy code hover
[image]

Shape.DistanceFrom Property (Visio)
Send feedback

Published: July 16, 2012

Returns the distance from one shape to another, measured between the closest points on the two shapes. Both shapes must be on the same page or in the same master. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .DistanceFrom(OtherShape, Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
OtherShape | Required | [IVSHAPE] | The other Shape object involved in the comparison.
Flags | Required | Integer | Flags that influence the type of entries returned in results.

Return Value

Double

Remarks

The DistanceFrom property returns:

  • Zero and raises an exception if the shapes being compared are in different masters or on different pages.

  • Zero if the shapes being compared are overlapping.

  • Zero if one shape contains the other shape or one shape is contained within the other shape.

The Flags argument can be any combination of the values of the constants defined in the following table. These constants are also defined in VisSpatialRelationFlags in the Microsoft Visio type library.

Constant | Value | Description
visSpatialIncludeDataGraphics | &H40 | Includes data graphic callout shapes and their sub-shapes. By default, data graphic callout shapes and their subshapes are not included. If the parent shape is itself a data graphic callout, searches are made between the parent shape's geometry and non-callout shapes, unless this flag is set.
visSpatialIncludeHidden | &H10 | Consider hidden Geometry sections. By default, hidden Geometry sections do not influence the result.
visSpatialIgnoreVisible | &H20 | Do not consider visible Geometry sections. By default, visible Geometry sections influence the result.

Use the NoShow cell to determine whether a Geometry section is hidden or visible. Hidden Geometry sections have a value of TRUE and visible Geometry sections have a value of FALSE in the NoShow cell.

If the parent shape or OtherShape has no geometry, or if Flags excludes consideration of all geometry of either shape, the DistanceFrom property returns a large number (1E+30) that should be construed as infinite.

The DistanceFrom property does not consider the width of a shape's line, shadows, line ends, control points, or connection points when comparing two shapes.


Shape.DistanceFromPoint Property (Visio)

 Copy code hover
[image]

Shape.DistanceFromPoint Property (Visio)
Send feedback

Published: July 16, 2012

Returns the distance from a shape to a point. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .DistanceFromPoint(x, y, Flags, [pvPathIndex], [pvCurveIndex], [pvt])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Double | An x-coordinate.
y | Required | Double | A y-coordinate.
Flags | Required | Integer | Flags that influence the type of entries returned in results.
pvPathIndex | Optional | Variant | Identifies the point on the shape in conjunction with pvCurveIndex and pvt.
pvCurveIndex | Optional | Variant | Identifies the point on the shape in conjunction with pvPathIndex and pvt.
pvt | Optional | Variant | Identifies the point on the shape in conjunction with pvPathIndex and pvCurveIndex.

Return Value

Double

Remarks

The (x,y) point is expressed in internal drawing units (inches in the drawing) with respect to the coordinate space defined by the sheet immediately containing ThisShape.

The pvPathIndex, pvCurveIndex, and pvt arguments optionally return values that identify the point the returned distance is measured from. Call that point (xOnThis,yOnThis). It lies along the c'th curve of ThisShape's p'th path and can be determined by:

VBA Copy code Copy code
ThisShape.Paths(*pvPathIndex).Item(*pvCurveIndex).Point(*pvt,&xOnThis ,&yOnthis)

You can use the PointAndDerivatives method instead of the Point method if you want to find the first and second derivatives at position t along the curve.

If pvPathIndex or pvCurveIndex is not Null, an Integer (type VT_I4) is returned. If pvt isn't Null, DistanceFromPoint returns a Double (type VT_R8).

The DistanceFromPoint property considers guides to have extent and considers a shape's filled areas and paths.

The Flags argument can be any combination of the values of the constants defined in the following table. These constants are also defined in VisSpatialRelationFlags in the Microsoft Visio type library.

Constant | Value | Description
visSpatialIncludeDataGraphics | &H40 | Includes data graphic callout shapes and their sub-shapes. By default, data graphic callout shapes and their subshapes are not included. If the parent shape is itself a data graphic callout, searches are made between the parent shape's geometry and non-callout shapes, unless this flag is set.
visSpatialIncludeHidden | &H10 | Consider hidden Geometry sections. By default, hidden Geometry sections do not influence the result.
visSpatialIgnoreVisible | &H20 | Do not consider visible Geometry sections. By default, visible Geometry sections influence the result.

Use the NoShow cell to determine whether a Geometry section is hidden or visible. Hidden Geometry sections have a value of TRUE and visible Geometry sections have a value of FALSE in the NoShow cell.

If the parent object has no geometry, or if Flags excludes consideration of all geometry, the DistanceFromPoint property returns a large number (1E+30) which should be interpreted as infinite.

The DistanceFromPoint property does not consider the width of a shape's line, shadows, line ends, control points, or connection points when computing its result.


Shape.Document Property (Visio)

 Copy code hover
[image]

Shape.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Shape object.

Return Value

Document

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Document property of various objects to retrieve data about those objects, and does the following:

  • It adds a Document object to the Documents collection and sets several of the Document object's properties.

  • It gets the active window and active page, draws a rectangle on the page, and drops a master on the Document object to provide various objects to work on.

  • It uses the Document property to get the Document object associated with each of these other objects.

VBA Copy code Copy code

Public Sub Document_Example()

 Dim vsoDocument As Visio.Document
 Dim vsoTempDocument As Visio.Document
 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoWindow As Visio.Window
 Dim vsoMaster As Visio.Master

 'Add a document to the Documents collection.
 Set vsoDocument = Documents.Add("")

 'Set the title of the document.
 vsoDocument.Title = "My Document"

 'Get the active window and active page.
 Set vsoWindow = ActiveWindow
 Set vsoPage = ActivePage

 'Draw a rectangle on the page.
 Set vsoShape = vsoPage.DrawRectangle(2, 2, 5, 5)

 'Add a master.
 Set vsoMaster = vsoDocument.Masters.Add

 'Get the Document object associated with various other objects.
 'Get the Document object associated with the Window object.
 Set vsoTempDocument = vsoWindow.Document

 'Get the Title property of the Document object
 'to verify that this is the same document we added earlier.
 Debug.Print vsoTempDocument.Title

 'Get the Document object associated with the Page object.
 Set vsoTempDocument = vsoPage.Document
 Debug.Print vsoTempDocument.Title

 'Get the Document object associated with the Shape object.
 Set vsoTempDocument = vsoShape.Document
 Debug.Print vsoTempDocument.Title

 'Get the Document object associated with the Master object.
 Set vsoTempDocument = vsoMaster.Document
 Debug.Print vsoTempDocument.Title

End Sub


Shape.EventList Property (Visio)

 Copy code hover
[image]

Shape.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Shape object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Shape.FillStyle Property (Visio)

 Copy code hover
[image]

Shape.FillStyle Property (Visio)
Send feedback

Published: July 16, 2012

Returns or sets the fill style for an shape. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .FillStyle

expression A variable that represents a Shape object.

Return Value

String

Remarks

Setting the FillStyle property is equivalent to selecting a style from the Style list in the Fill dialog box (right-click the shape, point to Format, and then click Fill).

Setting a style to a nonexistent style generates an error. Setting one type of style to another type (for example, setting the FillStyle property to a line style) does nothing. Setting one type of style to another type that has more than one set of attributes changes only the appropriate attributes. For example, setting the FillStyle property to a style that has line, text, and fill attributes changes only the fill attributes.

To preserve a shape's local formatting, use the FillStyleKeepFmt property.

Beginning with Microsoft Visio 2002, setting the FillStyle property to a zero-length string ("") causes the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to draw an oval and set its FillStyle property. To run this macro, open a drawing based on the Basic Diagram template.

VBA Copy code Copy code

Public Sub FillStyle_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawOval(1.5, 10.5, 7.5, 6.5)
 vsoShape.FillStyle = "Basic"

End Sub


Shape.FillStyleKeepFmt Property (Visio)

 Copy code hover
[image]

Shape.FillStyleKeepFmt Property (Visio)
Send feedback

Published: July 16, 2012

Applies a fill style to an object while preserving local formatting. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .FillStyleKeepFmt

expression A variable that represents a Shape object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error. Setting one type of style to another type (for example, setting the FillStyleKeepFmt property to a line style) does nothing. Setting one type of style to another type that has more than one set of attributes changes only the appropriate attributes (for example, setting the FillStyleKeepFmt property to a style that has line, text, and fill attributes changes only the fill attributes).

Beginning with Microsoft Visio 2002, setting FillStyleKeepFmt to an empty string ("") causes the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.


Shape.ForeignData Property (Visio)

 Copy code hover
[image]

Shape.ForeignData Property (Visio)
Send feedback

Published: July 16, 2012

Returns metafile, bitmap, or OLE data for a shape that represents a foreign object. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .ForeignData

expression A variable that represents a Shape object.

Return Value

Byte()

Remarks

To determine whether a shape represents a foreign object, use the ForeignType property.


Shape.ForeignType Property (Visio)

 Copy code hover
[image]

Shape.ForeignType Property (Visio)
Send feedback

Published: July 16, 2012

Returns the subtype of a Shape object that represents a foreign object. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ForeignType

expression A variable that represents a Shape object.

Return Value

Integer

Remarks

If the Type property of a Shape object returns any value other than visTypeForeignObject, the ForeignType property returns the same value as the Shape object's Type property. If the Type property of a Shape object returns visTypeForeignObject, the ForeignType property returns a combination of the following values.

Constant | Value
visTypeMetafile | &H0010
visTypeBitmap | &H0020
visTypeIsLinked | &H0100
visTypeIsEmbedded | &H0200
visTypeIsControl | &H0400
visTypeIsOLE2 | &H8000

If the shape represents an OLE 2.0 embedded object, for example, its ForeignType property is &H8200.


Shape.FromConnects Property (Visio)

 Copy code hover
[image]

Shape.FromConnects Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Connects collection of the shapes connected to a shape. Read-only.

Version Information

Version Added: Visio 4.5

Syntax

expression .FromConnects

expression A variable that represents a Shape object.

Return Value

Connects

Remarks

The FromConnects property of a shape returns a Connects collection that contains every Connect object for which the shape is the ToSheet property. This tells you all the shapes connected to a shape.

To obtain a Connects collection that contains every Connect object for which the shape is the FromSheet property, use the shape's Connects property. This tells you all the shapes to which the shape is connected.


Shape.GeometryCount Property (Visio)

 Copy code hover
[image]

Shape.GeometryCount Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of Geometry sections for a shape. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .GeometryCount

expression A variable that represents a Shape object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the GeometryCount property to determine the number of Geometry sections a shape has.

To run this macro, first insert into your project a user form that contains a list box. Use the default names for the form and the list box. In the Properties window, set the width of the form to 400 and the width of the list box to 300. This macro also assumes that you have one or more shapes on the active page.

VBA Copy code Copy code
Public Sub GeometryCount_Example()
 Dim vsoShape As Visio.Shape
 Dim intCurrentGeometrySection As Integer
 Dim intCurrentGeometrySectionIndex As Integer
 Dim intRows As Integer
 Dim intCells As Integer
 Dim intCurrentRow As Integer
 Dim intCurrentCell As Integer
 Dim intSections As Integer

 'Get the first shape from the active page.
 Set vsoShape = ActivePage.Shapes(1)

 'Clear the list box.
 UserForm1.ListBox1.Clear

 'Get the count of Geometry sections in the shape.
 '(If the shape is a group, this will be 0.)
 intSections = vsoShape.GeometryCount

 'Iterate through all Geometry sections for the shape.
 'Because we are adding the current Geometry section index to
 'the constant visSectionFirstComponent, we must start with 0.
 For intCurrentGeometrySectionIndex = 0 To intSections - 1

 'Set a variable to use when accessing the current
 'Geometry section.
 intCurrentGeometrySection = visSectionFirstComponent + intCurrentGeometrySectionIndex

 'Get the count of rows in the current Geometry section.
 intRows = vsoShape.RowCount(intCurrentGeometrySection)

 'Loop through the rows. The count is zero-based.
 For intCurrentRow = 0 To (intRows - 1)

 'Get the count of cells in the current row.
 intCells = vsoShape.RowsCellCount(intCurrentGeometrySection, intCurrentRow)

 'Loop through the cells. Again, this is zero-based.
 For intCurrentCell = 0 To (intCells - 1)

 'Get the cell's formula and
 'add it to the list box.
 UserForm1.ListBox1.AddItem _
 vsoShape.CellsSRC(intCurrentGeometrySection, intCurrentRow, _
 intCurrentCell).LocalName & ": " & _
 vsoShape.CellsSRC(intCurrentGeometrySection, intCurrentRow, _
 intCurrentCell).Formula
 Next intCurrentCell
 Next intCurrentRow
 Next intCurrentGeometrySectionIndex

 'Display the user form.

 UserForm1.Show

End Sub


Shape.Help Property (Visio)

 Copy code hover
[image]

Shape.Help Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the Help string for a shape. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .Help

expression A variable that represents a Shape object.

Return Value

String

Remarks

Using the Help property is equivalent to entering a value in the Help box for a shape in the Special dialog box (in the Shape Design group on the Developertab, click Shape Name ).


Shape.Hyperlinks Property (Visio)

 Copy code hover
[image]

Shape.Hyperlinks Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Hyperlinks collection for a Shape object. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .Hyperlinks

expression A variable that represents a Shape object.

Return Value

Hyperlinks


Shape.ID Property (Visio)

 Copy code hover
[image]

Shape.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ID of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ID

expression A variable that represents a Shape object.

Return Value

Long

Remarks

The ID of a shape is unique only within the scope of the page or master.

If a shape, page, master, or style is deleted, future objects in the same scope may be assigned the same ID. Therefore, persisting shape or style IDs in separate data stores is generally not as sound as persisting unique IDs using the UniqueID property.

For Shape objects, you can use the ID property with methods such as GetResults and SetResults to get or set many cell values at once, possibly cells in many different shapes. To do this, you must pass shape IDs to the methods. If you create shapes by using the DropMany method, the method returns the IDs of the shapes it creates to your program.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShape.ID


Shape.Index Property (Visio)

 Copy code hover
[image]

Shape.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Shape object in the Shapes collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Shape object.

Return Value

Long

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Shape.IsCallout Property (Visio)

 Copy code hover
[image]

Shape.IsCallout Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether the shape is a callout shape. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .IsCallout

expression A variable that represents a Shape object.

Return Value

Boolean


Shape.IsDataGraphicCallout Property (Visio)

 Copy code hover
[image]

Shape.IsDataGraphicCallout Property (Visio)
Send feedback

Published: July 16, 2012

Specifes whether a shape is a data graphic callout. Read-only.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .IsDataGraphicCallout

expression An expression that returns a Shape object.

Return Value

Boolean

Remarks

If the parent shape is a data graphic callout, the IsDataGraphicCallout method returns True. If the shape is not a data graphic callout, the method returns False. Note that the method also returns False if the parent shape is a sub-shape of a shape that is a data graphic callout.


Shape.IsOpenForTextEdit Property (Visio)

 Copy code hover
[image]

Shape.IsOpenForTextEdit Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether a shape is currently open for interactive text editing. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .IsOpenForTextEdit

expression A variable that represents a Shape object.

Return Value

Boolean


Shape.Language Property (Visio)

 Copy code hover
[image]

Shape.Language Property (Visio)
Send feedback

Published: July 16, 2012

Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.

Version Information

Version Added: Visio 3.0

Syntax

expression .Language

expression A variable that represents a Shape object.

Return Value

Long

Remarks

The Language property returns the language ID recorded in the object's VERSIONINFO resource. The IDs returned are the standard IDs used by Microsoft Windows to encode different language versions. For example, the Language property returns &H0409 for the U.S. English version of Visio. For details, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Shape.Layer Property (Visio)

 Copy code hover
[image]

Shape.Layer Property (Visio)
Send feedback

Published: July 16, 2012

Returns the layer to which a shape is assigned. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Layer(Index)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Integer | The ordinal of the layer to get.

Return Value

Layer

Remarks

If a shape is assigned to three layers, the valid indexes that can be passed to its Layer property are 1 through 3.

To get the number of layers to which a shape is assigned, use the LayerCount property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Layer property to get a reference to a particular layer. It also uses the LayerCount property to determine the number of layers to which a shape is assigned and the Name property to get the name of the current layer.

VBA Copy code Copy code

Public Sub Layer_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoLayers As Visio.Layers
 Dim vsoLayer As Visio.Layer

 If ActiveDocument Is Nothing Then
 Documents.Add ("")
 End If

 Set vsoPage = ActivePage
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Get the Layers collection.
 Set vsoLayers = vsoPage.Layers

 'Create a layer named ExampleLayer1 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer1")
 vsoLayer.Add vsoShape, 1

 'Create a layer named ExampleLayer2 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer2")
 vsoLayer.Add vsoShape, 1

 'Verify that the shape has been assigned to 2 layers.
 Debug.Print "The rectangle is assigned to " & vsoShape.LayerCount & " layers."

 'Get a reference to the first layer.
 Set vsoLayer = vsoShape.Layer(1)

 'Verify by using the Name property.
 Debug.Print "Current vsoLayer name is """ & vsoLayer.Name & "."""

End Sub


Shape.LayerCount Property (Visio)

 Copy code hover
[image]

Shape.LayerCount Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of layers to which a shape is assigned. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .LayerCount

expression A variable that represents a Shape object.

Return Value

Integer

Remarks

A shape is assigned to zero or more layers.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the LayerCount property to determine the number of layers to which a shape is assigned. It also uses the Layers property to add a layer to a drawing and the Name property to get the name of the current layer.

VBA Copy code Copy code

Public Sub LayerCount_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoLayers As Visio.Layers
 Dim vsoLayer As Visio.Layer

 If ActiveDocument Is Nothing Then
 Documents.Add ("")
 End If

 Set vsoPage = ActivePage
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Get the Layers collection.
 Set vsoLayers = vsoPage.Layers

 'Create a layer named ExampleLayer1 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer1")
 vsoLayer.Add vsoShape, 1

 'Create a layer named ExampleLayer2 and add the shape to it.
 Set vsoLayer = vsoLayers.Add("ExampleLayer2")
 vsoLayer.Add vsoShape, 1

 'Verify that the shape has been assigned to 2 layers.
 Debug.Print "The shape is assigned to " & vsoShape.LayerCount & " layers."

 'Get a reference to the first layer.
 Set vsoLayer = vsoShape.Layer(1)

 'Verify by using the Name property.
 Debug.Print "Current layer name is """ & vsoLayer.Name & "."""

End Sub


Shape.LengthIU Property (Visio)

 Copy code hover
[image]

Shape.LengthIU Property (Visio)
Send feedback

Published: July 16, 2012

Returns the length (perimeter) of the shape in internal units. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .LengthIU(fIncludeSubShapes)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
fIncludeSubShapes | Optional | Boolean | False to exclude the length of subshapes. Length of subshapes is included by default.

Return Value

Double

Remarks

Data graphic callout shapes (and their sub-shapes) that are applied to the parent shape are excluded from length calculations. If the parent shape is itself a data graphic callout shape, its geometry (and that of its sub-shapes) is not excluded from length calculations.

In versions before Microsoft Office Visio 2003, this property took no arguments.


Shape.LineStyle Property (Visio)

 Copy code hover
[image]

Shape.LineStyle Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the line style for an object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .LineStyle

expression A variable that represents a Shape object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error. Setting one kind of style to an existing style of another kind (for example, setting the LineStyle property to a fill style) does nothing. Setting one kind of style to an existing style that has more than one set of attributes changes only the attributes for that component. For example, setting the LineStyle property to a style that has line, text, and fill attributes changes only the line attributes.

To preserve a shape's local formatting, use the LineStyleKeepFmt property.

Beginning with Microsoft Visio 2002, setting LineStyle to a zero-length string ("") will cause the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the LineStyle property to set the line style for a particular shape.

VBA Copy code Copy code

Public Sub LineStyle_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawLine(5, 4, 7.5, 1)
 vsoShape.LineStyle = "Guide"

End Sub


Shape.LineStyleKeepFmt Property (Visio)

 Copy code hover
[image]

Shape.LineStyleKeepFmt Property (Visio)
Send feedback

Published: July 16, 2012

Applies a line style to an object while preserving local formatting. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .LineStyleKeepFmt

expression A variable that represents a Shape object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error. Setting one kind of style to an existing style of another kind (for example, setting the LineStyleKeepFmt property to a fill style) does nothing. Setting one kind of style to an existing style that has more than one set of attributes changes only the attributes for that component (for example, setting the LineStyleKeepFmt property to a style that has line, text, and fill attributes changes only the line attributes).

Beginning with Microsoft Visio 2002, setting LineStyleKeepFmt to a zero-length string ("") will cause the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.


Shape.Master Property (Visio)

 Copy code hover
[image]

Shape.Master Property (Visio)
Send feedback

Published: July 16, 2012

Returns the master from which the Shape object was created. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Master

expression A variable that represents a Shape object.

Return Value

Master

Remarks

If the Shape object is not an instance of a master, its Master property returns Nothing.

If the Shape object is in a group, its Master property is the same as the group's Master property.


Shape.MasterShape Property (Visio)

 Copy code hover
[image]

Shape.MasterShape Property (Visio)
Send feedback

Published: July 16, 2012

If this shape is part of a master instance, returns the shape in the master that this shape inherits from. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .MasterShape

expression A variable that represents a Shape object.

Return Value

Shape

Remarks

Each shape in an instance of a master (the group and all its subshapes) points to its corresponding shape in the master. The MasterShape property returns the Shape object in the master from which the parent Shape object inherits.

If the parent Shape object is not part of a master instance, the MasterShape property returns Nothing.


Shape.MemberOfContainers Property (Visio)

 Copy code hover
[image]

Shape.MemberOfContainers Property (Visio)
Send feedback

Published: July 16, 2012

Returns an array of Long values that represent the identifiers of the container shapes that include the shape as a member. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .MemberOfContainers

expression A variable that represents a Shape object.

Return Value

Long()

Remarks

The MemberOfContainers property returns Nothing if the shape is not a member of any container.


Shape.Name Property (Visio)

 Copy code hover
[image]

Shape.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a Shape object.

Return Value

String

Remarks

A cell has both a local name and a universal name. The local name differs depending on the locale for which the running version of Microsoft Windows is installed. The universal name is the same regardless of what locale is installed. To get the universal name of a cell, use the Name property. To get the local name, use the LocalName property.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShape.Name


Shape.NameID Property (Visio)

 Copy code hover
[image]

Shape.NameID Property (Visio)
Send feedback

Published: July 16, 2012

Returns a unique name for a shape. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .NameID

expression A variable that represents a Shape object.

Return Value

String

Remarks

The NameID property returns a unique identifier for each shape on a page or master. The identifier has the following form: sheet.N, where N is the shape's ID property. The value of the NameID property is unique within a page or master, but not across pages or masters. At any moment, no other shape on the same page or master has the same NameID property. However, shapes on other pages or masters may have the same NameID property.

The value of a shape's UniqueID property is unique across pages and masters.

Also, NameID properties are reused. If a shape whose NameID property is sheet.N is deleted, a shape subsequently added to the same context may be assigned sheet.N as its NameID property. Therefore, persisting NameID properties in separate data stores is generally not as sound as persisting UniqueID properties.


Shape.NameU Property (Visio)

 Copy code hover
[image]

Shape.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of a Shape object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .NameU

expression A variable that represents a Shape object.

Return Value

String

Remarks

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Shape.Object Property (Visio)

 Copy code hover
[image]

Shape.Object Property (Visio)
Send feedback

Published: July 16, 2012

Returns an IDispatch interface on the ActiveX control or embedded or linked OLE 2.0 object represented by a Shape object or an OLEObject object. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .Object

expression A variable that represents a Shape object.

Return Value

Object

Remarks

The Object property raises an exception if the object doesn't represent an ActiveX control or an OLE 2.0 embedded or linked object. A shape represents an ActiveX control or an OLE 2.0 embedded or linked object if the visTypeIsOLE2 bit (&H8000) is set in the value returned by the ForeignType property.

If the Object property succeeds, it returns an IDispatch interface on the control or object. You owe an eventual release on the returned value (set it to Nothing or let it go out of scope if you're using Microsoft Visual Basic). You can determine the kind of object you've obtained an interface on by using the ClassID or ProgID property.

Beginning with Microsoft Visio 5.0, if the object returned by the Object property is embedded and the shape inherits the object from its master, the Object property severs the instance—that is, it copies the inherited data into the instance. Otherwise, if the client receiving the IDispatch interface from the Object property makes changes to the object, all instances of the master, not just the instance being queried, change. If the object returned by the Object property is linked, the Object property does not sever the instance because, by definition, there may be other entities referencing the link. The ObjectIsInherited property was added to Visio 5.0 so that client programs can know if a shape inherits its object and access the master's object(s).


Shape.ObjectIsInherited Property (Visio)

 Copy code hover
[image]

Shape.ObjectIsInherited Property (Visio)
Send feedback

Published: July 16, 2012

Indicates if a shape represents an ActiveX or OLE object that is inherited from the shape's master. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .ObjectIsInherited

expression A variable that represents a Shape object.

Return Value

Integer


Shape.ObjectType Property (Visio)

 Copy code hover
[image]

Shape.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Shape object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Shape.OneD Property (Visio)

 Copy code hover
[image]

Shape.OneD Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object behaves as a one-dimensional (1-D) object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .OneD

expression A variable that represents a Shape object.

Return Value

Integer

Remarks

Setting the OneD property is equivalent to changing a shape's interaction style in the Behavior dialog box (click Behavior in the Shape Design group of the Developer tab). Setting the OneD property for a 1-D shape to False deletes its 1-D Endpoints section, even if the cells in that section were protected with the GUARD function.

The OneD property of a Shape object that is a guide is always 0. If you try to change the value of the OneD property of a guide shape, no error is raised, but the value remains 0.

The OneD property of an object from another application is always False.


Shape.Parent Property (Visio)

 Copy code hover
[image]

Shape.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of a Shape object. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .Parent

expression A variable that represents a Shape object.

Return Value

Object

Remarks

In general, an object's parent is the object that contains it. If a Shape object is a member of a group, the parent is that group. Otherwise, its parent is a Page or a Master object.

When assigning a new parent shape, you must assign a Shape object. If you want to assign a page or master to be the parent of a shape, you must assign the Shape object returned by the Page or Master object's PageSheet property.

A shape and its parent shape must be in the same containing page or containing master. If the new parent is not a Shape object, or if the ContainingPage or ContainingMaster property of the parent shape is different from that of the shape, Microsoft Visio raises an exception.


Shape.Paths Property (Visio)

 Copy code hover
[image]

Shape.Paths Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Paths collection that reports the coordinates of a shape's paths in the coordinate system of the shape's parent. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .Paths

expression A variable that represents a Shape object.

Return Value

Paths

Example

This Microsoft Visual Basic for Applications (VBA) macro places a shape on the page, retrieves its Paths collection, and then uses the Points property of the Path object to return an array of points that defines a polyline approximating the Path object.

VBA Copy code Copy code

Public Sub Paths_Example()

 Dim vsoShape As Visio.Shape
 Dim adblXYPoints() As Double
 Dim strPointsList As String
 Dim intOuterLoopCounter As Integer
 Dim intInnerLoopCounter As Integer

 Set vsoShape = ActivePage.DrawOval(1, 1, 4, 4)

 For intOuterLoopCounter = 1 To vsoShape.Paths.Count

 vsoShape.Paths(intOuterLoopCounter).Points 1#, adblXYPoints
 For intInnerLoopCounter = LBound(adblXYPoints) To UBound(adblXYPoints)
 strPointsList = strPointsList & adblXYPoints(intInnerLoopCounter) & Chr(10)
 Next intInnerLoopCounter

 Next intOuterLoopCounter
 Debug.Print strPointsList

End Sub


Shape.PathsLocal Property (Visio)

 Copy code hover
[image]

Shape.PathsLocal Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Paths collection that reports the coordinates of a shape's paths in the shape's local coordinate system. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .PathsLocal

expression A variable that represents a Shape object.

Return Value

Paths


Shape.PersistsEvents Property (Visio)

 Copy code hover
[image]

Shape.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Shape object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Shape.Picture Property (Visio)

 Copy code hover
[image]

Shape.Picture Property (Visio)
Send feedback

Published: July 16, 2012

Returns a picture that represents an enhanced metafile (EMF) contained in a master, shape, selection, or page. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .Picture

expression A variable that represents a Shape object.

Return Value

IPictureDisp

Remarks

The Picture property returns only EMF files.

COM provides a standard implementation of a picture object that has the IPictureDisp interface on top of the underlying system picture support. The IPictureDisp interface exposes a picture object's properties and is implemented in the stdole type library as a StdPicture object creatable within Microsoft Visual Basic. The stdole type library is automatically referenced from all Visual Basic for Applications (VBA) projects in Microsoft Visio.

Currently, only in-process solutions can use the Picture property because the IPictureDisp interface cannot be marshaled.

To get information about the StdPicture object that supports the IPictureDisp interface

  1. In the Code group on the Developer tab, click Visual Basic.

  2. On the View menu, click Object Browser.

  3. In the Project/Library list, click stdole.

  4. Under Classes, examine the class named StdPicture.

For details about the IPictureDisp interface, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network.


Shape.ProgID Property (Visio)

 Copy code hover
[image]

Shape.ProgID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the programmatic identifier of a shape that represents an ActiveX control, an embedded object, or linked object. Read-only.

Version Information

Version Added: Visio 5.0

Syntax

expression .ProgID

expression A variable that represents a Shape object.

Return Value

String

Remarks

The ProgID property raises an exception if the shape doesn't represent an ActiveX control or OLE 2.0 embedded or linked object. A shape represents an ActiveX control, embedded object, or linked object if the ForeignType property returns visTypeIsOLE2 in the value.

Use the ProgID property of a Shape object or OLEObject to obtain the programmatic identifier of the object. Every OLE object class stores a programmatic identifier for itself in the registry. Typically this occurs when the program that services the object installs itself. Client programs use this identifier to identify the object. You are using the Microsoft Visio identifier when you execute a statement such as GetObject(,"Visio.Application") from a Microsoft Visual Basic program.

These are strings that the ProgID property might return:

Copy code Copy code

Visio.Drawing.5
MSGraph.Chart.5
Forms.CommandButton.1

After using a shape's Object property to obtain an IDispatch interface on the object the shape represents, you can obtain the shape's ClassID or ProgID property to determine the methods and properties provided by that interface.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the OLEObjects collection of an active page and print the ProgID for each OLEObject object in the Immediate window. This example assumes that the active page has at least one OLE 2.0 embedded or linked object or an ActiveX control.

VBA Copy code Copy code

Public Sub ProgID_Example()

 Dim intCounter As Integer
 Dim vsoOLEObjects As Visio.OLEObjects

 'Get the OLEObjects collection of the active page.
 Set vsoOLEObjects = ActivePage.OLEObjects

 'Step through the OLEObjects collection.
 For intCounter = 1 To vsoOLEObjects.Count
 Debug.Print vsoOLEObjects(intCounter).ProgID
 Next intCounter

End Sub


Shape.RootShape Property (Visio)

 Copy code hover
[image]

Shape.RootShape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the top-level shape of an instance if this shape is part of a master instance. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .RootShape

expression A variable that represents a Shape object.

Return Value

Shape

Remarks

If this shape is not part of a master instance, the RootShape property returns Nothing.


Shape.RowCount Property (Visio)

 Copy code hover
[image]

Shape.RowCount Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of rows in a ShapeSheet section. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .RowCount(Section)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The section whose rows to count.

Return Value

Integer

Remarks

The Section argument must be a section constant. For a list of section constants, see the AddSection method.

Use the RowCount property primarily with sections that contain a variable number of rows, such as Geometry and Connection Points sections. For sections that have a fixed number of rows, the RowCount property returns the number of rows in the section that possess at least one cell whose value is local to the shape, as opposed to rows whose cells are all inherited from a master or style. Inheriting from a master or style is usually better because Microsoft Office Visio does not need to store as much information. In the ShapeSheet window, cells with local values appear in blue, and cells with inherited values appear in black. You can use the IsInherited property to determine if a cell is inherited.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the RowCount property to find the number of ShapeSheet rows to iterate through.

To run this macro, open a blank drawing and the Computers and Monitors (US Units) stencil, and then insert a user form that contains a label, text box, and list box. Set the width of the list box to 150.

Note Note

The Computers and Monitors (US Units) stencil is available only in Microsoft Office Visio Professional.

VBA Copy code Copy code

Public Sub RowCount_Example()

 Dim vsoStencil As Visio.Document
 Dim vsoMaster As Visio.Master
 Dim vsoPages As Visio.Pages
 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim intRows As Integer
 Dim intCounter As Integer

 'Get the Pages collection for the document.
 'ThisDocument refers to the current document.
 Set vsoPages = ThisDocument.Pages

 'Get a reference to the first page of the Pages collection.
 Set vsoPage = vsoPages(1)

 'Get the Document object for the stencil.
 Set vsoStencil = Documents("COMPS_U.VSS")

 'Get the Master object for the desktop PC shape.
 Set vsoMaster = vsoStencil.Masters("PC")

 'Drop the shape in the approximate middle of the page.
 'Coordinates passed to the Drop method are always in inches.
 'The Drop method returns a reference to the new shape object.
 Set vsoShape = vsoPage.Drop(vsoMaster, 4.25, 5.5)

 'This example shows two methods of extracting custom
 'properties. The first method retrieves the value of a custom
 'property by name.
 'Note that Prop.Manufacturer implies Prop.Manufacturer.Value.
 Set vsoCell = vsoShape.Cells("Prop.Manufacturer")

 'Get the cell value as a string
 'and put it into the text box on the form.
 UserForm1.TextBox1.Text = vsoCell.ResultStr(Visio.visNone)

 'Set the caption of the label.
 UserForm1.Label1.Caption = "Prop.Manufacturer"

 'The second method of accessing custom properties uses
 'section, row, cell. This method is best when you want
 'to iterate through all the properties.
 intRows = vsoShape.RowCount(Visio.visSectionProp)

 'Make sure the list box is cleared.
 UserForm1.ListBox1.Clear

 'Loop through all the rows and add the value of Prop.Manufacturer
 'to the list box. Rows are numbered starting with 0.
 For intCounter = 0 To intRows - 1
 Set vsoCell = vsoShape.CellsSRC(Visio.visSectionProp, intCounter, visCustPropsValue)
 UserForm1.ListBox1.AddItem vsoCell.LocalName & vbTab & _
 vsoCell.ResultStr(Visio.visNone)
 Next intCounter

 'Display the user form.
 UserForm1.Show

End Sub


Shape.RowExists Property (Visio)

 Copy code hover
[image]

Shape.RowExists Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a ShapeSheet row exists. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .RowExists(Section, Row, fExistsLocally)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The row's section index.
Row | Required | Integer | The row's row index.
fExistsLocally | Required | Integer | The scope of the search.

Return Value

Integer

Remarks

If fExistsLocally is False (0), the RowExists property returns True if the object either contains or inherits the specified row.

If fExistsLocally is True (non-zero), the RowExists property returns True only if the object contains the specified row locally; if the row is inherited, the RowExists property returns False.

For a list of row index values, see the AddRow method or view the Visio type library for the members of the VisRowIndices enumeration. For a list of section index values, see the AddSection method or view the Visio type library for the members of the VisSectionIndices enumeration.


Shape.RowsCellCount Property (Visio)

 Copy code hover
[image]

Shape.RowsCellCount Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of cells in a row of a ShapeSheet section. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .RowsCellCount(Section, Row)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The index of the section that contains the row.
Row | Required | Integer | The index of the row to count.

Return Value

Integer

Remarks

Use section and row index constants declared by the Visio type library in members VisSectionIndices and VisRowIndices.


Shape.RowType Property (Visio)

 Copy code hover
[image]

Shape.RowType Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the type of a row in a Geometry, Connection Points, Controls, or Tabs ShapeSheet section. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .RowType(Section, Row)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The index of the section that contains the row.
Row | Required | Integer | The index of the row.

Return Value

Integer

Remarks

After you change a row's type, the new row type may or may not have the same cells. Your program must provide the appropriate formulas for the new or changed cells.

You can specify the type of row you want by setting RowType equal to any of the following constants declared by the Visio type library in member VisRowTags.

Constant | Value
visTagComponent | 137
visTagMoveTo | 138
visTagLineTo | 139
visTagArcTo | 140
visTagInfiniteLine | 141
visTagEllipse | 143
visTagEllipticalArcTo | 144
visTagSplineBeg | 165
visTagSplineSpan | 166
visTagPolylineTo | 193
visTagNURBSTo | 195
visTagTab0 | 136
visTagTab2 | 150
visTagTab10 | 151
visTagTab60 | 181
visTagCnnctPt | 153
visTagCnnctNamed | 185
visTagCtlPt | 162
visTagCtlPtTip | 170

If an inappropriate row tag is passed or the row does not exist, no changes occur and an error is returned.

Use the RowName property to transition from unnamed to named Connection Points rows.

See VisRowIndices for a list of valid row constants and VisRowTags for a list of valid row tag constants.

See VisSectionIndices for a list of valid section constants.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the RowType property to change the type of a ShapeSheet row. It draws a rectangle on a page and bows, or curves, the lines of the rectangle by changing the shape's lines to arcs. This is accomplished by changing the ShapeSheet row types for each side of the rectangle from LineTo to ArcTo and then changing the values of the X and Y cells in each of these rows.

VBA Copy code Copy code

Public Sub RowType_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim strBowCell As String
 Dim strBowFormula As String
 Dim intCounter As Integer

 'Set the value of the strBowCell string.
 strBowCell = "Scratch.X1"

 'Set the value of the strBowFormula string.
 strBowFormula = "=Min(Width, Height) / 5"
 Set vsoPage = ActivePage

 'If there isn't an active page, set vsoPage
 'to the first page of the active document.
 If vsoPage Is Nothing Then

 Set vsoPage = ActiveDocument.Pages(1)

 End If

 'Draw a rectangle on the active page.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section and add a row to the scratch section.
 vsoShape.AddSection visSectionScratch
 vsoShape.AddRow visSectionScratch, visRowScratch, 0

 'Set vsoCell to the Scratch.X1 cell and set its formula.
 Set vsoCell = vsoShape.Cells(strBowCell)
 vsoCell.formula = strBowFormula

 'Bow in or curve the rectangle's lines by changing
 'each row type from LineTo to ArcTo and entering the bow value.
 For intCounter = 1 To 4

 vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
 Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
 vsoCell.formula = "-" & strBowCell

 Next intCounter

End Sub


Shape.Section Property (Visio)

 Copy code hover
[image]

Shape.Section Property (Visio)
Send feedback

Published: July 16, 2012

Returns the requested Section object belonging to a shape. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Section(Index)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Integer | A section index.

Return Value

Section

Remarks

Constants that represent sections are prefixed with visSection and are declared by the Microsoft Visio type library in VisSectionIndices.


Shape.SectionExists Property (Visio)

 Copy code hover
[image]

Shape.SectionExists Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a ShapeSheet section exists for a particular shape. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .SectionExists(Section, fExistsLocally)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The section index.
fExistsLocally | Required | Integer | The scope of the search.

Return Value

Integer

Remarks

If fExistsLocally is False (0), the SectionExists property returns True if the object either contains or inherits the section. If fExistsLocally is True (non-zero), the SectionExists property returns True only if the object contains the section locally; if the section is inherited, the SectionExists property returns False.

Constants that represent sections are prefixed with visSection and are declared by the Microsoft Visio type library in VisSectionIndices.


Shape.Shapes Property (Visio)

 Copy code hover
[image]

Shape.Shapes Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shapes collection for a page, master, or group. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Shapes

expression An expression that returns a Shape object.

Return Value

Shapes


Shape.SpatialNeighbors Property (Visio)

 Copy code hover
[image]

Shape.SpatialNeighbors Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Selection object that represents the shapes that meet certain criteria in relation to a specified shape. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .SpatialNeighbors(Relation, Tolerance, Flags, ResultRoot)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Relation | Required | Integer | An integer describing the type of relationship to be used.
Tolerance | Required | Double | A distance in internal drawing units with respect to the coordinate space defined by the parent shape.
Flags | Required | Integer | Flags that influence the type of entries returned in results.
ResultRoot | Optional | Variant | A Shape object that represents a page or group.

Return Value

Selection

Remarks

For values of the Relation argument, see the SpatialRelation property topic.

The Flags argument can be any combination of the values of the constants defined in the following table. These constants are also defined in VisSpatialRelationFlags in the Visio type library.

Constant | Value | Description
visSpatialIncludeContainerShapes | &H80 | Include containers. By default, containers are not included.
visSpatialIncludeDataGraphics | &H40 | Includes data graphic callout shapes and their sub-shapes. By default, data graphic callout shapes and their subshapes are not included. If the parent shape is itself a data graphic callout, searches are made between the parent shape's geometry and non-callout shapes, unless this flag is set.
visSpatialIncludeGuides | &H2 | Considers a guide's Geometry section. By default, guides do not influence the result.
visSpatialFrontToBack | &H4 | Orders items front to back.
visSpatialBackToFront | &H8 | Orders items back to front.
visSpatialIncludeHidden | &H10 | Considers hidden Geometry sections. By default, hidden Geometry sections do not influence the result.
visSpatialIgnoreVisible | &H20 | Does not consider visible Geometry sections. By default, visible Geometry sections influence the result.

Use the NoShow cell to determine whether a Geometry section is hidden or visible. Hidden Geometry sections have a value of TRUE and visible Geometry sections have a value of FALSE in the NoShow cell.

If Relation is not specified, the SpatialNeighbors property uses all the possible relationships as criteria.

Beginning with Visio 2002, if Flags contains VisSpatialFrontToBack, items in the Selection object returned by the SpatialNeighbors property are ordered front to back. If visSpatialBackToFront is set, the items returned are ordered back to front. If this flag is not set, or if you are running an earlier version of Visio, the order is unpredictable. You can determine the order by using the Index property of the shapes identified in the Selection object.

If you don't specify ResultRoot, this property returns a Selection object that represents the shapes that meet certain criteria in relation to the specified shape. If you specify ResultRoot, this property returns a Selection object that represents all the shapes in the Shape object specified by ResultRoot that meet certain criteria in relation to the specified shape. For example, specify ResultRoot to find all shapes within a group that are near a specified shape.

If ResultRoot is specified but isn't on the same page or in the same master as the Shape object to which you are comparing it, the SpatialNeighbors property raises an exception and returns Nothing.

When it compares two shapes, the SpatialNeighbors property does not consider the width of a shape's line, shadows, line ends, control points, or connection points.

Example

This Microsoft Visual Basic for Applications (VBA) example shows how to use the SpatialNeighbors property in an event handler for the ShapeAdded event to determine if one shape is contained within another.

Before adding the following code to your VBA project, add at least one shape to your drawing. Then add another shape to your drawing, either by dragging it from a stencil or drawing it, positioning it so that it is completely contained within an existing shape.

VBA Copy code Copy code

Public Sub Document_ShapeAdded(ByVal Shape As IVShape)

 Dim vsoShapeOnPage As Visio.Shape
 Dim intTolerance As Integer
 Dim vsoReturnedSelection As Visio.Selection
 Dim strSpatialRelation As String
 Dim intSpatialRelation As VisSpatialRelationCodes

 On Error GoTo errHandler

 'Initialize string
 strSpatialRelation = ""

 'Set tolerance argument
 intTolerance = 0.25

 'Set Spatial Relation argument
 intSpatialRelation = visSpatialContainedIn

 'Get the set of spatially related shapes
 'that meet the criteria set by the arguments.
 Set vsoReturnedSelection = Shape.SpatialNeighbors _
 (intSpatialRelation, intTolerance, 0)

 'Evaluate the results.
 If vsoReturnedSelection.Count = 0 Then

 'No shapes met the criteria set by
 'the arguments of the method.
 strSpatialRelation = Shape.Name & " is not contained."

 Else

 'Build the positive result string.
 For Each vsoShapeOnPage In vsoReturnedSelection
 strSpatialRelation = strSpatialRelation & _
 Shape.Name & " is contained by " & _
 vsoShapeOnPage.Name & Chr$(10)

 Next

 End If

 'Display the results on the shape added.
 Shape.Text = strSpatialRelation

 errHandler:

End Sub


Shape.SpatialRelation Property (Visio)

 Copy code hover
[image]

Shape.SpatialRelation Property (Visio)
Send feedback

Published: July 16, 2012

Returns an integer that represents the spatial relationship of one shape to another shape. Both shapes must be on the same page or in the same master. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .SpatialRelation(OtherShape, Tolerance, Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
OtherShape | Required | [IVSHAPE] | The other Shape object involved in the comparison.
Tolerance | Required | Double | A distance in internal drawing units with respect to the coordinate space defined by the Shape object's parent.
Flags | Required | Integer | Flags that influence the result. See Remarks for the values of this argument.

Return Value

Integer

Remarks

  • The integer returned can be any combination of the values defined in VisSpatialRelationCodes in the Visio type library. The SpatialRelation property returns zero (0) if the two shapes being compared are not in any of the relationships discussed in the table in the VisSpatialRelationCodes topic.

  • The Flags argument can be any combination of the values of the constants defined in the following table. These constants are declared in VisSpatialRelationFlags in the Visio type library. Use the NoShow cell to determine whether a Geometry section is hidden or visible. Hidden Geometry sections have a value of TRUE and visible Geometry sections have a value of FALSE in the NoShow cell.

    Constant

    Value

    Description

    visSpatialIncludeContainerShapes

    &H80

    Include containers. By default, containers are not included.

    visSpatialIncludeDataGraphics

    &H40

    Includes data graphic callout shapes and their sub-shapes. By default, data graphic callout shapes and their subshapes are not included. If the parent shape is itself a data graphic callout, searches are made between the parent shape's geometry and non-callout shapes, unless this flag is set.

    visSpatialIncludeGuides

    &H2

    Considers a guide's Geometry section. By default, guides do not influence the result.

    visSpatialIncludeHidden

    &H10

    Reserved for future use. Do not use.

    visSpatialIgnoreVisible

    &H20

    Does not consider visible Geometry sections. By default, visible Geometry sections influence the result.

Note Note

When it compares two shapes, the SpatialRelation property does not consider the width of a shape's line, shadows, line ends, control points, or connection points.

Example

This Microsoft Visual Basic for Applications (VBA) example shows how to use the SpatialRelation property in an event handler for the ShapeAdded event to determine the spatial relationship between shapes.

Before adding the following code to your VBA project, make sure there is at least one shape on the drawing page. Then, after adding the code, add another shape to your drawing.

VBA Copy code Copy code
Public Sub Document_ShapeAdded(ByVal Shape As IVShape)

    Dim vsoShapeOnPage As Visio.Shape
    Dim intTolerance As Integer
    Dim intReturnValue As VisSpatialRelationCodes
    Dim intFlag As VisSpatialRelationFlags
    Dim strReturn As String
    On Error GoTo errHandler

    'Initialize tolerance argument.
    intTolerance = 0.25

    'Initialize flags argument.
    intFlag = visSpatialIncludeHidden
    For Each vsoShapeOnPage In ActivePage.Shapes

        'Get the spatial relationship.
        intReturnValue = Shape.SpatialRelation(vsoShapeOnPage, _
            intTolerance, intFlag)

        'Convert return code to string value.
        Select Case intReturnValue
            Case VisSpatialRelationCodes.visSpatialContain
                strReturn = "Contains"
            Case VisSpatialRelationCodes.visSpatialContainedIn
                strReturn = "is Contained in"
            Case VisSpatialRelationCodes.visSpatialOverlap
                strReturn = "overlaps"
            Case VisSpatialRelationCodes.visSpatialTouching
                strReturn = "is touching"
            Case Else
                strReturn = "has no relation with"
        End Select

        'Display relationship in the shape's text.
        vsoShapeOnPage.Text = Shape.Name & " " & strReturn & " " & _
            vsoShapeOnPage.Name

    Next

errHandler:

End Sub


Shape.SpatialSearch Property (Visio)

 Copy code hover
[image]

Shape.SpatialSearch Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Selection object whose shapes meet certain criteria in relation to a point that is expressed in the coordinate space of a page, master, or group. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .SpatialSearch(x, y, Relation, Tolerance, Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Double | The x-coordinate.
y | Required | Double | The y-coordinate.
Relation | Required | Integer | Any combination of the values of the constants visSpatialContainedIn and visSpatialTouching.
Tolerance | Required | Double | A distance in internal drawing units with respect to the coordinate space.
Flags | Required | Integer | Flags that influence the result.

Return Value

Selection

Remarks

  • The relation argument can be any combination of the constants defined in VisSpatialRelationCodes. If relation is not specified, the SpatialSearch property uses both relationships as criteria.

  • The flags argument can be any combination of the values of the constants defined in VisSpatialRelationFlags in the Visio type library (except visSpatialIncludeHidden, which is reserved for future use, and should not be used).

Use the NoShow cell to determine whether a Geometry section is hidden or visible. Hidden Geometry section sections have a value of TRUE and visible Geometry sections have a value of FALSE in the NoShow cell.

Beginning with Microsoft Visio 2002, if flags contains visSpatialFrontToBack, items in the Selection object returned by the SpatialNeighbors property are ordered front to back. If visSpatialBackToFront is set, the items returned are ordered back to front. If this flag is not set, or if you are running an earlier version of Visio, the order is unpredictable. You can determine the order by using the Index property of the shapes identified in the Selection object.

Note Note

When it compares two shapes, the SpatialSearch property does not consider the width of a shape's line, shadows, line ends, control points, or connection points.


Shape.Stat Property (Visio)

 Copy code hover
[image]

Shape.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Shape object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Shape.Style Property (Visio)

 Copy code hover
[image]

Shape.Style Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the style for a Shape object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Style

expression A variable that represents a Shape object.

Return Value

String

Remarks

If a style consists of different text, line, and fill styles, the Style property returns the fill style. If you set the Style property to a nonexistent style, your program generates an error.

To preserve local formatting, use the StyleKeepFmt property.

Beginning with Visio 2002, setting Style to an empty string ("") will cause the master's style to be reapplied to the shape. (Earlier versions generate a "no such style" exception.) If the shape has no master, its style remains unchanged.


Shape.StyleKeepFmt Property (Visio)

 Copy code hover
[image]

Shape.StyleKeepFmt Property (Visio)
Send feedback

Published: July 16, 2012

Applies a style to an object while preserving local formatting. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .StyleKeepFmt

expression A variable that represents a Shape object.

Return Value

String

Remarks

Beginning with Microsoft Visio 2002, setting StyleKeepFmt to an empty string ("") will cause the master's style to be reapplied to the shape. (Earlier versions generate a "no such style" exception.) If the shape has no master, its style remains unchanged.


Shape.Text Property (Visio)

 Copy code hover
[image]

Shape.Text Property (Visio)
Send feedback

Published: July 16, 2012

Returns all of the shape's text. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Text

expression A variable that represents a Shape object.

Return Value

String

Remarks

In the text returned by the Text property of a Shape object, fields are represented by an escape character (30 (&H1E)) For example, if a Shape object's text contains a field that displays the file name of a drawing, the Shape object's Text property returns an escape character where that field is inserted into the text. If you want the text to contain the expanded field, get the shape's Characters property, and then get the Text property of the resulting Characters object.

If the shape is a group, the text returned is dependent on the value of the IsTextEditTarget cell.

  • If IsTextEditTarget is TRUE, the Text property of the Shape object returns the text of the group.

  • If IsTextEditTarget is FALSE, the Text property of the Shape object returns the text of the shape in the group at the top of the stacking order.

Objects from other applications and guides do not have a Text property.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShape.Text

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the Text property of a shape.

VBA Copy code Copy code

Public Sub ShapeText_Example()

    Dim vsoRectangle As Visio.Shape
    Dim vsoOval As Visio.Shape
    Dim vsoShapeFromCell As Visio.Shape
    Dim vsoShapeFromCharacters As Visio.Shape
    Dim vsoCell As Visio.Cell
    Dim vsoCharacters As Visio.Characters

    'Create 2 different shapes and add different text to each shape.
    Set vsoRectangle = ActivePage.DrawRectangle(2, 3, 5, 4)
    Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
    vsoRectangle.Text = "Rectangle Shape"
    vsoOval.Text = "Oval Shape"

    'Get a Cell object from the first shape.
    Set vsoCell = vsoRectangle.Cells("Width")

    'Get a Characters object from the second shape.
    Set vsoCharacters = vsoOval.Characters

    'Use the Shape property to get the Shape object.
    Set vsoShapeFromCell = vsoCell.Shape
    Set vsoShapeFromCharacters = vsoCharacters.Shape

    'Use each shape's text to verify the proper Shape
    'object was returned.
    Debug.Print vsoShapeFromCell.Text
    Debug.Print vsoShapeFromCharacters.Text

End Sub


Shape.TextStyle Property (Visio)

 Copy code hover
[image]

Shape.TextStyle Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the text style for an object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .TextStyle

expression A variable that represents a Shape object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error. Setting one kind of style to an existing style of another kind (for example, setting the TextStyle property to a fill style) does nothing. Setting one kind of style to an existing style that has more than one set of attributes changes only the attributes for that component (for example, setting the TextStyle property to a style that has line, text, and fill attributes changes only the text attributes).

To preserve a shape's local formatting, use the TextStyleKeepFmt property.

Beginning with Visio 2002, setting TextStyle to an empty string ("") will cause the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.


Shape.TextStyleKeepFmt Property (Visio)

 Copy code hover
[image]

Shape.TextStyleKeepFmt Property (Visio)
Send feedback

Published: July 16, 2012

Applies a text style to an object while preserving local formatting. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .TextStyleKeepFmt

expression A variable that represents a Shape object.

Return Value

String

Remarks

Setting a style to a nonexistent style generates an error. Setting one kind of style to an existing style of another kind (for example, setting the TextStyleKeepFmt property to a fill style) does nothing. Setting one kind of style to an existing style that has more than one set of attributes changes only the attributes for that component (for example, setting the TextStyleKeepFmt property to a style that has line, text, and fill attributes changes only the text attributes).

Beginning with Visio 2002, setting TextStyleKeepFmt to an empty string ("") will cause the master's style to be reapplied to the selection or shape. (Earlier versions generate a "no such style" exception.) If the selection or shape has no master, its style remains unchanged.


Shape.Type Property (Visio)

 Copy code hover
[image]

Shape.Type Property (Visio)
Send feedback

Published: July 16, 2012

Returns the type of the object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Type

expression A variable that represents a Shape object.

Return Value

Integer

Remarks

Type value constants for Shape objects (the possible values that the Type property of a Shape object returns) are declared by the Visio type library in VisShapeTypes.

If a Shape object is type visTypeForeignObject, use the ForeignType property to determine the type of foreign object represented by the object.


Shape.UniqueID Property (Visio)

 Copy code hover
[image]

Shape.UniqueID Property (Visio)
Send feedback

Published: July 16, 2012

Gets, deletes, or makes the GUID that uniquely identifies the shape within the scope of the application. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .UniqueID(fUniqueID)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
fUniqueID | Required | Integer | Gets, deletes, or makes the unique ID of a Shape object. See Remarks for possible values.

Return Value

String

Remarks

Microsoft Visio identifies shapes by two different IDs: shape IDs and unique IDs. Shape IDs are numeric and uniquely identify shapes within the scope of an individual drawing page. They are not unique within a wider scope, however.

Unique IDs are GUIDs. They are unique within the scope of the application.

To convert between shape IDs and unique IDs, you can use two methods of the Page object, ShapeIDsToUniqueIDs and UniqueIDsToShapeIDs.

By default, a shape does not have a unique ID. A shape acquires a unique ID only if you set its UniqueID property.

If a Shape object has a unique ID, no other shape in any other document will have the same ID.

The fUniqueID parameter controls the behavior of the UniqueID property. It should have one of the following values declared in the Visio type library in VisUniqueIDArgs.

Constant | Value | Description
visGetGUID | 0 | Returns the unique ID string only if the shape already has a unique ID. Otherwise it returns a zero-length string ("").
visGetOrMakeGUID | 1 | Returns the unique ID string of the shape. If the shape does not yet have a unique ID, it assigns one to the shape and returns the new ID.
visDeleteGUID | 2 | Deletes the unique ID of a shape and returns a zero-length string ("").
visGetOrMakeGUIDWithUndo | 3 | Returns the unique ID string of the shape. If the shape does not already have a unique ID, assigns one to the shape and returns the new ID. Undoable.
visDeleteGUIDWithUndo | 4 | Clears the unique ID of a shape and returns a zero-length string (""). Undoable.

To get a shape if you know its unique ID, use Shapes.Item(UniqueIDString).

For example, you can use the following code:

VBA Copy code Copy code
Dim vsoShape As Visio.Shape
Set vsoShape = Visio.ActivePage.Shapes.Item("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

Alternatively, you can use the following code, which adds the letter "U" before the string to identify it as a unique ID:

VBA Copy code Copy code
Dim vsoShape As Visio.Shape
Set vsoShape = Visio.ActivePage.Shapes.Item("U{2287DC42-B167-11CE-88E9-0020AFDDD917}")


Shape Methods (Visio)

 Copy code hover
[image]

Shape Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddGuide | Adds a guide to a group shape.
AddHyperlink | Adds a Hyperlink object to a Microsoft Visio shape.
AddNamedRow | Adds a row that has the specified name to the specified ShapeSheet section.
AddRow | Adds a row to a ShapeSheet section at a specified position.
AddRows | Adds the specified number of rows to a ShapeSheet section at a specified position.
AddSection | Adds a new section to a ShapeSheet spreadsheet.
AddToContainers | Adds the shape to all underlying containers that allow it as a member.
AutoConnect | Automatically draws a connection in the specified direction between the shape and another shape on the drawing page.
BoundingBox | Returns a rectangle that tightly encloses a shape.
BreakLinkToData | Breaks the link between the shape and the data row to which it is linked in the specified data recordset.
BringForward | Brings the shape or selected shapes forward one position in the z-order.
BringToFront | Brings the shape or selected shapes to the front of the z-order.
CenterDrawing | Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .
ChangePicture | Replaces the specified shape's current picture with a new picture.
ConnectedShapes | Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape.
ConvertToGroup | Converts a selection or an object from another application (a linked or embedded object) to a group.
Copy | Copies a shape to the Clipboard.
CreateSelection | Creates various types of Selection objects.
CreateSubProcess | Creates and returns a new sub-process page that is linked to the shape.
Cut | Deletes an object or selection and places it on the Clipboard.
Delete | Deletes an object or selection.
DeleteEx | Deletes the additional shapes that are associated with the shape, such as connectors and unselected container members, when the shape is deleted.
DeleteRow | Deletes a row from a section in a ShapeSheet spreadsheet.
DeleteSection | Deletes a ShapeSheet section.
Disconnect | Unglues the specified connector end points and offsets them the specified amount from the shapes to which they were joined.
DrawArcByThreePoints | Creates a shape whose path consists of an arc defined by the three points passed as parameters.
DrawBezier | Creates a shape whose path is defined by the supplied sequence of Bezier control points.
DrawCircularArc | Creates a new shape whose path consists of a circular arc defined by its center, radius, and start and end angles.
DrawLine | Adds a line to the Shapes collection of a group shape.
DrawNURBS | Creates a new shape whose path consists of a single NURBS (nonuniform rational B-spline) segment.
DrawOval | Adds an oval (ellipse) to the Shapes collection of a group shape.
DrawPolyline | Creates a shape whose path is a polyline along a given set of points.
DrawQuarterArc | Creates a new shape whose path consists of an elliptical arc defined by the two points and the flag passed in as arguments.
DrawRectangle | Adds a rectangle to the Shapes collection of a page, master, or group.
DrawSpline | Creates a new shape whose path follows a given sequence of points.
Drop | Creates one or more new Shape objects by dropping an object onto a receiving object such as a master, drawing page, shape, or group.
DropMany | Creates one or more new Shape objects in a group. It returns an array of the IDs of the Shape objects it produces.
DropManyU | Creates one or more new Shape objects on a page, in a master, or in a group. It returns an array of the IDs of the Shape objects it produces.
Duplicate | Duplicates an object.
Export | Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.
FitCurve | Reduces the number of geometry segments in a shape or shapes by replacing them with similar spline, arc, and line segments that approximate the paths of the initial segments. Typically, this reduces the number of segments in the shape.
FlipHorizontal | Flips an object horizontally.
FlipVertical | Flips an object vertically.
GetCustomPropertiesLinkedToData | Gets the IDs of the shape-data-item (custom property) rows in the Shape Data section of the shape's ShapeSheet spreadsheet linked to the specified data recordset.
GetCustomPropertyLinkedColumn | Gets the name of the data column linked to the shape data (custom property) row in the shape's ShapeSheet spreadsheet specified by the custom property index.
GetFormulas | Returns the formulas of many cells.
GetFormulasU | Returns the formulas of many cells.
GetLinkedDataRecordsetIDs | Gets the IDs of all the data recordsets that contain data rows linked to the shape.
GetLinkedDataRow | Gets the ID of the data row in the specified data recordset linked to the shape.
GetResults | Gets the results or formulas of many cells.
GluedShapes | Returns an array that contains the identifiers of the shapes that are glued to a shape.
Group | Groups the objects that are selected in a selection, or it converts a shape into a group.
HasCategory | Returns True if the specified category is in the shape categories list.
HitTest | Determines if a given x,y position hits outside, inside, or on the boundary of a shape.
Import | Imports a file into the current document.
InsertFromFile | Adds a linked or embedded object to a page, master, or group.
InsertObject | Adds a new embedded object or ActiveX control to a page, master, or group.
IsCustomPropertyLinked | Returns whether the shape data (custom property) row in the Shape Data section of the shape's ShapeSheet spreadsheet is linked to a data row in the specified data recordset.
Layout | Lays out the shapes or reroutes the connectors (or both) for the page, master, group, or selection.
LinkToData | Links a shape to a data row in a data recordset.
MoveToSubprocess | Moves the shape to the specified page and drops a replacement shape on the source page, then links it to the target page. Returns the selection of moved shapes on the target page.
Offset | Offsets a shape a specified amount.
OpenDrawWindow | Opens a new drawing window that displays a group.
OpenSheetWindow | Opens a ShapeSheet window for a Shape object.
Paste | Pastes the contents of the Clipboard into an object.
PasteSpecial | Inserts the contents of the Clipboard, allowing you to control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Word document).
RemoveFromContainers | Removes the shape from all lists and containers of which it is a member.
ReplaceShape | Replaces the specified shape with an instance of the master passed as the first parameter, and returns the new shape.
Resize | Resizes the shape by moving shape handles as specified.
ReverseEnds | Reverses an object by flipping it both horizontally and vertically.
Rotate90 | Rotates an object 90 degrees counterclockwise.
SendBackward | Moves a shape or selected shapes back one position in the z-order.
SendToBack | Moves the shape or selected shapes to the back of the z-order.
SetBegin | Moves the begin point of a one-dimensional (1-D) shape to the coordinates represented by xPos and yPos.
SetCenter | Moves a shape so that its pin is positioned at the coordinates represented by xPos and yPos. .
SetEnd | Moves the endpoint of a one-dimensional (1-D) shape to the coordinates represented by xPos and yPos.
SetFormulas | Sets the formulas of one or more cells.
SetQuickStyle | Sets the quick style of the specified shape.
SetResults | Sets the results or formulas of one or more cells.
SwapEnds | Swaps the begin and endpoints of a one-dimensional (1-D) shape.
TransformXYFrom | Transforms a point expressed in the local coordinate system of one Shape object from an equivalent point expressed in the local coordinate system of another Shape object.
TransformXYTo | Transforms a point expressed in the local coordinate system of one Shape object to an equivalent point expressed in the local coordinate system of another Shape object.
Ungroup | Ungroups a group.
UpdateAlignmentBox | Updates the alignment box for a shape.
VisualBoundingBox |
XYFromPage | Transforms a point expressed in the local coordinate system of its Page or Master object to an equivalent point expressed in the local coordinate system of the Shape object.
XYToPage | Transforms a point expressed in the local coordinate system of a Shape object to an equivalent point expressed in the local coordinate system of its Page or Master object.


Shape.AddGuide Method (Visio)

 Copy code hover
[image]

Shape.AddGuide Method (Visio)
Send feedback

Published: July 16, 2012

Adds a guide to a group shape.

Version Information

Version Added: Visio 2.0

Syntax

expression .AddGuide(Type, xPos, yPos)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | Integer | The type of guide to add.
xPos | Required | Double | The x-coordinate of a point on the guide.
yPos | Required | Double | The y-coordinate of a point on the guide.

Return Value

Shape

Remarks

You can add a guide only to a group shape.

To view guides that you add to a group shape by using the AddGuide method, use the OpenDrawWindow method to open the Group Editing window.

The following constants declared by the Visio type library are valid values for guide types.

Constant | Value | Description
visPoint | 1 | Guide point
visHorz | 2 | Horizontal guide
visVert | 3 | Vertical guide


Shape.AddHyperlink Method (Visio)

 Copy code hover
[image]

Shape.AddHyperlink Method (Visio)
Send feedback

Published: July 16, 2012

Adds a Hyperlink object to a Microsoft Visio shape.

Version Information

Version Added: Visio 5.0

Syntax

expression .AddHyperlink

expression A variable that represents a Shape object.

Return Value

Hyperlink

Remarks

Using the AddHyperlink method is equivalent to adding a hyperlink to a shape by clicking Hyperlink on the Insert tab.

If a Hyperlink object already exists for the shape, the method returns a reference to the existing Hyperlink object.

Example

This example shows how to use the AddHyperlink method to add a hyperlink to a shape. It also shows how to trap errors that arise when you try to access nonexistent hyperlinks. It first attempts to access a hyperlink that does not exist, thereby throwing an error. Then it adds the hyperlink, and when it attempts to access the hyperlink a second time, no error is thrown. Before running this example, replace address with a valid Internet or intranet address.

VBA Copy code Copy code

Sub AddHyperlink_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoHyperlink As Visio.Hyperlink
 Dim blsCaught As Boolean

 'Draw a rectangle shape on the active page.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'A shape that has no hyperlink should raise an exception
 'when the Hyperlink property is accessed.
 On Error GoTo lblCatch

 blsCaught = False
 Set vsoHyperlink = vsoShape.Hyperlink

 If Not blsCaught Then
 Debug.Print "ERROR - Hyperlink didn't throw an exception!"
 End If

 'Add a hyperlink to a shape.
 Set vsoHyperlink = vsoShape.AddHyperlink

 'Return an absolute address.
 vsoHyperlink.Address = "address"

 Exit Sub

 lblCatch:
 Debug.Print "Error was thrown : " & Err.Description
 blsCaught = True
 Resume Next
End Sub


Shape.AddNamedRow Method (Visio)

 Copy code hover
[image]

Shape.AddNamedRow Method (Visio)
Send feedback

Published: July 16, 2012

Adds a row that has the specified name to the specified ShapeSheet section.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddNamedRow(Section, RowName, RowTag)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The section in which the row is to be added.
RowName | Required | String | The name of the new row.
RowTag | Required | Integer | The type of row to be added.

Return Value

Integer

Remarks

You can add named rows to the Actions (visSectionAction), Controls (visSectionControls), Shape Data (visSectionProp), User-Defined Cells (visSectionUser), Hyperlinks (visSectionHyperlink), and Connection Points (visSectionConnectionPts) ShapeSheet sections. You can access cells in the new rows by passing the row number returned by the AddNamedRow method to the CellsSRC property. Alternatively, you can access cells in the new rows by using the row's name with the Cells property. For details about cell references and cells in named rows, see the Actions, Controls, User-defined Cells, Hyperlink, Shape Data, or Connection Points row topics in the Microsoft Visio ShapeSheet Reference.

An empty row name string ("") creates a row with a default name.

Passing a value of visTagDefault (0) in the RowTag argument generates the default row type for the section. Explicit tags are useful when adding rows to a Connection Points section. See the RowType property for descriptions of valid row types for each section. Passing an invalid row type generates an error.

Adding a named row to a Connection Points section automatically converts any existing unnamed rows in the section into named rows, assigning them default names (Row_1, Row_2, and so on).


Shape.AddRow Method (Visio)

 Copy code hover
[image]

Shape.AddRow Method (Visio)
Send feedback

Published: July 16, 2012

Adds a row to a ShapeSheet section at a specified position.

Version Information

Version Added: Visio 2.0

Syntax

expression .AddRow(Section, Row, RowTag)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The section in which to add the row.
Row | Required | Integer | The position at which to add the row.
RowTag | Required | Integer | The type of row to add.

Return Value

Integer

Remarks

If the ShapeSheet section does not already exist, it is created with a blank row. New cells in new rows are initialized with default formulas, if applicable. Otherwise, a program must include statements to set the formulas for the new cells. If the new row cannot be added, an error is generated.

The Visio type library declares row constants prefixed with visRow in VisRowIndices.

Constants for rows in the Geometry, Connection Points, and Controls sections are prefixed with visTag and declared by the type library in VisRowTags. To see a list of these constants, see the RowType property.

The row constants declared by the Visio type library serve as base positions at which a section's rows begin. Add offsets to these constants to specify the first row and beyond, for example, visRowFirst+0, visRowFirst+1, and so on. To add rows at the end of a section, pass the constant visRowLast for the Row argument. The value returned is the actual row index.

The RowTag argument specifies the type of row to add. To generate a section's default row type, pass visTagDefault (0) as the RowTag argument. Explicit tags are useful when adding rows to Geometry, Connection Points, and Controls sections. See the RowType property for descriptions of valid row types for these sections. Passing an invalid row type generates an error.

If you try to add a row to a Character, Tabs, or Paragraph section, an error occurs.

The AddRow method cannot add named rows. To add named rows, use the AddNamedRow method.

If you add rows to a section that has nameable rows (for example, the Connection Points or Controls section), the Row argument is ignored. By default, named rows are named in the order added, for example, Row_1, Row_2, and so forth. Naming order is influenced, however, by any existing rows or previously deleted rows.

Example

The following example shows how to add a section to a ShapeSheet and how to add a row to the section at a specified position.

VBA Copy code Copy code

Public Sub AddRow_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape

 'Get the active page.
 Set vsoPage = ActivePage

 'If there isn't an active page, set the Page object
 'to the first page of the active document.
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle on the active page.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section to the ShapeSheet.
 vsoShape.AddSection visSectionScratch

 'Add a row to the scratch section.
 vsoShape.AddRow visSectionScratch, visRowScratch, 0

End Sub


Shape.AddRows Method (Visio)

 Copy code hover
[image]

Shape.AddRows Method (Visio)
Send feedback

Published: July 16, 2012

Adds the specified number of rows to a ShapeSheet section at a specified position.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddRows(Section, Row, RowTag, RowCount)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The section in which to add the rows.
Row | Required | Integer | The position at which to add the rows.
RowTag | Required | Integer | The type of rows to add.
RowCount | Required | Integer | The number of rows to add.

Return Value

Integer

Remarks

If the ShapeSheet section does not exist, the AddRows method creates a section that has blank rows. New cells in new rows are initialized with default formulas, if applicable. Otherwise, a program must include statements to set the formulas for the new cells. An error occurs if the row cannot be added.

The Visio type library declares the constants for RowTag in VisRowIndices.

The row constants declared by the Visio type library serve as base positions at which a section's rows begin. Add offsets to these constants to specify the first row and beyond, for example, visRowFirst+0, visRowFirst+1, and so on. To add rows at the end of a section, pass the constant visRowLast for the Row argument. The value returned is the actual row index.

The RowTag argument specifies the type of rows to add. Pass visTagDefault (0) as the RowTag argument to generate a section's default row type. Explicit tags are useful when adding rows to Geometry, Connection Points, and Controls sections. See the RowType property for descriptions of valid row types for these sections. Passing an invalid row type generates an error.

If you try to add rows to a Character, Tabs, or Paragraph section, an error occurs.

The AddRows method cannot add named rows. To add named rows, use the AddNamedRow method.

If you add rows to a section that has nameable rows (for example, the Connection Points or Controls section), the Row argument is ignored. By default, named rows are named in the order added, for example, Row_1, Row_2, and so forth. Naming order is influenced, however, by any existing rows or previously deleted rows.


Shape.AddSection Method (Visio)

 Copy code hover
[image]

Shape.AddSection Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new section to a ShapeSheet spreadsheet.

Version Information

Version Added: Visio 2.0

Syntax

expression .AddSection(Section)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The type of section to add.

Return Value

Integer

Remarks

The AddSection method is frequently used to add one or more Geometry sections to a shape. You can also use AddSection to add other sections to a shape such as Scratch, Controls, Connection Points, Actions, User-Defined Cells and ShapeData. The AddSection method returns the logical index of the added section.

The sections that you can add to a shape correspond to the choices shown by the Insert Section dialog box when the shape is displayed in a ShapeSheet window.

If you try to add a non-Geometry section to a shape that already has that section, the AddSection method raises an exception. Use the SectionExists property to determine if a shape already has a section with a given logical index.

A new section has no rows. Use the AddRow method to add rows to the new section.

The GeometryCount property returns the number of Geometry sections included in a shape. Use the following code to add a Geometry section to a shape:

VBA Copy code Copy code
Shape.AddSection(visSectionFirstComponent + i)

where 0 <= i < visSectionLastComponent - visSectionFirstComponent .

  • When 0 <= i < Shape.GeometryCount, the new section precedes the present i'th Geometry section.

  • When Shape.GeometryCount <= i < visSectionLastComponent - visSectionFirstComponent , the new section is the last section.

Example

The following macro shows how to add a Scratch section to the ShapeSheet of a rectangle. Before running this macro, make sure a drawing page is active in the Visio window.

VBA Copy code Copy code

Public Sub AddSection_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape

 'Get the active page.
 Set vsoPage = ActivePage

 'Draw a rectangle on the active page.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section to the ShapeSheet.
 vsoShape.AddSection visSectionScratch

End Sub


Shape.AddToContainers Method (Visio)

 Copy code hover
[image]

Shape.AddToContainers Method (Visio)
Send feedback

Published: July 16, 2012

Adds the shape to all underlying containers that allow it as a member.

Version Information

Version Added: Visio 2010

Syntax

expression .AddToContainers

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

When you call the AddToContainers method, Microsoft Visio uses the setting of the ContainerProperties.ResizeAsNeeded property for each container to determine how the container resizes.

If the underlying container is a list, the shape is added as a normal container member, and not as a list member.

The AddToContainers method works only if the shape sits at least partially on top of a container that does not already contain it.


Shape.AutoConnect Method (Visio)

 Copy code hover
[image]

Shape.AutoConnect Method (Visio)
Send feedback

Published: July 16, 2012

Automatically draws a connection in the specified direction between the shape and another shape on the drawing page.

Version Information

Version Added: Visio 2007

Syntax

expression .AutoConnect(ToShape, PlacementDir, Connector)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
ToShape | Required | [IVSHAPE] | The shape to draw the connection to.
PlacementDir | Required | VisAutoConnectDir | The direction in which to draw the connection. See Remarks for possible values.
Connector | Optional | [UNKNOWN] | The connector to use.

Return Value

Nothing

Remarks

The AutoConnect method lets you automatically draw connections between shapes on the drawing page while specifying the direction of the connection and, optionally, the connector.

For the ToShape parameter, pass the Shape object to which you want to draw the connection.

For the PlacementDir parameter, pass a value from the VisAutoConnectDir enumeration to specify the connection direction—that is, where to locate the connected shape with respect to the primary shape. Possible values for PlacementDir are as follows.

Constant | Value | Description
visAutoConnectDirDown | 2 | Connect down.
visAutoConnectDirLeft | 3 | Connect to the left.
visAutoConnectDirNone | 0 | Connect without relocating the shapes.
visAutoConnectDirRight | 4 | Connect to the right
visAutoConnectDirUp | 1 | Connect up.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShape.AutoConnect(Microsoft.Office.Interop.Visio.Shape, Microsoft.Office.Interop.Visio.VisAutoConnectDir, object)

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AutoConnect method to draw a connection between two flowchart shapes, a decision shape and a process shape, by using a third shape, a dynamic connector, all of which were added to an empty drawing page from the Basic Flowchart Shapes (US Units) stencil.

Because the example calls the method on the decision shape, Visio draws the connector from the decision shape to the process shape. Because we pass the method the enumerated value visAutoConnectDirRight for the PlacementDir parameter, Visio places the process shape automatically to the right of the decision shape on the drawing page, regardless of its previous location.

VBA Copy code Copy code
Public Sub AutoConnect_Example()

    Dim vsoShape1 As Visio.Shape
    Dim vsoShape2 As Visio.Shape
    Dim vsoConnectorShape As Visio.Shape

    Set vsoShape1 = Visio.ActivePage.Shapes("Decision")
    Set vsoShape2 = Visio.ActivePage.Shapes("Process")
    Set vsoConnectorShape = Visio.ActivePage.Shapes("Dynamic connector")

    vsoShape1.AutoConnect vsoShape2, visAutoConnectDirRight, vsoConnectorShape

End Sub


Shape.BoundingBox Method (Visio)

 Copy code hover
[image]

Shape.BoundingBox Method (Visio)
Send feedback

Published: July 16, 2012

Returns a rectangle that tightly encloses a shape.

Version Information

Version Added: Visio 4.5

Syntax

expression .BoundingBox(Flags, lpr8Left, lpr8Bottom, lpr8Right, lpr8Top)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Required | Integer | Flags that influence the bounding box calculated for each shape that contributes to the resulting bounding box.
lpr8Left | Required | Double | Returns the x-coordinate of the left edge of the bounding box.
lpr8Bottom | Required | Double | Returns the y-coordinate of the bottom edge of the bounding box.
lpr8Right | Required | Double | Returns the x-coordinate of the right edge of the bounding box.
lpr8Top | Required | Double | Returns the y-coordinate of the top edge of the bounding box.

Return Value

Nothing

Remarks

For a Shape object, the BoundingBox method returns a rectangle that tightly encloses the shape and its subshapes.

For a Page, Master, or Selection object, the BoundingBox method returns a rectangle that tightly encloses the page's, master's, or selection's shapes and their subshapes.

If the BoundingBox method returns an error, or if it is asked to return the rectangle enclosing zero shapes, the rectangle returned is { left: 0, bottom: 0, right: -1, top: -1 }; otherwise, the rectangle returned has left less than or equal to (<=) right, and bottom less than or equal to (<=) top. The numbers returned are in internal units (inches).

The bounding rectangle returned for an individual shape depends on its Type property.

Constant | Description
visTypePage | Equivalent to Page.BoundingBox or Master.BoundingBox.
visTypeGroup | Rectangle that tightly encloses the group and its subshapes.
visTypeShape | Determined rectangle depends on flags. See the following table.
visTypeForeignObject | Determined rectangle depends on flags. See the following table.
visTypeGuide | Determined rectangle depends on flags. See the following table.

The method will raise an exception for object type visTypeDoc.

The Flags argument has several bits that control the bounding box retrieved for each shape. If more than one of the bits described in the following table is set, the rectangle determined for the shape covers all rectangles implied by the bits.

Flag | Value | Description
visBBoxUprightWH | &H1 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the shape's width-height box.If the shape is not rotated, its upright width-height box and its width-height box are the same. Paths in the shape's geometry need not and often do not lie entirely within the shape's width-height box.
visBBoxUprightText | &H2 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the shape's text.
visBBoxExtents | &H4 | Returns a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the paths stroked by the shape's geometry.This may be larger or smaller than the shape's upright width-height box. The extents box determined for a shape of type visTypeForeignObject equals that shape's upright width-height box.
visBBoxIncludeHidden | &H10 | Includes hidden geometry.
visBBoxIgnoreVisible | &H20 | Ignores visible geometry.
visBBoxIncludeDataGraphics | &H10000 | Includes data-graphic callout shapes (and their sub-shapes) that are applied to the shape. Off by default.
visBBoxIncludeGuides | &H1000 | Includes extents for shapes of type visTypeguide. By default, the extents of shapes of type visTypeGuide are ignored.If you request guide extents, then only the x positions of vertical guides and the y positions of horizontal guides contribute to the rectangle that is returned. If any vertical guides are reported on, an infinite y extent is returned. If any horizontal guides are reported on, an infinite x extent is returned. If any rotated guides are reported on, infinite x and y extents are returned.
visBBoxDrawingCoords | &H2000 | Returns numbers in the drawing coordinate system of the page or master whose shapes are being considered. By default, the returned numbers are drawing units in the local coordinate system of the parent of the considered shapes.
visBBoxNoNonPrint | &H4000 | Ignores the extents of shapes that are nonprinting. A shape is nonprinting if the value of its NonPrinting cell is non-zero or it belongs only to nonprinting layers.

The extents rectangle is determined using the center of the shape's strokes; it does not take into account the width of the strokes. Nor does the rectangle include any area covered by shadows or line end markers. Microsoft Visio does not expose a means to determine a shape's "black bits" box, that is, the extents box adjusted to account for stroke widths, shadows, and line ends.

A shape may have control points or connection points that lie outside any of the bounding rectangles reported by the shape. You can determine the position of control points and connection points by querying results of the shape's cells.

Example

The following procedure prints the dimensions of the bounding box of the selected shape in the Immediate window. If more than one shape is selected in the active window, a message box indicating an error is displayed. In all cases, results are reported in the drawing units of the page or master to which the shape belongs. This means that if the shape is a subshape of a group, visBBoxDrawingCoords is passed as a flag to the BoundingBox method.

If the shape is a guide, the procedure passes visBBoxIncludeGuides to the BoundingBox method so that the shape will be considered to have extent. Three rectangles are reported for the shape:

  • visBBoxUprightWH: an upright box that encloses the shape's width-height box

  • visBBoxUprightText: an upright box that encloses the shape's text box

  • visBBoxExtents: an upright box that encloses the shape's paths

To run this macro, make sure exactly one shape is selected on the Visio drawing page.

VBA Copy code Copy code

Public Sub BoundingBox_Example()

 Dim vsoSelection As Visio.Selection
 Set vsoSelection = ActiveWindow.Selection
 vsoSelection.IterationMode = visSelModeSkipSub

 If vsoSelection.Count <> 1 Then
 MsgBox "BoundingBox_Example() expects exactly one selected shape."

 Else

 Dim vsoShape As Visio.Shape
 Set vsoShape = vsoSelection(1)
 Dim intFlags As Integer
 intFlags = 0

 If vsoShape.ContainingShape.Type = visTypeGroup Then

 intFlags = visBBoxDrawingCoords

 End If

 If vsoShape.Type = visTypeGuide Then

 intFlags = intFlags + visBBoxIncludeGuides

 End If

 Dim dblTop As Double
 Dim dblBottom As Double
 Dim dblLeft As Double
 Dim dblRight As Double

 vsoShape.BoundingBox intFlags + visBBoxUprightWH, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Upright WH "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 vsoShape.BoundingBox intFlags + visBBoxUprightText, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Upright text "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 vsoShape.BoundingBox intFlags + visBBoxExtents, dblLeft, dblBottom, dblRight, dblTop
 Debug.Print "Bounding Box "; _
 "dblLeft:" & Application.FormatResult(dblLeft, "in", "", "#0.00 u"); _
 "dblBottom:" & Application.FormatResult(dblBottom, "in", "", "#0.00 u"); _
 "dblRight:" & Application.FormatResult(dblRight, "in", "", "#0.00 u"); _
 "dblTop:" & Application.FormatResult(dblTop, "in", "", "#0.00 u")

 End If

End Sub

The following macro uses the BoundingBox method and the ShapesOverlap() function to determine if one shape (vsoShape2) overlaps another (vsoShape1).

VBA Copy code Copy code
Public Sub OverlappingShapes_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim blsIsOverlapping As Boolean

 Set vsoShape1 = Application.ActiveWindow.Page.Drop(Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Square"), 3, 9)

 Set vsoShape2 = Application.ActiveWindow.Page.Drop(Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3, 8)

 blsIsOverlapping = ShapesOverlap(vsoShape2, vsoShape1)

 If blsIsOverlapping Then
 Debug.Print "Shapes overlap."
 Else
 Debug.Print "Shapes do not overlap."
 End If

End Sub

Private Function ShapesOverlap(vsoShape1 As IVShape, vsoShape2 As IVShape) As Boolean

 Dim dblLeft1 As Double
 Dim dblLeft2 As Double
 Dim dblBottom1 As Double
 Dim dblBottom2 As Double
 Dim dblRight1 As Double
 Dim dblRight2 As Double
 Dim dblTop1 As Double
 Dim dblTop2 As Double

 vsoShape1.BoundingBox Flags + visBBoxExtents, dblLeft1, dblBottom1, dblRight1, dblTop1
 vsoShape2.BoundingBox Flags + visBBoxExtents, dblLeft2, dblBottom2, dblRight2, dblTop2

 If ((dblLeft2 >= dblLeft1 And dblLeft2 <= dblRight1) Or _
 (dblRight2 >= dblLeft1 And dblRight2 <= dblRight1)) And _
 ((dblTop2 >= dblBottom1 And dblTop2 <= dblTop1) Or _
 (dblBottom2 >= dblBottom1 And dblBottom2 <= dblTop1)) Then
 ShapesOverlap = True
 Else
 ShapesOverlap = False
 End If

End Function


Shape.BreakLinkToData Method (Visio)

 Copy code hover
[image]

Shape.BreakLinkToData Method (Visio)
Send feedback

Published: July 16, 2012

Breaks the link between the shape and the data row to which it is linked in the specified data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .BreakLinkToData(DataRecordsetID)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row the shape is linked to.

Return Value

Nothing

Remarks

Breaking the link between an shape and a data row does not remove shape data (called custom properties in some previous versions of Visio) from the shape, nor does it remove any data graphics associated with the shape.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the BreakLinkToData method to break the link between a shape and a data row in a data recordset.

Before running this macro, place a shape on the page, add at least one data recordset to the DataRecordsets collection of the document, and use any linking method to link the shape to a data row in the data recordset you most recently added to the collection. Alternatively, you could link the shape to a data row by dragging the row from the External Data window onto the shape in the Visio user interface. Then select the linked shape.

VBA Copy code Copy code
Public Sub BreakLinkToData_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim vsoShape As Visio.Shape
    Dim intCount As Integer

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount)

    Set vsoShape = ActiveWindow.Selection.PrimaryItem
    vsoShape.BreakLinkToData (vsoDataRecordset.ID)

End Sub


Shape.BringForward Method (Visio)

 Copy code hover
[image]

Shape.BringForward Method (Visio)
Send feedback

Published: July 16, 2012

Brings the shape or selected shapes forward one position in the z-order.

Version Information

Version Added: Visio 2.0

Syntax

expression .BringForward

expression A variable that represents a Shape object.

Return Value

Nothing

Example

The following macro shows how to bring a shape forward in the z-order on a page.

VBA Copy code Copy code

Public Sub BringForward_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape

 'Draw three rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 1, 4, 4)
 vsoShape1.Text = "1"
 Set vsoShape2 = ActivePage.DrawRectangle(2, 2, 5, 5)
 vsoShape2.Text = "2"
 Set vsoShape3 = ActivePage.DrawRectangle(3, 3, 6, 6)
 vsoShape3.Text = "3"

 'Bring vsoShape1 forward one position in the z-order.
 vsoShape1.BringForward

End Sub


Shape.BringToFront Method (Visio)

 Copy code hover
[image]

Shape.BringToFront Method (Visio)
Send feedback

Published: July 16, 2012

Brings the shape or selected shapes to the front of the z-order.

Version Information

Version Added: Visio 2.0

Syntax

expression .BringToFront

expression A variable that represents a Shape object.

Return Value

Nothing

Example

The following macro shows how to bring a shape to the front of the z-order on a page.

VBA Copy code Copy code
Public Sub BringToFront_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape

 'Draw three rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 1, 4, 4)
 vsoShape1.Text = "1"
 Set vsoShape2 = ActivePage.DrawRectangle(2, 2, 5, 5)
 vsoShape2.Text = "2"
 Set vsoShape3 = ActivePage.DrawRectangle(3, 3, 6, 6)
 vsoShape3.Text = "3"

 'Bring vsoShape1 to the front of the z-order.
 vsoShape1.BringToFront

End Sub


Shape.CenterDrawing Method (Visio)

 Copy code hover
[image]

Shape.CenterDrawing Method (Visio)
Send feedback

Published: July 16, 2012

Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .

Version Information

Version Added: Visio 4.0

Syntax

expression .CenterDrawing

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

Centering shapes does not change their position relative to each other.


Shape.ChangePicture Method (Visio)

 Copy code hover
[image]

Shape.ChangePicture Method (Visio)
Send feedback

Published: July 16, 2012

Replaces the specified shape's current picture with a new picture.

Syntax

expression .ChangePicture(FileName,ChangePictureFlags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data type | Description
FileName | Required | STRING | Specifies the full path of the replacement picture.
ChangePictureFlags | Optional | INT32 | Reserved for future implementation. Has no effect.

Return value

DOUBLE

Remarks

The DOUBLE returned represents the ratio of the picture's width to its height.


Shape.ConnectedShapes Method (Visio)

 Copy code hover
[image]

Shape.ConnectedShapes Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape.

Version Information

Version Added: Visio 2010

Syntax

expression .ConnectedShapes(Flags, CategoryFilter)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Required | VisConnectedShapesFlags | Filters the array of returned shape IDs by the directionality of the connectors. See Remarks for possible values.
CategoryFilter | Required | String | Filters the array of returned shape IDs by limiting it to the IDs of shapes that match the specified category.

Return Value

Long()

Remarks

The Flags value must be one of the following VisConnectedShapesFlags constants.

Constant | Value | Description
visConnectedShapesAllNodes | 0 | Return IDs of shapes that are associated with both incoming and outgoing connections.
visConnectedShapesIncomingNodes | 1 | Return IDs of shapes that are associated with incoming connections.
visConnectedShapesOutgoingNodes | 2 | Return IDs of shapes that are associated with outgoing connections.

Categories are user-defined strings that you can use to categorize shapes and thereby to restrict membership in a container. You can define categories in the User.msvShapeCategories cell in the ShapeSheet for a shape. You can define multiple categories for a shape by separating the categories with semi-colons.

If the source object is a 1-D shape or part of a master, the ConnectedShapes method returns an Invalid Source error.

If no qualifying connected shapes exist, the ConnectedShapes method returns an empty array.

Examples

The following Visual Basic for Applications (VBA) macro shows how to use the ConnectedShapes method to find the names of all the shapes at the other end of outgoing connections from a selected shape.

Sample code provided by: Community Member Icon Fred Diggs

VBA Copy code Copy code
Public Sub ConnectedShapes_Outgoing_Example()
' Get the shapes that are connected to the selected shape
' by outgoing connectors.
    Dim vsoShape As Visio.Shape
    Dim lngShapeIDs() As Long
    Dim intCount As Integer

    If ActiveWindow.Selection.Count = 0 Then
        MsgBox ("Please select a shape that has connections")
        Exit Sub
    Else
        Set vsoShape = ActiveWindow.Selection(1)
    End If

    lngShapeIDs = vsoShape.ConnectedShapes _
      (visConnectedShapesOutgoingNodes, "")
    Debug.Print "Shapes at the end of outgoing connectors:"
    For intCount = 0 To UBound(lngShapeIDs)
        Debug.Print ActivePage.Shapes(lngShapeIDs(intCount)).Name
    Next
End Sub

The following VBA macro shows how to use the ConnectedShapes method to find the names of all the shapes at the other end of incoming connections to a selected shape.

Sample code provided by: Community Member Icon Fred Diggs

Copy code Copy code
Public Sub ConnectedShapes_Incoming_Example()
' Get the shapes that are at the other end of
' incoming connections to a selected shape
    Dim vsoShape As Visio.Shape
    Dim lngShapeIDs() As Long
    Dim intCount As Integer

    If ActiveWindow.Selection.Count = 0 Then
        MsgBox ("Please select a shape that has connections.")
        Exit Sub
    Else
        Set vsoShape = ActiveWindow.Selection(1)
    End If

    lngShapeIDs = vsoShape.ConnectedShapes _
      (visConnectedShapesIncomingNodes, "")
    Debug.Print "Shapes that are at the other end of incoming connections:"
    For intCount = 0 To UBound(lngShapeIDs)
        Debug.Print ActivePage.Shapes(lngShapeIDs(intCount)).Name
    Next
End Sub


Shape.ConvertToGroup Method (Visio)

 Copy code hover
[image]

Shape.ConvertToGroup Method (Visio)
Send feedback

Published: July 16, 2012

Converts a selection or an object from another application (a linked or embedded object) to a group.

Version Information

Version Added: Visio 2.0

Syntax

expression .ConvertToGroup

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

If the object to convert is a metafile, it will be converted into basic shapes.


Shape.Copy Method (Visio)

 Copy code hover
[image]

Shape.Copy Method (Visio)
Send feedback

Published: July 16, 2012

Copies a shape to the Clipboard.

Version Information

Version Added: Visio 2002

Syntax

expression .Copy(Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Optional | Variant | Determines how shapes are translated during the copy operation.

Return Value

Nothing

Remarks

Possible values for Flags are declared by the Visio type library in VisCutCopyPasteCodes, and are described in the following table.

Flag | Value | Description
visCopyPasteNormal | &H0 | Follow default copying behavior.
visCopyPasteNoTranslate | &H1 | Copy shapes to their original coordinate locations.
visCopyPasteCenter | &H2 | Copy shapes to the center of the page.
visCopyPasteNoHealConnectors | &H4 | Do not clean up connectors attached to cut shapes.
visCopyPasteNoContainerMembers | &H8 | Do not cut and copy unselected members of containers or lists.
visCopyPasteNoAssociatedCallouts | &H16 | Do not cut and copy unselected callouts associated with shapes.
visCopyPasteDontAddToContainers | &H32 | Do not add pasted shapes to any underlying containers.
visCopyPasteNoCascade | &H64 | Do not offset shapes on copy.

Setting Flags to visCopyPasteNormal is the equivalent of the behavior in the user interface. You should use visCopyPasteNormal and the other flags consistently. For example, if you use the value visCopyPasteNoTranslate to copy, you should also use that value to paste, because that is the only way to ensure that shapes are pasted to their original coordinate location.

To make a copy without using the Clipboard, use the Duplicate method.

Example

The following example shows how to use the Copy method. It draws a rectangle and then copies it to the Clipboard.

VBA Copy code Copy code

Public Sub Copy_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)

 'Copy the shape to the Clipboard.
 vsoShape.Copy

 End Sub


Shape.CreateSelection Method (Visio)

 Copy code hover
[image]

Shape.CreateSelection Method (Visio)
Send feedback

Published: July 16, 2012

Creates various types of Selection objects.

Version Information

Version Added: Visio 2003

Syntax

expression .CreateSelection(SelType, IterationMode, [Data])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
SelType | Required | VisSelectionTypes | The type of selection. See Remarks for possible values.
IterationMode | Optional | VisSelectMode | The selection mode used. See Remarks for possible values.
Data | Optional | Variant | The object type that corresponds to the SelType argument. See Remarks for possible values.

Return Value

Selection

Remarks

The CreateSelection method makes it possible to create complex selections programmatically. So instead of having to select all shapes on a page, for example, you can select only those on a given layer, or only those based on a certain master.

Calling the CreateSelection method with SelType equal to visSelTypeByType or visSelTypeByLayer is equivalent to selecting options in the Select byType dialog box (click Select in the Editing group on the Home tab, and then click Select by Type).

The SelType argument should be one of the following values, which are declared in VisSelectionTypes in the Visio type library.

Constant | Value | Description
visSelTypeAll | 1 | A selection that initially contains all shapes.
visSelTypeByDataGraphic | 6 | A selection that initially contains all shapes that have a given type of data graphic appled.
visSelTypeByLayer | 3 | A selection that initially contains all the shapes of a given layer.
visSelTypeByMaster | 5 | A selection that initially contains all the instantiated shapes of a given master.
visSelTypeByRole | 7 | A selection that initially contains all the shapes of a given role.
visSelTypeByType | 4 | A selection that initially contains all the shapes of a given type.
visSelTypeEmpty | 0 | A selection that initially contains no shapes.
visSelTypeSingle | 2 | A selection that initially contains one shape.

The optional IterationMode argument should be one of the following values, which are declared in VisSelectMode in the Visio type library. The default is visSelModeSkipSuper.

Constant | Value | Description
visSelModeOnlySub | &H0800 | Selection only reports subselected shapes.
visSelModeOnlySuper | &H0200 | Selection only reports superselected shapes.
visSelModeSkipSub | &H0400 | Selection does not report subselected shapes.
visSelModeSkipSuper | &H0100 | Selection does not report superselected shapes.

The optional Data argument should be an object that corresponds to the object type specified by SelType. For example, if you want to select all the masters of a certain type, Data should be of type Master. And if you want to select all the shapes on a certain layer, Data should be of type Layer.

When SelType is visSelTypeByRole, Data should be a member of the VisRoleSelectionTypes enumeration.

When the SelType argument is visSelTypeByType, possible Data values should be one of the following values, which are declared in VisTypeSelectionTypes in the Visio type library.

Constant | Value | Description
visTypeSelBitmap | 16 | A shape that is a bitmap.
visTypeSelGroup | 1 | A shape that contains other shapes.
visTypeSelGuide | 4 | A shape that is a guide.
visTypeSelInk | 32 | A shape that is ink.
visTypeSelMetafile | 8 | A shape that is a metafile.
visTypeSelOLE | 64 | A shape that is linked, embedded, or a control.
visTypeSelShape | 2 | A native Visio shape.


Shape.CreateSubProcess Method (Visio)

 Copy code hover
[image]

Shape.CreateSubProcess Method (Visio)
Send feedback

Published: July 16, 2012

Creates and returns a new sub-process page that is linked to the shape.

Version Information

Version Added: Visio 2010

Syntax

expression .CreateSubProcess

expression A variable that represents a Shape object.

Return Value

Page


Shape.Cut Method (Visio)

 Copy code hover
[image]

Shape.Cut Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object or selection and places it on the Clipboard.

Version Information

Version Added: Visio 2002

Syntax

expression .Cut(Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Optional | Variant | Determines how shapes are translated during the cut operation.

Return Value

Nothing

Remarks

Possible values for Flags are declared by the Visio type library in VisCutCopyPasteCodes, and are described in the following table.

Flag | Value | Description
visCopyPasteNormal | &H0 | Follow default copying behavior.
visCopyPasteNoTranslate | &H1 | Copy shapes to their original coordinate locations.
visCopyPasteCenter | &H2 | Copy shapes to the center of the page.
visCopyPasteNoHealConnectors | &H4 | Do not clean up connectors attached to cut shapes.
visCopyPasteNoContainerMembers | &H8 | Do not cut and copy unselected members of containers or lists.
visCopyPasteNoAssociatedCallouts | &H16 | Do not cut and copy unselected callouts associated with shapes.
visCopyPasteDontAddToContainers | &H32 | Do not add pasted shapes to any underlying containers.
visCopyPasteNoCascade | &H64 | Do not offset shapes on copy.

Setting Flags to visCopyPasteNormal is the equivalent of the behavior in the user interface. You should use visCopyPasteNormal and the other flags consistently. For example, if you use the value visCopyPasteNoTranslate to copy, you should also use that value to paste, because that is the only way to ensure that shapes are pasted to their original coordinate location.

Example

The following example shows how to use the Cut method. It draws a rectangle and then cuts it from the page (and places it on the Clipboard).

VBA Copy code Copy code

Public Sub Cut_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)

 'Cut shape from the page
 vsoShape.Cut

End Sub


Shape.Delete Method (Visio)

 Copy code hover
[image]

Shape.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object or selection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShape.Delete()

Example

This example shows how to delete Shape objects.

VBA Copy code Copy code

Public Sub Delete_Example()

    Dim vsoShape As Visio.Shape

    Set vsoShape = ActivePage.DrawLine(1, 1, 5, 5)

    vsoShape.Delete

End Sub


Shape.DeleteEx Method (Visio)

 Copy code hover
[image]

Shape.DeleteEx Method (Visio)
Send feedback

Published: July 16, 2012

Deletes the additional shapes that are associated with the shape, such as connectors and unselected container members, when the shape is deleted.

Version Information

Version Added: Visio 2010

Syntax

expression .DeleteEx(DelFlags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
DelFlags | Required | Long | The additional shapes to delete. See Remarks for possible values.

Return Value

Nothing

Remarks

DelFlags must be one or a bitwise combination of the following VisDeleteFlags constants.

Constant | Value | Description
visDeleteNormal | 0 | Match the deletion behavior that is in the user interface.
visDeleteHealConnectors | 1 | Delete connectors that are attached to deleted shapes.
visDeleteNoHealConnectors | 2 | Do not delete connectors that are attached to deleted shapes.
visDeleteNoContainerMembers | 4 | Do not delete unselected members of containers or lists.
visDeleteNoAssociatedCallouts | 8 | Do not delete unselected callouts that are associated with shapes.

In a bitwise combination of DelFlags constants, you cannot combine visDeleteHealConnectors and visDeleteNoHealConnectors. If you attempt to do so, Microsoft Visio returns an Invalid Parameter error.


Shape.DeleteRow Method (Visio)

 Copy code hover
[image]

Shape.DeleteRow Method (Visio)
Send feedback

Published: July 16, 2012

Deletes a row from a section in a ShapeSheet spreadsheet.

Version Information

Version Added: Visio 2.0

Syntax

expression .DeleteRow(Section, Row)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The index of the section that contains the row.
Row | Required | Integer | The index of the row to delete.

Return Value

Nothing

Remarks

To remove one row at a time from a ShapeSheet section, use the DeleteRow method. If the section has indexed rows, the rows following the deleted row shift position. If the row does not exist, nothing is deleted.

You should not delete rows that define fundamental characteristics of a shape, such as the 1-D Endpoints row (visRowXForm1D) or the component row (visRowComponent) or the MoveTo row (visRowVertex + 0) in a Geometry section. You cannot delete rows from sections represented by visSectionCharacter, visSectionParagraph, and visSectionTab.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the DeleteRow method to delete a ShapeSheet row.

VBA Copy code Copy code
Public Sub DeleteRow_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape

 'Get the active page.
 Set vsoPage = ActivePage

 'If there isn't an active page, set the Page object
 'to the first page of the active document.
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle on the active page.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section to the ShapeSheet of the rectangle.
 vsoShape.AddSection visSectionScratch

 'Add a row to the scratch section.
 vsoShape.AddRow visSectionScratch, visRowScratch, 0

 'Delete the row from the scratch section.
 vsoShape.DeleteRow visSectionScratch, visRowScratch

End Sub


Shape.DeleteSection Method (Visio)

 Copy code hover
[image]

Shape.DeleteSection Method (Visio)
Send feedback

Published: July 16, 2012

Deletes a ShapeSheet section.

Version Information

Version Added: Visio 2.0

Syntax

expression .DeleteSection(Section)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The index of the section to delete.

Return Value

Nothing

Remarks

When you delete a ShapeSheet section, all rows in the section are automatically deleted. If the specified section does not exist, nothing is deleted and no error is generated.

If a Geometry section is deleted, any subsequent Geometry sections shift up because they are indexed and no gaps can exist in an indexed range.

You can delete any section except the section represented by visSectionObject (although you can delete rows within that section).

Section index values are declared in the Visio type library in VisSectionIndices.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to delete a ShapeSheet section.

VBA Copy code Copy code
Public Sub DeleteSection_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape

 'Get the active page.
 Set vsoPage = ActivePage

 'If there isn't an active page, set the Page object
 'to the first page of the active document.
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle on the active page.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section to the ShapeSheet of the rectangle.
 vsoShape.AddSection visSectionScratch

 'Delete the scratch section from the ShapeSheet.
 vsoShape.DeleteSection visSectionScratch

End Sub


Shape.Disconnect Method (Visio)

 Copy code hover
[image]

Shape.Disconnect Method (Visio)
Send feedback

Published: July 16, 2012

Unglues the specified connector end points and offsets them the specified amount from the shapes to which they were joined.

Version Information

Version Added: Visio 2010

Syntax

expression .Disconnect(ConnectorEnd, OffsetX, OffsetY, Units)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
ConnectorEnd | Required | VisConnectorEnds | The end of the connector to disconnect.
OffsetX | Required | Double | The x-distance that the connector end is moved away from the shape.
OffsetY | Required | Double | The y-distance that the connector end is moved away from the shape.
Units | Required | VisUnitCodes | The units of measure for the assigned offset values.

Return Value

Nothing

Remarks

ConnectorEnd must be one of the following VisConnectorEnds constants.

Constant | Value | Description
visConnectorBeginPoint | 0 | The begin point of the connector.
visConnectorEndPoint | 1 | The end point of the connector.
visConnectorBothEnds | 2 | Both the begin and the end point of the connector.

When you call Disconnect on a connector shape (a 1-D routable shape), one or both endpoints of the connector are unglued from their target shapes, based on the specified ConnectorEnd parameter value. If a specified endpoint is not glued, Microsoft Visio takes no action.

Visio offsets the endpoint(s) from their current position by the amount specified by OffsetX, OffsetY, and Units. Offset values of 0 mean that the endpoints do not move.

The Disconnect method does not apply to non-connector shapes. If you call Disconnect on a non-connector shape or on a shape in a master, Visio returns an Invalid Source error.


Shape.DrawArcByThreePoints Method (Visio)

 Copy code hover
[image]

Shape.DrawArcByThreePoints Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path consists of an arc defined by the three points passed as parameters.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawArcByThreePoints(xBegin, yBegin, xEnd, yEnd, xControl, yControl)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xBegin | Required | Double | The x-coordinate of the begin point of the arc.
yBegin | Required | Double | The y-coordinate of the begin point of the arc.
xEnd | Required | Double | The x-coordinate of the endpoint of the arc.
yEnd | Required | Double | The y-coordinate of the endpoint of the arc.
xControl | Required | Double | The x-coordinate of the control point of the arc.
yControl | Required | Double | The y-coordinate of the control point of the arc.

Return Value

Shape

Remarks

All points should be in internal drawing units with respect to the coordinate space of the master, page, or group where the shape is being drawn.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the DrawArcByThreePoints method to draw an arc on the drawing page.

VBA Copy code Copy code
Public Sub DrawArcByThreePoints_Example

 Dim vsoShape As Visio.Shape
 Set vsoShape = ActivePage.DrawArcByThreePoints(3, 3, 6, 8, 5, 5)

End Sub


Shape.DrawBezier Method (Visio)

 Copy code hover
[image]

Shape.DrawBezier Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path is defined by the supplied sequence of Bezier control points.

Version Information

Version Added: Visio 4.1

Syntax

expression .DrawBezier(xyArray(), degree, Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xyArray() | Required | Double | An array of alternating x and y values that define the Bezier control points for the new shape.
degree | Required | Integer | The degree of the Bezier curve.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Shape

Remarks

The xyArray() and degree parameters must meet the following conditions:

1 <= degree <= 9

The number of points must be k * degree + 1, where k is a positive integer. If the first point is called p0, for any integer m between 1 and k, p(m * degree) is assumed to be the last control point of a Bezier segment, as well as the first control point of the next.

The result is a composite curve that consists of k Bezier segments. The input points from xyArray() define the curve's control points. If you want a smooth curve, make sure the points p(n - 1), pn, and p(n + 1) are co-linear whenever n = m * degree with an integer m. The composite Bezier curve is represented in the application as a B-spline with integer knots of multiplicity = degree.

The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group where the shape is being drawn. The passed array should be a SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The Flags argument is a bitmask that specifies options for drawing the new shape. Its value should be zero (0) or visSpline1D (8).

If Flags is visSpline1D and the first and last points in xyArray() don't coincide, the DrawBezier method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.

If the first and last points in xyArray() do coincide, the DrawBezier method produces a filled shape.

Example

The following example shows how to draw a Bezier curve through five arbitrary points on the active page.

VBA Copy code Copy code

Public Sub DrawBezier_Example()

 Dim vsoShape As Visio.Shape
 Dim intCounter As Integer
 Dim adblXYPoints(1 To (5 * 2)) As Double

 For intCounter = 1 To 5

 'Set x-coordinates (array elements 1,3,5,7,9) to 1,2,3,4,5
 adblXYPoints((intCounter * 2) - 1) = intCounter

 'Set y-coordinates (array elements 2,4,6,8,10) to f(intCounter)
 adblXYPoints(intCounter * 2) = (intCounter * intCounter) - (7 * intCounter) + 15

 Next intCounter

 Set vsoShape = ActivePage.DrawBezier(adblXYPoints, 2, visSpline1D)

End Sub


Shape.DrawCircularArc Method (Visio)

 Copy code hover
[image]

Shape.DrawCircularArc Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape whose path consists of a circular arc defined by its center, radius, and start and end angles.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawCircularArc(xCenter, yCenter, Radius, StartAngle, EndAngle)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xCenter | Required | Double | The x-coordinate of the center of the arc.
yCenter | Required | Double | The y-coordinate of the center of the arc.
Radius | Required | Double | The radius of the arc.
StartAngle | Optional | Double | The angle in radians with respect to the x-axis at which to start drawing the arc. The default is 0.
EndAngle | Optional | Double | The angle in radians with respect to the x-axis at which to end the arc. The default is pi (3.14592634898).

Return Value

Shape

Remarks

By default, DrawCircularArc draws a 180-degree arc on the drawing page.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the DrawCircularArc method to draw an arc on the drawing page.

VBA Copy code Copy code
Public Sub DrawCircularArc_Example

 Dim vsoShape As Visio.Shape
 Set vsoShape = ActivePage.DrawCircularArc(3, 3, 3)

End Sub


Shape.DrawLine Method (Visio)

 Copy code hover
[image]

Shape.DrawLine Method (Visio)
Send feedback

Published: July 16, 2012

Adds a line to the Shapes collection of a group shape.

Version Information

Version Added: Visio 2.0

Syntax

expression .DrawLine(xBegin, yBegin, xEnd, yEnd)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xBegin | Required | Double | The x-coordinate of the line's begin point.
yBegin | Required | Double | The y-coordinate of the line's begin point.
xEnd | Required | Double | The x-coordinate of the line's endpoint.
yEnd | Required | Double | The y-coordinate of the line's endpoint.

Return Value

Shape

Remarks

Using the DrawLine method is equivalent to using the Line tool in Microsoft Visio. The arguments are in internal drawing units with respect to the coordinate space of the page, master, or group where the line is being placed.

Example

The following example shows how to draw a line shape on the active page.

VBA Copy code Copy code

Public Sub DrawLine_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawLine(5, 4, 7.5, 1)

End Sub


Shape.DrawNURBS Method (Visio)

 Copy code hover
[image]

Shape.DrawNURBS Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape whose path consists of a single NURBS (nonuniform rational B-spline) segment.

Version Information

Version Added: Visio 2000

Syntax

expression .DrawNURBS(degree, Flags, xyArray(), knots(), weights)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
degree | Required | Integer | The spline's degree; an integer between 1 and 25.
Flags | Required | Integer | Flags that influence how the shape is drawn.
xyArray() | Required | Double | An array of alternating x and y values that define the control points coordinates; use internal drawing units (inches).
knots() | Required | Double | An array of knots.
weights | Optional | Variant | An array of weights.

Return Value

Shape

Remarks

The DrawNURBS method creates a new shape whose path consists of a single NURBS segment as specified by the arguments.

The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group in which the new shape is being created. The xyArray, knots, and weights arrays should be of type SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The knots argument is unit-less. The sequence of knots should be non-decreasing. In other words, knots(i + 1) < knots(i) is not acceptable. knots(i + 1) = knots(i) is permitted, and then the value is repeated, but the following restrictions apply:

  • The first knot may not be repeated more than degree + 1 times.

  • The last knot may not be repeated.

  • Any knot between the first and last may not be repeated more than degree times.

  • If the first knot is repeated less than degree + 1 times, the spline is periodic.

  • The list of weights is optional. Its absence signals that the spline is non-rational. Weights are unit-less.

The following rules apply to the sizes of the lists. For a spline with n control points:

  • If the spline is periodic, n > 2. Otherwise, n > degree.

  • The size of xyArray is 2n.

  • The size of the weights array is n (if present).

  • The size of the knots array is n + 1.

The conventional non-periodic spline requires n + degree + 1 knots, but the application implies the repeated knots at the end. For example, the degree 2 knot list (0,0,0,2,5,8) is interpreted in the application as the conventional knot sequence (0,0,0,2,5,8,8,8).

The Flags parameter is a bitmask that specifies options for drawing the new shape. Its value should be either zero (0) or visSpline1D (8). If Flags is visSpline1D and if the first and last points in xyArray don't coincide, the DrawNURBS method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.

If the first and last points in xyArray do coincide, the DrawNURBS method produces a filled shape.


Shape.DrawOval Method (Visio)

 Copy code hover
[image]

Shape.DrawOval Method (Visio)
Send feedback

Published: July 16, 2012

Adds an oval (ellipse) to the Shapes collection of a group shape.

Version Information

Version Added: Visio 2.0

Syntax

expression .DrawOval(x1, y1, x2, y2)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
x1 | Required | Double | The x-coordinate of one corner of the ellipse's width-height box.
y1 | Required | Double | The y-coordinate of one corner of the ellipse's width-height box.
x2 | Required | Double | The x-coordinate of the other corner of the ellipse's width-height box.
y2 | Required | Double | The y-coordinate of the other corner of the ellipse's width-height box.

Return Value

Shape

Remarks

Using the DrawOval method is equivalent to using the Ellipse tool in the application. The arguments are in internal drawing units with respect to the coordinate space of the page, master, or group where the ellipse is being placed.

Example

The following example shows how to draw an oval (ellipse) on the active page.

VBA Copy code Copy code

Public Sub DrawOval_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawOval(1.5, 10.5, 7.5, 6.5)

End Sub


Shape.DrawPolyline Method (Visio)

 Copy code hover
[image]

Shape.DrawPolyline Method (Visio)
Send feedback

Published: July 16, 2012

Creates a shape whose path is a polyline along a given set of points.

Version Information

Version Added: Visio 2000

Syntax

expression .DrawPolyline(xyArray(), Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xyArray() | Required | Double | An array of alternating x and y values that defines points in the new shape's path.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Shape

Remarks

The DrawPolyline method creates a new shape whose path consists of a sequence of line segments and whose endpoints match the points specified in xyArray. Calling the DrawPolyline method is equivalent to calling the DrawSpline method with a tolerance of zero (0) and a flag of visSplineAbrupt.

The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group in which the new shape is being created. The passed array should be a type SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The Flags argument is a bitmask that specifies options for drawing the new shape. Its value can include visPolyline1D (8) or visPolyarcs (256). If Flags includes:

  • visPolyline1D and if the first and last points in xyArray don't coincide, the DrawPolyline method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.

  • visPolyarcs, Microsoft Visio will produce a sequence of arcs rather than a sequence of line segments; xyArray should specify the initial x,y point of the sequence followed by x,y bow triples. Visio will produce a shape with EllipticalArcTo rows where the bow of the arc matches the specified value.

If the first and last points in xyArray coincide, the DrawPolyline method produces a filled shape.

Example

The following example shows how to draw two polyline shapes that have 2-D and 1-D behavior, respectively, on the active page.

VBA Copy code Copy code

Public Sub DrawPolyline_Example()

 Dim vsoShape As Visio.Shape
 Dim adblXYPoints(1 To 8) As Double
 Dim intCounter As Integer

 'Initialize array with coordinates.
 adblXYPoints(1) = 1
 adblXYPoints(2) = 1
 adblXYPoints(3) = 3
 adblXYPoints(4) = 3
 adblXYPoints(5) = 5
 adblXYPoints(6) = 1
 adblXYPoints(7) = 1
 adblXYPoints(8) = 2

 'Use the DrawPolyline method to draw a shape that has 2-D behavior.
 Set vsoShape = ActivePage.DrawPolyline(adblXYPoints, 0)

 'Increase the Y-coordinate of the array by 4 to separate
 'the next shape drawn from the first.
 For intCounter = 2 To UBound(adblXYPoints) Step 2
 adblXYPoints(intCounter) = adblXYPoints(intCounter) + 4
 Next intCounter

 'Use the DrawPolyline method to draw a shape that has 1-D behavior.
 Set vsoShape = ActivePage.DrawPolyline(adblXYPoints, visPolyline1D)

End Sub


Shape.DrawQuarterArc Method (Visio)

 Copy code hover
[image]

Shape.DrawQuarterArc Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape whose path consists of an elliptical arc defined by the two points and the flag passed in as arguments.

Version Information

Version Added: Visio 2003

Syntax

expression .DrawQuarterArc(xBegin, yBegin, xEnd, yEnd, SweepFlag)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xBegin | Required | Double | The x-coordinate of the begin point of the arc.
yBegin | Required | Double | The y-coordinate of the begin point of the arc.
xEnd | Required | Double | The x-coordinate of the endpoint of the arc.
yEnd | Required | Double | The y-coordinate of the endpoint of the arc.
SweepFlag | Required | VisArcSweepFlags | The type of arc, concave or convex.

Return Value

Shape

Remarks

The begin and endpoints define the bounding rectangle of the arc, and the SweepFlag argument determines which of the two possible arcs within the bounding rectangle is drawn. The bounding rectangle is always aligned to the page coordinate system; that is, the x-axis of the ellipse is parallel to the x-axis of the page.

The following possible values for the SweepFlag argument are declared in VisArcSweepFlags in the Visio type library.

Constant | Value | Description
visArcSweepFlagConcave | 0 | Concave arc
visArcSweepFlagConvex | 1 | Convex arc

If SweepFlag is visArcSweepFlagConcave, the line joining the center of the ellipse to the arc sweeps through decreasing angles; if it is visArcSweepFlagConvex, it sweeps through increasing angles.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the DrawQuarterArc method to draw a concave arc on the drawing page.

VBA Copy code Copy code
Public Sub DrawQuarterArc_Example

 Dim vsoShape As Visio.Shape
 Set vsoShape = ActivePage.DrawQuarterArc(3, 3, 6, 8, visArcSweepFlagConcave)

End Sub


Shape.DrawRectangle Method (Visio)

 Copy code hover
[image]

Shape.DrawRectangle Method (Visio)
Send feedback

Published: July 16, 2012

Adds a rectangle to the Shapes collection of a page, master, or group.

Version Information

Version Added: Visio 2.0

Syntax

expression .DrawRectangle(x1, y1, x2, y2)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
x1 | Required | Double | The x-coordinate of one corner of the rectangle's width-height box.
y1 | Required | Double | The y-coordinate of one corner of the rectangle's width-height box.
x2 | Required | Double | The x-coordinate of the other corner of the rectangle's width-height box.
y2 | Required | Double | The y-coordinate of the other corner of the rectangle's width-height box.

Return Value

Shape

Remarks

Using the DrawRectangle method is equivalent to using the Rectangle tool in the application. The arguments are in internal drawing units with respect to the coordinate space of the page, master, or group where the rectangle is being placed.

Example

The following example shows how to draw a rectangle on the active page.

VBA Copy code Copy code

Public Sub DrawRectangle_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = ActivePage.DrawRectangle(1, 4, 4, 1)

End Sub


Shape.DrawSpline Method (Visio)

 Copy code hover
[image]

Shape.DrawSpline Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new shape whose path follows a given sequence of points.

Version Information

Version Added: Visio 4.1

Syntax

expression .DrawSpline(xyArray(), Tolerance, Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xyArray() | Required | Double | An array of alternating x and y values that define points in the new shape's path.
Tolerance | Required | Double | How closely the path of the new shape must approximate the given points.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Shape

Remarks

The DrawSpline method creates a new shape whose path falls within the given tolerance of the given array of points. To fit the given points exactly, specify a tolerance of zero (0). Typically, the DrawSpline method fits spline segments through the points, but it sometimes produces line or circular arc segments in the new shape.

The control points and tolerance are in internal drawing units (inches) with respect to the coordinate space of the page, master, or group in which the new shape is being created. The passed array should be a SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.

The error from the points to the path of the resulting shape is roughly within tolerance. When the number of points is large, the actual error may sometimes exceed the prescribed tolerance.

The Flags parameter is a bitmask that specifies options for drawing the new shape. Its value should be zero or a combination of one or more of the following values.

Constant | Value
visSplinePeriodic | 1(&H1)
visSplineDoCircles | 2(&H2)
visSplineAbrupt | 4(&H4)
visSpline1D | 8(&H8)

If Flags includes visSplinePeriodic and the following conditions are met, the application attempts to draw a periodic spline. Otherwise, Visio draws a non-periodic spline:

  • The last point must be a repetition of the first one.

  • If the flag visSplineAbrupt is included as well, the entire closed path outlined by the points must be free of abrupt changes of direction and curvature.

If Flags includes visSplineDoCircles, Microsoft Visio recognizes circular segments in the given array of points and generates circular arcs instead of spline rows for those segments.

If Flags includes visSplineAbrupt, Visio breaks the spline whenever it detects an abrupt change of direction or curvature in the point's trail. An abrupt change of direction is defined by three consecutive points A, B, C in the list, for which the distance between B and the line segment AC is more than twice the tolerance. The application also considers point B to be an abrupt change if one of the segments AB or BC is more than twice as long as the other. At a point where an abrupt change is detected, the application ends the current piece (line, arc, or spline) and starts a fresh one.

If Flags includes visSpline1D and the first and last points in xyArray() don't coincide, the DrawSpline method produces a shape that has one-dimensional (1-D) behavior, otherwise, it produces a shape that has two-dimensional (2-D) behavior.

If the first and last points in xyArray() do coincide, the DrawSpline method produces a filled shape.

Example

The following example shows how to draw a periodic spline through five arbitrary points, requiring that the spline approach within 0.25 (drawing) inches of each point. It allows Visio to start new segments in the path of the new shape at points considered abrupt.

VBA Copy code Copy code

Public Sub DrawSpline_Example()

 Dim vsoShape As Visio.Shape
 Dim intCounter As Integer
 Dim adblXYPoints(1 To (5 * 2)) As Double

 For intCounter = 1 To 5

 'Set x components (array elements 1,3,5,7,9) to 1,2,3,4,5
 adblXYPoints((intCounter * 2) - 1) = intCounter

 'Set y components (array elements 2,4,6,8,10) to f(i)
 adblXYPoints(intCounter * 2) = (intCounter * intCounter) - (7 * intCounter) + 15
 Next intCounter

 Set vsoShape = ActivePage.DrawSpline(adblXYPoints, 0.25, visSplineAbrupt)

End Sub


Shape.Drop Method (Visio)

 Copy code hover
[image]

Shape.Drop Method (Visio)
Send feedback

Published: July 16, 2012

Creates one or more new Shape objects by dropping an object onto a receiving object such as a master, drawing page, shape, or group.

Version Information

Version Added: Visio 2.0

Syntax

expression .Drop(ObjectToDrop, xPos, yPos)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectToDrop | Required | [UNKNOWN] | The object or selection to drop. While this is typically a Visio object such as a Master, Shape, or Selection object, it can be any OLE object that provides an IDataObject interface.
xPos | Required | Double | The x-coordinate at which to place the center of the shape's width or PinX.
yPos | Required | Double | The y-coordinate at which to place the center of the shape's height or PinY.

Return Value

Shape

Remarks

Using the Drop method is similar to moving a shape with the mouse. The object dropped (ObjectToDrop) can be a master or a shape on the drawing page.

To add a shape to a group or on a drawing page, apply the Drop method to a Shape object. The center of the shape's width-height box is positioned at the specified coordinates, and a Shape object that represents the shape that is created is returned. When applying this method to a Shape object, make sure that the Shape object represents a group.

If ObjectToDrop is a Master, the pin of the master is dropped at the specified coordinates. A master's pin is often, but not necessarily, at its center of rotation.

Example

The following example shows how to use the Drop method to drop shapes onto Page and Shape objects.

VBA Copy code Copy code

Public Sub Drop_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape
 Dim vsoGroupShape As Visio.Shape
 Dim vsoSubShape As Visio.Shape
 Dim vsoSelection As Visio.Selection

 Set vsoShape1 = ActivePage.DrawRectangle(1, 2, 2, 1)
 Set vsoShape2 = ActivePage.DrawRectangle(1, 4, 2, 3)

 'Drop a shape on the page.
 Set vsoShape3 = ActivePage.Drop(vsoShape1, 3.5, 3.5)

 'Make sure only one shape is selected to start.
 Set vsoSelection = ActiveWindow.Selection
 vsoSelection.Select vsoShape1, visDeselectAll + visSelect
 vsoSelection.Select vsoShape2, visSelect

 'Create a group shape.
 Set vsoGroupShape = vsoSelection.Group

 'Drop a shape on the group shape to create a new subshape.
 Set vsoSubShape = vsoGroupShape.Drop(vsoShape3, 1, 2)

End Sub


Shape.DropMany Method (Visio)

 Copy code hover
[image]

Shape.DropMany Method (Visio)
Send feedback

Published: July 16, 2012

Creates one or more new Shape objects in a group. It returns an array of the IDs of the Shape objects it produces.

Version Information

Version Added: Visio 4.5

Syntax

expression .DropMany(ObjectsToInstance(), xyArray(), IDArray())

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectsToInstance() | Required | Variant | Identifies masters or other objects from which to make shapes.
xyArray() | Required | Double | An array of alternating x and y values specifying the positions for the new shapes.
IDArray() | Required | Integer | Out parameter. An array that returns the IDs of the created shapes.

Return Value

Integer

Remarks

Using the DropMany method is like using the Page, Master, or Shape object's Drop method, except you can use the DropMany method to create many new Shape objects at once, rather than one per method call. The DropMany method creates new Shape objects on the page, in the master, or in the group shape to which it is applied (this shape is called the "target object" in the following discussion).

You can identify which master to drop by passing the DropMany method a Master object or the master's index or the master's name. When you pass an object, DropMany isn't constrained to just dropping a master from the document stencil of the document onto which it is being dropped. The object can be a master from another document or another type of object.

Passing integers (master indices) or strings (master names) to DropMany is faster than passing objects, but integers or strings can identify only masters in the document stencil of the document onto which it is being dropped. Hence your program has to somehow get the masters in question into the document stencil in the first place, provided they weren't there already.

ObjectsToInstance() should be a one-dimensional array of n >= 1 variants. Its entries identify objects from which you want to make new Shape objects. An entry often refers to a Microsoft Visio application Master object. It might also refer to a Visio application Shape object, Selection object, or even an object from another application. The application doesn't care what the lower and upper array bounds of the ObjectsToInstance entries are. Call these vlb and vub, respectively.

  • If ObjectsToInstance(i) is a reference to an OLE object that provides an IDataObject interface (in Microsoft Visual Basic for Applications, a reference to a selection, shape, master, guide, or OLE object), the object it is referencing is instanced. This is essentially equivalent to calling Drop(ObjectsToInstance(i),x,y).

  • If ObjectsToInstance(i) is the integer j, an instance of the Master object in the document stencil of the target object's document whose 1-based index is j is made. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to be triggered.

  • If ObjectsToInstance(i) is the string s (or a reference to the string s), an instance of the Master object with name s in the document stencil of the target object's document is made; s can equal either the Master object's UniqueID or Name property. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to be triggered.

  • For vlb < i <= vub, if ObjectsToInstance(i) is empty (Nothing or uninitialized in Microsoft Visual Basic), entry i will cause ObjectsToInstance(j) to be instanced again, where j is the largest value < i such that ObjectsToInstance(j) isn't empty. If you want to make n instances of the same thing, only ObjectsToInstance(vlb) needs to be provided.

The xyArray() argument should be a one-dimensional array of 2m doubles with lower bound xylb and upper bound xyub, where m >= n. The values in the array tell the DropMany method where to position the Shape objects it produces. ObjectsToInstance(vlb + ( i - 1)) is dropped at (xy[(i - 1)2 + xylb],xy[(i - 1)2 + xylb + 1]) for 1 <= i <=n.

Note that m > n is allowed. For n < i <= m, the i'th thing instanced is the same thing as the n'th thing instanced. Thus to make m >= 1 instances of the same thing, you can pass an ObjectsToInstance() array with one entry and an m entry xyArray() array.

If the entity being instanced is a master, the pin of the new Shape object is positioned at the given xy. Otherwise, the center of the Shape objects is positioned at the given xy.

The value returned by the DropMany method is the number of xy entries in xyArray() that the DropMany method successfully processed. If all entries were processed successfully, m is returned. If some entries are successfully processed prior to an error occurring, the produced Shape objects are not deleted and this raises an exception but still returns a positive value.

Presuming all mxy entries are processed correctly, the number of new Shape objects produced by the DropMany method is usually equal to m. In rare cases (for example, if a Selection object gets instanced), more than m Shape objects may be produced. The caller can determine the number of produced Shape objects by comparing the number of shapes in the target object before and after the DropMany method is executed. The caller can assert the new Shape objects are those with the highest indices in the target object's Shapes collection.

If the DropMany method returns zero (0), IDArray() returns Null (Nothing). Otherwise, it returns a one-dimensional array of m integers indexed from 0 to m - 1. IDArray() is an out parameter that is allocated by the DropMany method and ownership is passed to the program that called the DropMany method. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.)

If IDArray() returns non-null (not Nothing), IDArray(i - 1), 1 <= i <= intReturned, returns the ID of the Shape object produced by the i'th xyArray entry, provided the i'th xyArray() entry produced exactly one Shape object. If the i'th xyArray() entry produced multiple Shape objects, -1 is returned in the entry. All entries i, intReturned <= i < m, return -1.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the DropMany method to drop more than one shape when you are using local names to identify the shapes. Use the DropManyU method to drop more than one shape when you are using universal names to identify the shapes.

Example

The following example shows how to use the DropMany method. It drops one instance of every master in the document stencil of the macro's Document object onto Page1 of the macro's Document object. Before running this macro, make sure there is at least one master in the document stencil.

VBA Copy code Copy code

Public Sub DropMany_Example()

 On Error GoTo HandleError

 Dim vsoMasters As Visio.Masters
 Dim intMasterCount As Integer
 Set vsoMasters = ThisDocument.Masters
 intMasterCount = vsoMasters.Count

 ReDim varObjectsToInstance(1 To intMasterCount) As Variant
 ReDim adblXYArray(1 To intMasterCount * 2) As Double
 Dim intCounter As Integer
 For intCounter = 1 To intMasterCount

 'Pass name of object to drop to DropMany.
 varObjectsToInstance(intCounter) = vsoMasters.Item(intCounter).Name

 'Set x components of where to drop to 2,4,6,2,4,6,2,4,6,...
 adblXYArray (intCounter * 2 - 1) = (((intCounter - 1) Mod 3) + 1) * 2

 'Set y components to 2,2,2,4,4,4,6,6,6,...
 adblXYArray (intCounter * 2) = Int((intCounter + 2) / 3) * 2

 Next intCounter

 Dim aintIDArray() As Integer
 Dim intProcessed As Integer

 intProcessed = ThisDocument.Pages(1).DropMany(varObjectsToInstance, _
 adblXYArray, aintIDArray)
 Debug.Print intProcessed

 For intCounter = LBound(aintIDArray) To UBound(aintIDArray)
 Debug.Print intCounter; aintIDArray(intCounter)
 Next intCounter

 Exit Sub

 HandleError:
 MsgBox "Error"

 Exit Sub

End Sub


Shape.DropManyU Method (Visio)

 Copy code hover
[image]

Shape.DropManyU Method (Visio)
Send feedback

Published: July 16, 2012

Creates one or more new Shape objects on a page, in a master, or in a group. It returns an array of the IDs of the Shape objects it produces.

Version Information

Version Added: Visio 4.5

Syntax

expression .DropManyU(ObjectsToInstance(), xyArray(), IDArray())

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
ObjectsToInstance() | Required | Variant | Identifies masters or other objects from which to make shapes by their universal names.
xyArray() | Required | Double | An array of alternating x and y values specifying the positions for the new shapes.
IDArray() | Required | Integer | Out parameter. An array that returns the IDs of the created shapes.

Return Value

Integer

Remarks

Using the DropManyU method is like using the Page, Master, or Shape object's Drop method, except you can use the DropManyU method to create many new Shape objects at once, rather than one per method call. The DropManyU method creates new Shape objects on the page, in the master, or in the group shape to which it is applied (this shape is called the "target object" in the following discussion).

You can identify which master to drop by passing the DropManyU method a Master object or the master's index or the master's name. When you pass an object, DropManyU isn't constrained to just dropping a master from the document stencil of the document onto which it is being dropped. The object can be a master from another document or another type of object.

Passing integers (master indices) or strings (master names) to DropManyU is faster than passing objects, but integers or strings can identify only masters in the document stencil of the document onto which it is being dropped. Hence your program has to somehow get the masters in question into the document stencil in the first place, provided they weren't there already.

ObjectsToInstance() should be a one-dimensional array of n >= 1 variants. Its entries identify objects from which you want to make new Shape objects. An entry often refers to a Microsoft Visio application Master object. It might also refer to a Visio application Shape object, Selection object, or even an object from another application. The application doesn't care what the lower and upper array bounds of the ObjectsToInstance() entries are. Call these vlb and vub, respectively.

  • If ObjectsToInstance(i) is the integer j, an instance of the Master object in the document stencil of the target object's document whose 1-based index is j is made. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to trigger.

  • If ObjectsToInstance(i) is the string s (or a reference to the string s), an instance of the Master object with name s in the document stencil of the target object's document is made; s can equal either the Master object's UniqueID or NameU property. The EventDrop cell in the Events section of the new shape is not triggered. Use the Drop method instead if you want the EventDrop cell to be triggered.

  • For vlb < i <= vub, if ObjectsToInstance(i) is empty (Nothing or uninitialized in Microsoft Visual Basic), entry i will cause ObjectsToInstance(j) to be instanced again, where j is the largest value < i such that ObjectsToInstance(j) isn't empty. If you want to make n instances of the same thing, only ObjectsToInstance(vlb) needs to be provided.

The xyArray() argument should be a one-dimensional array of 2m doubles with lower bound xylb and upper bound xyub, where m >= n. The values in the array tell the DropManyU method where to position the Shape objects it produces. ObjectsToInstance(vlb + ( i - 1)) is dropped at (xy[(i - 1)2 + xylb],xy[(i - 1)2 + xylb + 1]) for 1 <= i <=n.

Note that m > n is allowed. For n < i <= m, the i'th thing instanced is the same thing as the n'th thing instanced. Thus to make m >= 1 instances of the same thing, you can pass an ObjectsToInstance() array with one entry and an m entry xyArray() array.

If the entity being instanced is a master, the pin of the new Shape object is positioned at the given xy. Otherwise, the center of the Shape objects is positioned at the given xy.

The Integer value returned by the DropManyU method is the number of xy entries in xyArray() that the DropManyU method successfully processed. If all entries were processed successfully, m is returned. If some entries are successfully processed prior to an error occurring, the produced Shape objects are not deleted and this raises an exception but still returns a positive integer.

Presuming all mxy entries are processed correctly, the number of new Shape objects produced by the DropManyU method is usually equal to m. In rare cases (for example, if a Selection object gets instanced), more than m Shape objects may be produced. The caller can determine the number of produced Shape objects by comparing the number of shapes in the target object before and after the DropManyU method is executed. The caller can assert the new Shape objects are those with the highest indices in the target object's Shapes collection.

If the DropManyU method returns zero (0), IDArray() returns null (Nothing). Otherwise, it returns a one-dimensional array of m integers indexed from 0 to m - 1. IDArray() is an out parameter that is allocated by the DropManyU method and ownership is passed to the program that called the DropManyU method. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.)

If IDArray() returns non-null (not Nothing), IDArray(i - 1), 1 <= i <= intReturned, returns the ID of the Shape object produced by the i'th xyArray() entry, provided the i'th xyArray() entry produced exactly one Shape object. If the i'th xyArray() entry produced multiple Shape objects, -1 is returned in the entry. All entries i, intReturned <= i < m, return -1.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the DropMany method to drop more than one shape when you are using local names to identify the shapes. Use the DropManyU method to drop more than one shape when you are using universal names to identify the shapes.

Example

The following example shows how to use the DropManyU method. It drops one instance of every master in the document stencil of the macro's Document object onto Page1 of the macro's Document object. Before running this macro, make sure there is at least one master in the document stencil.

VBA Copy code Copy code

Public Sub DropManyU_Example()

 On Error GoTo HandleError

 Dim vsoMasters As Visio.Masters
 Dim intMasterCount As Integer
 Set vsoMasters = ThisDocument.Masters
 intMasterCount = vsoMasters.Count

 ReDim varObjectsToInstance(1 To intMasterCount) As Variant
 ReDim adblXYArray(1 To (intMasterCount * 2)) As Double
 Dim intCounter As Integer
 For intCounter = 1 To intMasterCount

 'Pass universal name of object to drop to DropManyU.
 varObjectsToInstance(intCounter) = vsoMasters.ItemU(intCounter).NameU

 'Set x components of where to drop to 2,4,6,2,4,6,2,4,6,...
 adblXYArray (intCounter * 2 - 1) = (((intCounter - 1) Mod 3) + 1) * 2

 'Set y components to 2,2,2,4,4,4,6,6,6,...
 adblXYArray (intCounter * 2) = Int((intCounter + 2) / 3) * 2

 Next intCounter

 Dim aintIDArray() As Integer
 Dim intProcessed As Integer

 intProcessed = ThisDocument.Pages(1).DropManyU(varObjectsToInstance, _
 adblXYArray, aintIDArray)
 Debug.Print intProcessed

 For intCounter = LBound(aintIDArray) To UBound(aintIDArray)
 Debug.Print intCounter; aintIDArray(intCounter)
 Next intCounter

 Exit Sub

 HandleError:
 MsgBox "Error"

 Exit Sub

End Sub


Shape.Duplicate Method (Visio)

 Copy code hover
[image]

Shape.Duplicate Method (Visio)
Send feedback

Published: July 16, 2012

Duplicates an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Duplicate

expression A variable that represents a Shape object.

Return Value

Shape

Remarks

The Duplicate method duplicates the specified object or selection and adds a copy to the same page as the original. Using the Duplicate method is equivalent to clicking Duplicate on the Paste menu on the Home tab.

When used with a Shape object, the Duplicate method duplicates the shape.

When used with a Selection object, the Duplicate method duplicates the selection.

Example

The following example shows how to duplicate Shape objects. The code also works for Selection objects.

Before running this macro, make sure a drawing page is active in the Microsoft Visio window.

VBA Copy code Copy code

Public Sub Duplicate_Example()

 Dim vsoOriginalShape As Visio.Shape
 Dim vsoDuplicateShape As Visio.Shape

 Set vsoOriginalShape = ActivePage.DrawLine(1, 1, 5, 5)

 Set vsoDuplicateShape = vsoOriginalShape.Duplicate
 vsoDuplicateShape.Cells("BeginY") = "2"

End Sub


Shape.Export Method (Visio)

 Copy code hover
[image]

Shape.Export Method (Visio)
Send feedback

Published: July 16, 2012

Exports an object from Microsoft Visio to a file format such as .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf.

Version Information

Version Added: Visio 3.0

Syntax

expression .Export(FileName)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The fully qualified path and name of the file to receive the exported object.

Return Value

Nothing

Remarks

The file name extension indicates which export filter to use. If the filter is not installed, the Export method returns a compiler error in your Visual Basic or VBA project. The Export method uses the default preference settings for the specified filter and does not prompt the user for non-default arguments.

The Export method of a Page object supports saving to HTML file format using the extension .htm or .html. When pages are exported, Visio uses the settings that were last selected in the Save As dialog box.

If the specified file already exists, Visio replaces it without prompting the user.

Starting with Microsoft Visio 2010, you can use various properties and methods of the ApplicationSettings object that relate to raster images to configure settings for export to .bmp, .gif, .jpg, .png, and .tif file types.

Example

This example shows how to export a Visio page as a bitmap (.bmp) file. It assumes a drawing page is open and active in Microsoft Visio.

VBA Copy code Copy code
Public Sub Export_Example()
 Dim vsoPage As Visio.Page
 Set vsoPage = ActivePage
 vsoPage.Export ("C:\\myExportedPage.bmp")
End Sub


Shape.FitCurve Method (Visio)

 Copy code hover
[image]

Shape.FitCurve Method (Visio)
Send feedback

Published: July 16, 2012

Reduces the number of geometry segments in a shape or shapes by replacing them with similar spline, arc, and line segments that approximate the paths of the initial segments. Typically, this reduces the number of segments in the shape.

Version Information

Version Added: Visio 4.1

Syntax

expression .FitCurve(Tolerance, Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Tolerance | Required | Double | How closely the resulting paths must match the shape's original paths.
Flags | Required | Integer | Flags that influence how the shape is drawn.

Return Value

Nothing

Remarks

The FitCurve method of a Selection object optimizes each of the shapes in the selection. It does not combine the selected shapes into a single shape.

The paths resulting from the FitCurve method fall within the given tolerance of the initial paths. Tolerance should be in internal drawing units (inches). To match the initial paths exactly, specify a tolerance of zero (0).

The Flags argument is a bitmask that specifies options for optimizing the paths. Its value should either be zero or a combination of one or more of the following values.

Constant | Value | Description
visSplinePeriodic | &H1 | Produce periodic splines if appropriate.
visSplineDoCircles | &H2 | Recognize circular segments in the shape(s) and generate circular arcs instead of spline rows for those segments.
visSplineAbrupt | &H4 | Break the resulting splines whenever an abrupt change of direction or curvature in a path is detected.


Shape.FlipHorizontal Method (Visio)

 Copy code hover
[image]

Shape.FlipHorizontal Method (Visio)
Send feedback

Published: July 16, 2012

Flips an object horizontally.

Version Information

Version Added: Visio 2.0

Syntax

expression .FlipHorizontal

expression A variable that represents a Shape object.

Return Value

Nothing


Shape.FlipVertical Method (Visio)

 Copy code hover
[image]

Shape.FlipVertical Method (Visio)
Send feedback

Published: July 16, 2012

Flips an object vertically.

Version Information

Version Added: Visio 2.0

Syntax

expression .FlipVertical

expression A variable that represents a Shape object.

Return Value

Nothing


Shape.GetCustomPropertiesLinkedToData Method (Visio)

 Copy code hover
[image]

Shape.GetCustomPropertiesLinkedToData Method (Visio)
Send feedback

Published: July 16, 2012

Gets the IDs of the shape-data-item (custom property) rows in the Shape Data section of the shape's ShapeSheet spreadsheet linked to the specified data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetCustomPropertiesLinkedToData(DataRecordsetID, CustomPropertyIndices())

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of the data recordset that contains the data the shape is linked to.
CustomPropertyIndices() | Required | Long | Out parameter. An empty, dimensionless array that the method fills with the row IDs of the shape-data-item (custom property) rows in the shape's ShapeSheet that are linked to data columns in the data recordset.

Return Value

Nothing

Remarks

Knowing how shapes are linked to data can help prevent conflicts and broken links when you refresh the data in one or more data recordsets.

Note Note

In some previous versions of Visio, shape data were called custom properties.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetCustomPropertiesLinkedToData method to get the IDs of the shape-data-item (custom property) rows linked to a data column in a data recordset.

Before running this macro, add at least one data recordset to the DataRecordsets collection of the document. The macro drops a shape onto the page, links the shape to data in the data recordset most recently added to the collection, and then tests to make sure the linking is successful. If it is, it gets the row IDs of all ShapeSheet rows linked to data prints the IDs of the rows in the Immediate window.

VBA Copy code Copy code
Public Sub GetCustomPropertiesLinkedToData_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim vsoShape As Visio.Shape
    Dim intCount As Integer
    Dim boolIsLinked As Boolean
    Dim alngIndices() As Long
    Dim intArrayIndex as Integer

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount)
    Set vsoShape = ActivePage.DrawRectangle(2, 2, 4, 4)

    vsoShape.LinkToData vsoDataRecordset.ID, 1, True
    boolIsLinked = vsoShape.IsCustomPropertyLinked(vsoDataRecordset.ID, 1)

    If boolIsLinked Then

        vsoShape.GetCustomPropertiesLinkedToData vsoDataRecordset.ID, alngIndices
        For intArrayIndex = LBound(alngIndices) To UBound(alngIndices)
             Debug.Print alngIndices(intArrayIndex)
        Next

    Else

        Debug.Print "Not linked."

    End If

End Sub


Shape.GetCustomPropertyLinkedColumn Method (Visio)

 Copy code hover
[image]

Shape.GetCustomPropertyLinkedColumn Method (Visio)
Send feedback

Published: July 16, 2012

Gets the name of the data column linked to the shape data (custom property) row in the shape's ShapeSheet spreadsheet specified by the custom property index.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetCustomPropertyLinkedColumn(DataRecordsetID, CustomPropertyIndex)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of the data recordset that contains the data column linked to the shape's custom property.
CustomPropertyIndex | Required | Long | The index of the shape data item (custom property) linked to the data column in the data recordset.

Return Value

String

Remarks

If the method fails, call the Shape.IsCustomPropertyLinked method to make sure that the shape data item (custom property row) was actually linked to the data column.

Note Note

In some previous versions of Visio, shape data were called custom properties.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetCustomPropertyLinkedColumn method to get the name of the data recordset column linked to a particular shape data item.

Before running this macro, add at least one data recordset to the DataRecordsets collection of the document. The macro drops a shape onto the page, links the shape to data in the data recordset most recently added to the collection, and then tests to make sure the linking is successful. If it is, it prints the name of the data recordset column linked to the specified shape data item (custom property) in the Immediate window.

VBA Copy code Copy code
Public Sub GetCustomPropertyLinkedColumn_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim vsoShape As Visio.Shape
    Dim intCount As Integer
    Dim boolIsLinked As Boolean
    Dim lngIndex As Long
    Dim strColumnName As String

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount)
    Set vsoShape = ActivePage.DrawRectangle(2, 2, 4, 4)

    vsoShape.LinkToData vsoDataRecordset.ID, 1, True
    boolIsLinked = vsoShape.IsCustomPropertyLinked(vsoDataRecordset.ID, 1)

    If boolIsLinked Then

        strColumnName = vsoShape.GetCustomPropertyLinkedColumn(vsoDataRecordset.ID, 1)
        Debug.Print "Linked column name is", strColumnName

    Else

        Debug.Print "Not linked."

    End If

End Sub


Shape.GetFormulas Method (Visio)

 Copy code hover
[image]

Shape.GetFormulas Method (Visio)
Send feedback

Published: July 16, 2012

Returns the formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetFormulas(SRCStream(), formulaArray())

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | A stream identifying cells to be queried.
formulaArray() | Required | Variant | Out parameter. An array that receives formulas of queried cells.

Return Value

Nothing

Remarks

The GetFormulas method is like the Formula property of a Cell object, except you can use it to obtain the formulas of many cells at once rather than one cell at a time. The GetFormulas method is a specialization of the GetResults method, which can be used to obtain cell formulas or results. Setting up a call to the GetFormulas method involves slightly less work than setting up the GetResults method.

For Shape objects, you can use the GetFormulas method to get formulas of any set of cells.

SID_SRCStream() is an array of 2-byte integers. For Shape objects, SID_SRCStream() should be a one-dimensional array of 3n 2-byte integers for some n >= 1. GetFormulas interprets the stream as:

VBA Copy code Copy code
{sectionIdx, rowIdx, cellIdx}n

where sectionIdx is the section index of the desired cell, rowIdx is its row index and cellIdx is its cell index.

If the GetFormulas method succeeds, formulaArray() returns a one-dimensional array of n variants indexed from 0 to n - 1. Each variant returns a formula as a string. formulaArray() is an out parameter that is allocated by the GetFormulas method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetFormulas method returns. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.) The GetFormulas method fails if formulaArray() is Null.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetFormulas method to get more than one formula when you are using local syntax. Use the GetFormulasU method to get more than one formula when you are using universal syntax.

Example

The following macro shows how to use the GetFormulas method. It assumes that there is an active Microsoft Visio page that has at least three shapes on it. It uses GetFormulas to get the width of shape 1, the height of shape 2, and the angle of shape 3.

This example uses the GetFormulas method of the Page object to get three cell formulas. The input array has four slots for each cell, as it also would for Master objects. For Shape or Style objects, only three slots would be needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub GetFormulas_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer

 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Return the formulas of the cells.
 Dim avarFormulaArray() As Variant
 ActivePage.GetFormulas aintSheetSectionRowColumn, avarFormulaArray

 Debug.Print "Shape 1 width is "; avarFormulaArray(0)
 Debug.Print "Shape 2 height is "; avarFormulaArray(1)
 Debug.Print "Shape 3 angle is "; avarFormulaArray(2)

Exit Sub

HandleError:
 MsgBox "Error"
Exit Sub

End Sub


Shape.GetFormulasU Method (Visio)

 Copy code hover
[image]

Shape.GetFormulasU Method (Visio)
Send feedback

Published: July 16, 2012

Returns the formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetFormulasU(SRCStream(), formulaArray())

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
SRCStream() | Required | Integer | A stream identifying cells to be queried.
formulaArray() | Required | Variant | Out parameter. An array that receives formulas of queried cells.

Return Value

Nothing

Remarks

The GetFormulasU method is like the FormulaU property of a Cell object, except you can use it to obtain the formulas of many cells at once rather than one cell at a time. The GetFormulasU method is a specialization of the GetResults method, which can be used to obtain cell formulas or results. Setting up a call to the GetFormulasU method involves slightly less work than setting up the GetResults method.

You can use the GetFormulasU method to get formulas of any set of cells.

SRCStream() is an array of 2-byte integers. For Shape objects, SRCStream() should be a one-dimensional array of 3n 2-byte integers for some n >= 1. GetFormulasU interprets the stream as:

VBA Copy code Copy code
{sectionIdx, rowIdx, cellIdx}n

where sectionIdx is the section index of the desired cell, rowIdx is its row index and cellIdx is its cell index.

If the GetFormulasU method succeeds, formulaArray() returns a one-dimensional array of n variants indexed from 0 to n - 1. Each variant returns a formula as a string. formulaArray() is an out parameter that is allocated by the GetFormulasU method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetFormulas method returns. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.) The GetFormulasU method fails if formulaArray() is Null.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetFormulas method to get more than one formula when you are using local syntax. Use the GetFormulasU method to get more than one formula when you are using universal syntax.


Shape.GetLinkedDataRecordsetIDs Method (Visio)

 Copy code hover
[image]

Shape.GetLinkedDataRecordsetIDs Method (Visio)
Send feedback

Published: July 16, 2012

Gets the IDs of all the data recordsets that contain data rows linked to the shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetLinkedDataRecordsetIDs(DataRecordsetIDs())

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetIDs() | Required | Long | Out parameter. An array of IDs of data recordsets containing data rows linked to the shape.

Return Value

Nothing

Remarks

For the DataRecordsetIDs() parameter, pass an empty, dimensionless array of type Long that the method fills with the IDs of data recordsets containing data rows linked to the shape.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetLinkedDataRecordsetIDs method to get the IDs of all the data recordsets that contain data rows linked to the shape.

Before running this macro, add at least two data recordsets to the DataRecordsets collection of the document. The macro drops a shape onto the page, links the shape to data in the two data recordsets most recently added to the collection, and then prints the IDs of the linked data recordsets returned by the GetLinkedDataRecordsetIDs method in the Immediate window.

VBA Copy code Copy code
Public Sub GetLinkedDataRecordsetIDs_Example()

    Dim vsoDataRecordset1 As Visio.DataRecordset
    Dim vsoDataRecordset2 As Visio.DataRecordset
    Dim vsoShape As Visio.Shape
    Dim intCount As Integer
    Dim alngDataRecordsetIDs() As Long
    Dim intArrayIndex As Integer

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset1 = Visio.ActiveDocument.DataRecordsets(intCount)
    Set vsoDataRecordset2 = Visio.ActiveDocument.DataRecordsets(intCount - 1)

    Set vsoShape = ActivePage.DrawRectangle(2, 2, 4, 4)

    vsoShape.LinkToData vsoDataRecordset1.ID, 1, True
    vsoShape.LinkToData vsoDataRecordset2.ID, 2, True

    vsoShape.GetLinkedDataRecordsetIDs alngDataRecordsetIDs

    For intArrayIndex = LBound(alngDataRecordsetIDs) To UBound(alngDataRecordsetIDs)
        Debug.Print alngDataRecordsetIDs(intArrayIndex)
    Next

End Sub


Shape.GetLinkedDataRow Method (Visio)

 Copy code hover
[image]

Shape.GetLinkedDataRow Method (Visio)
Send feedback

Published: July 16, 2012

Gets the ID of the data row in the specified data recordset linked to the shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .GetLinkedDataRow(DataRecordsetID)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of the data recordset that contains the linked row.

Return Value

Long

Remarks

The GetLinkedDataRow method fails if the shape is not linked to a data row.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetLinkedDataRow method to get the ID of the data row in the specified data recordset linked to the shape.

Before running this macro, add at least one data recordset to the DataRecordsets collection of the document. The macro drops a shape onto the page, links the shape to a data row in the data recordset most recently added to the collection, gets the ID of the row, and then prints the ID of the row in the Immediate window.

VBA Copy code Copy code
Public Sub GetLinkedDataRow_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim vsoShape As Visio.Shape
    Dim intCount As Integer
    Dim lngRowID As Long

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount)

    Set vsoShape = ActivePage.DrawRectangle(2, 2, 4, 4)

    vsoShape.LinkToData vsoDataRecordset.ID, 1, True

    lngRowID = vsoShape.GetLinkedDataRow(vsoDataRecordset.ID)
    Debug.Print lngRowID

End Sub


Shape.GetResults Method (Visio)

 Copy code hover
[image]

Shape.GetResults Method (Visio)
Send feedback

Published: July 16, 2012

Gets the results or formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetResults(SRCStream(), Flags, UnitsNamesOrCodes(), resultArray())

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | An array that identifies cells to be queried.
Flags | Required | Integer | Flags that influence the type of entries returned in results.
UnitsNamesOrCodes() | Required | Variant | An array of measurement units that results are to be returned in.
resultArray() | Required | Variant | Out parameter. An array that receives results or formulas of queried cells.

Return Value

Nothing

Remarks

The GetResults method is like the Result property for the Cell object, except that it can be used to get the results (values) of many cells at once, rather than one cell at a time.

For Shape objects, you can use the GetResults method to get results of any set of cells.

SID_SRCStream() is an array of 2-byte integers. For Shape objects, SID_SRCStream() should be a one-dimensional array of 3n 2-byte integers for n >= 1. The GetResults method interprets SID_SRCStream() as:

VBA Copy code Copy code
{sectionIdx, rowIdx, cellIdx }n

where sectionIdx is the section index of the desired cell, rowIdx is its row index and cellIdx is its cell index.

The Flags argument indicates what data type the returned results should be expressed in. Its value should be one of the following.

Constant | Value | Description
visGetFloats | 0 | Results returned as doubles (VT_R8).
visGetTruncatedInts | 1 | Results returned as truncated long integers (VT_I4).
visGetRoundedInts | 2 | Results returned as rounded long integers (VT_I4).
visGetStrings | 3 | Results returned as strings (VT_BSTR).
visGetFormulas | 4 | Formulas returned as strings (VT_BSTR).
visGetFormulasU | 5 | Formulas returned in universal syntax (VT_BSTR).

The UnitsNamesOrCodes() parameter is an array that controls what measurement units individual results are returned in. Each entry in the array can be a string such as "inches", "inch", "in.", or "i". Strings may be used for all supported Visio units such as centimeters, meters, miles, and so on. You can also indicate desired units with integer constants (visCentimeters, visInches, etc.) declared by the Visio type library. Note that the values specified in the UnitsNamesOrCodes() array have no effect if Flags is visGetFormulas.

If UnitsNamesOrCodes is not null, the application expects it to be a one-dimensional array of 1 <= u Variants. Each entry can be a string or integer code, or empty (nothing). If the i'th entry is empty, the i'th returned result is returned in the units designated by UnitsNamesOrCodes(j), where j is the index of the most recent prior non-empty entry. Thus if you want all returned values to be in the same units, you need only pass a UnitsNamesOrCodes() array with one entry. If there is no prior non-empty entry, or if no UnitsNameOrCodes() array is supplied, visNumber (0x20) is used. This causes internal units (like the ResultIU property of a Cell object) to be returned.

If the GetResults method succeeds, results returns a one-dimensional array of n variants indexed from zero (0) to n - 1. The type of the returned variants is a function of Flags. The resultArray() parameter is an out parameter that is allocated by the GetResults method, which passes ownership back to the caller. The caller should eventually perform SafeArrayDestroy on the returned array. Note that SafeArrayDestroy has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetResults method returns. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.)

Example

The following example shows how to use the GetResults method. This example assumes there is an active page that has at least 3 shapes on it. It uses the GetResults method to get the width of shape 1, the height of shape 2, and the angle of shape 3.

This example uses the GetResults method of the Page object to get 3 cell formulas. The input array has 4 slots for each cell, as it also would for Master objects. For Shape or Style objects, only 3 slots would be needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub GetResults_Example()

 On Error GoTo HandleError

 Dim intCounter As Integer
 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer

 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Get first two values in inches. The second element in
 'the units array is left uninitialized (empty) because we
 'want the second result in the same units as the first
 'result. The third result is initialized in degrees. Note that
 'units can be expressed as a string or an integer constant.
 Dim avarUnits(1 To 3) As Variant
 avarUnits(1) = "in."
 avarUnits(3) = visDegrees

 'Return results of cells as an array of floating point numbers.
 Dim avarResults() As Variant
 ActivePage.GetResults aintSheetSectionRowColumn, visGetFloats, _
 avarUnits, avarResults

 For intCounter = 0 To 3
 Debug.Print avarResults(intCounter)
 Next

 Exit Sub

HandleError:
 MsgBox "Error"
 Exit Sub

End Sub


Shape.GluedShapes Method (Visio)

 Copy code hover
[image]

Shape.GluedShapes Method (Visio)
Send feedback

Published: July 16, 2012

Returns an array that contains the identifiers of the shapes that are glued to a shape.

Version Information

Version Added: Visio 2010

Syntax

expression .GluedShapes(Flags, CategoryFilter, pOtherConnectedShape)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Required | VisGluedShapesFlags | The dimensionality and directionality of the connection points of the shapes to return.
CategoryFilter | Required | String | The category of shapes to return. See Remarks for more information
pOtherConnectedShape | Optional | Shape | Additional shape to which returned shapes must also be glued.

Return Value

Long()

Remarks

Flags must be one of the following VisGluedShapesFlags constants.

Constant | Value | Description
visGluedShapesAll1D | 0 | Return all 1-D shapes that are glued to this shape.
visGluedShapesIncoming1D | 1 | Return 1-D shapes whose end points are glued to this shape.
visGluedShapesOutgoing1D | 2 | Return 1-D shapes whose begin points are glued to this shape.
visGluedShapesAll2D | 3 | Return all 2-D shapes that are glued to this shape and all 2-D shapes to which this shape is glued.
visGluedShapesIncoming2D | 4 | If the source object is a 1-D shape, return the 2-D shape to which the begin point is glued. If the source object is a 2-D shape, return the 2-D shapes that are glued to this shape.
visGluedShapesOutgoing2D | 5 | If the source object is a 1-D shape, return the 2-D shape to which the end point is glued. If the source object is a 2-D shape, return the 2-D shapes to which this shape is glued.

Categories are user-defined strings that you can use to categorize shapes and thereby to restrict membership in a container. You can define categories in the User.msvShapeCategories cell in the ShapeSheet for a shape. You can define multiple categories for a shape by separating those categories with semi-colons.

Connection points with dual directionality (both inward and outward) are identified as incoming or outgoing based on the way that they are used in a particular connection.

The GluedShapes method fails if the source object is a part of a master or a guide. Guides are excluded from any list of shapes returned.

If you specify an invalid shape for pOtherConnectedShape, Microsoft Visio returns an Invalid Parameter error.

GluedShapes returns an empty array if there are no qualifying shapes to return.


Shape.Group Method (Visio)

 Copy code hover
[image]

Shape.Group Method (Visio)
Send feedback

Published: July 16, 2012

Groups the objects that are selected in a selection, or it converts a shape into a group.

Version Information

Version Added: Visio 2.0

Syntax

expression .Group

expression A variable that represents a Shape object.

Return Value

Shape

Example

The following example shows how to group Shape objects.

VBA Copy code Copy code

Public Sub Group_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoGroupShape As Visio.Shape
 Dim vsoSelection As Visio.Selection

 'Draw two rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 2, 2, 1)
 Set vsoShape2 = ActivePage.DrawRectangle(1, 4, 2, 3)

 'Deselect all shapes, and then select the two rectangles.
 Set vsoSelection = ActiveWindow.Selection
 vsoSelection.Select vsoShape1, visDeselectAll + visSelect
 vsoSelection.Select vsoShape2, visSelect

 'Group the rectangles into a group shape.
 Set vsoGroupShape = vsoSelection.Group

End Sub


Shape.HasCategory Method (Visio)

 Copy code hover
[image]

Shape.HasCategory Method (Visio)
Send feedback

Published: July 16, 2012

Returns True if the specified category is in the shape categories list.

Version Information

Version Added: Visio 2010

Syntax

expression .HasCategory(Category)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Category | Required | String | The name of the category.

Return Value

Boolean

Remarks

You can pass only a single category for the Category parameter. Passing a semicolon-delimited list of categories produces an Invalid Parameter error.

Categories are user-defined strings that you can use to categorize shapes and thereby to restrict membership in a container. You can define categories in the User.msvShapeCategories cell in the ShapeSheet for a shape. You can define multiple categories for a shape by separating those categories with semi-colons.


Shape.HitTest Method (Visio)

 Copy code hover
[image]

Shape.HitTest Method (Visio)
Send feedback

Published: July 16, 2012

Determines if a given x,y position hits outside, inside, or on the boundary of a shape.

Version Information

Version Added: Visio 4.5

Syntax

expression .HitTest(xPos, yPos, Tolerance)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xPos | Required | Double | The x-coordinate to be tested for a hit.
yPos | Required | Double | The y-coordinate to be tested for a hit.
Tolerance | Required | Double | How close xPos,yPos must be to a shape for a hit to occur.

Return Value

Integer

Remarks

The HitTest method considers only visible geometry and ignores hidden geometry.

Use internal drawing units (inches in the drawing) for the xPos, yPos, and Tolerance values. These values should also be in, and with respect to, the coordinate space of the page, master, or group shape that contains the shape being hit tested.

The following are possible values returned by the HitTest method, and are declared by the Visio type library in VisHitTestResults .

Constant | Value
visHitOutside | 0
visHitOnBoundary | 1
visHitInside | 2

Data graphic callout shapes (and their sub-shapes) that are applied to the parent shape are excluded from hit-test calculations. If the parent shape is itself a data graphic callout shape, its geometry (and that of its sub-shapes) is not excluded from hit-test calculations.


Shape.Import Method (Visio)

 Copy code hover
[image]

Shape.Import Method (Visio)
Send feedback

Published: July 16, 2012

Imports a file into the current document.

Version Information

Version Added: Visio 3.0

Syntax

expression .Import(FileName)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file to import; must be a fully qualified path.

Return Value

Shape

Remarks

The Import method imports the file specified by FileName onto a page, or into a master or group.

The file name extension indicates which import filter to use. If the filter is not installed, the Import method returns an error. The Import method uses the default preference settings for the specified filter and does not prompt the user for non-default arguments.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Import method to import a bitmap image onto the drawing page. This example assumes that there is a file with the name sampleImage.bmp on drive C of your computer.

VBA Copy code Copy code
Public Sub Import_Example()

 ActivePage.Import ("C:\sampleImage.bmp")

End Sub


Shape.InsertFromFile Method (Visio)

 Copy code hover
[image]

Shape.InsertFromFile Method (Visio)
Send feedback

Published: July 16, 2012

Adds a linked or embedded object to a page, master, or group.

Version Information

Version Added: Visio 4.1

Syntax

expression .InsertFromFile(FileName, Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file that contains the object to link or embed.
Flags | Required | Integer | Flags that influence how the object is inserted.

Return Value

Shape

Remarks

The InsertFromFile method creates a new shape that represents a linked or embedded OLE object.

The Flags argument is a bitmask that should be a combination of the following values.

Constant | Value | Description
visInsertLink | &H8 | If set, the new shape represents an OLE link to the named file. Otherwise, the InsertFromFile method produces an OLE object from the contents of the named file and embeds it in the document that contains the page, master, or group.
visInsertIcon | &H10 | Displays the new shape as an icon.

Security Use caution when you are adding ActiveX controls to your application. ActiveX controls may be designed in such a way that their use could pose a security risk. We recommend that you use controls from trusted sources only.


Shape.InsertObject Method (Visio)

 Copy code hover
[image]

Shape.InsertObject Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new embedded object or ActiveX control to a page, master, or group.

Version Information

Version Added: Visio 4.1

Syntax

expression .InsertObject(ClassOrProgID, Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
ClassOrProgID | Required | String | Identifies the type of object or control to create.
Flags | Required | Integer | Flags that influence the operation.

Return Value

Shape

Remarks

ClassOrProgID is a string that identifies the kind of object or control to create. It can be either the object or control's class ID (GUID) in string form or the object or control's program ID of the handler for the class.

  • If ClassOrProgID is a string representing a class ID, it looks like "{D3E34B21-9D75-101A-8C3D-00AA001A1652}."

  • If ClassOrProgID is a string representing a program ID, it looks like "paint.picture" or "forms.combobox.1".

See vendor-specific documentation or browse the registry to determine which class IDs and program IDs are associated with objects and controls provided by other applications.

The Flags argument is a bitmask that can include one of the following values.

Constant | Value | Description
visInsertIcon | &H10 | Displays the new shape as an icon.
visInsertDontShow | &H1000 | Does not execute the new object's show verb.

If both visInsertIcon and visInsertDontShow are specified, the InsertObject method fails. If you want to insert an object that is displayed as an icon, you must allow the application to execute the object's show verb.

The Flags argument can also include one of the following values.

Constant | Value
visInsertAsControl | &H2000
visInsertAsEmbed | &H4000

Values in visInsertAsControl and visInsertAsEmbed only have an effect if the class identified by ClassOrProgID is identified in the registry as a control that can be inserted. If neither visInsertAsControl nor visInsertAsEmbed is specified and the object can be either a control or an embedded object, the application inserts it as a control.

In rare cases, Visio 5.0 or later versions may insert a control whereas earlier versions of Visio would have responded to the same call by inserting an embedded object. If a control is inserted, this method places the document in design mode, causing any code executing in the document to halt until the document is returned to run mode.

Security Use caution when you are adding ActiveX controls to your application. ActiveX controls may be designed in such a way that their use could pose a security risk. We recommend that you use controls from trusted sources only. Sign any controls you author.

Caution note Caution

Modifying the registry in any manner, whether through the Registry Editor or programmatically, always carries some degree of risk. Incorrect modification can cause serious problems that may require you to reinstall your operating system. It is a good practice to always back up a computer's registry first before modifying it. If you are running Microsoft Windows NT or Microsoft Windows 2000, you should also update your Emergency Repair Disk (ERD).


Shape.IsCustomPropertyLinked Method (Visio)

 Copy code hover
[image]

Shape.IsCustomPropertyLinked Method (Visio)
Send feedback

Published: July 16, 2012

Returns whether the shape data (custom property) row in the Shape Data section of the shape's ShapeSheet spreadsheet is linked to a data row in the specified data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .IsCustomPropertyLinked(DataRecordsetID, CustomPropertyIndex)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of the data recordset that contains the data row.
CustomPropertyIndex | Required | Long | The index of the shape data (custom property) row in the Shape Data section of the shape's ShapeSheet.

Return Value

Boolean

Remarks

Call this method before calling the GetCustomPropertyLinkedColumnmethod to make sure that the shape data item (custom property row) is actually linked to a data column.

Note Note

In some previous versions of Visio, shape data were called custom properties.

Knowing how shapes are linked to data can help prevent conflicts and broken links when you refresh the data in one or more data recordsets.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the IsCustomPropertyLinked method to determine whether a shape's custom property row is linked to a data row in a data recordset.

Before running this macro, add at least one data recordset to the DataRecordsets collection of the document. The macro drops a shape and then tests whether the shape's first shape data item is linked to a data row in the data recordset most recently added to the collection, printing the result in the Immediate window. The test will fail, because the shape has not been linked to data. Then the shape is linked to data in the most recently added data recordset, and the test is run again.

VBA Copy code Copy code
Public Sub IsCustomPropertyLinked_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim vsoShape As Visio.Shape
    Dim intCount As Integer
    Dim boolIsLinked As Boolean

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount)

    Set vsoShape = ActivePage.DrawRectangle(2, 2, 4, 4)

    boolIsLinked = vsoShape.IsCustomPropertyLinked(vsoDataRecordset.ID, 1)

    Debug.Print boolIsLinked

    vsoShape.LinkToData vsoDataRecordset.ID, 1, True
    boolIsLinked = vsoShape.IsCustomPropertyLinked(vsoDataRecordset.ID, 1)

    Debug.Print boolIsLinked

End Sub


Shape.Layout Method (Visio)

 Copy code hover
[image]

Shape.Layout Method (Visio)
Send feedback

Published: July 16, 2012

Lays out the shapes or reroutes the connectors (or both) for the page, master, group, or selection.

Version Information

Version Added: Visio 4.5

Syntax

expression .Layout

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

Using the Layout method is equivalent to clicking Re-Layout Page in the Layout group on the Design tab and then clicking More Layout Options and configuring options in the Configure Layout dialog box.

Behavior of the Layout method can be influenced by setting the formulas or results of cells in the Page Layout and Shape Layout ShapeSheet sections of the page, master, or group to be laid out. You can infer how these cells influence the behavior of the Layout method by examining the effect of various Configure Layout dialog box options on the values of these cells.

To lay out a subset of the shapes of a page, master, or group, establish a Selection object in which the shapes to be laid out are selected, and then call the Layout method. If the Layout method is performed on a Selection object and the object has no shapes selected, all shapes in the page, master, or group of the selection are laid out.


Shape.LinkToData Method (Visio)

 Copy code hover
[image]

Shape.LinkToData Method (Visio)
Send feedback

Published: July 16, 2012

Links a shape to a data row in a data recordset.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .LinkToData(DataRecordsetID, RowID, AutoApplyDataGraphics)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
DataRecordsetID | Required | Long | The ID of the data recordset containing the data to link to.
RowID | Required | Long | The ID of the row in the data recordset containing the particular data record to link to.
AutoApplyDataGraphics | Optional | Boolean | Whether to automatically apply a data graphic to the linked shapes. See Remarks for more information.

Return Value

Nothing

Remarks

The Shape.LinkToData method functions much like the same method of the Selection object, Selection.LinkToData, except that it links a single shape, instead of a selection of shapes, to a single data row.

If you pass True for the AutoApplyDataGraphics parameter, Microsoft Visio re-applies the existing data graphic to a shape if it already had a data graphic applied before you called the method. For a shape that previously had no data graphic, Visio applies the data graphic most recently applied to any other shape in the current document.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the LinkToData method to link a shape to a data row.

Before running this macro, add at least one data recordset to the DataRecordsets collection of the document. The macro uses the ID of the data recordset most recently added to the collection. It draws a rectangle shape on the page and links it to the data in the first row of the data recordset, while applying the default data graphic to the shape.

VBA Copy code Copy code
Public Sub LinkToData_Example()

    Dim vsoDataRecordset As Visio.DataRecordset
    Dim vsoShape As Visio.Shape
    Dim intCount As Integer

    intCount = Visio.ActiveDocument.DataRecordsets.Count
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount)

    Set vsoShape = ActivePage.DrawRectangle(2, 2, 5, 5)

    vsoShape.LinkToData vsoDataRecordset.ID, 1, True

End Sub


Shape.MoveToSubprocess Method (Visio)

 Copy code hover
[image]

Shape.MoveToSubprocess Method (Visio)
Send feedback

Published: July 16, 2012

Moves the shape to the specified page and drops a replacement shape on the source page, then links it to the target page. Returns the selection of moved shapes on the target page.

Version Information

Version Added: Visio 2010

Syntax

expression .MoveToSubprocess(Page, ObjectToDrop, NewShape)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | Page | The sub-process page to which the shape should be moved. You cannot pass the current page.
ObjectToDrop | Required | [UNKNOWN] | The replacement shape to drop.
NewShape | Optional | Shape | Out parameter. Returns the shape that is linked to the new page.

Return Value

Selection

Remarks

ObjectToDrop is typically a Microsoft Visio object, such as a Master or MasterShortcut object. However, it can be any OLE object that provides an IDataObject interface. If ObjectToDrop is null, Visio drops a default shape.


Shape.Offset Method (Visio)

 Copy code hover
[image]

Shape.Offset Method (Visio)
Send feedback

Published: July 16, 2012

Offsets a shape a specified amount.

Version Information

Version Added: Visio 2003

Syntax

expression .Offset(Distance)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Distance | Required | Double | Specifies the distance to offset the shape.

Return Value

Nothing

Remarks

Calling the Offset method is equivalent to clicking Offset in the Microsoft Visio user interface (click Operations in the Shape Design group on the Developer tab).

For a specified line or curve, the offset is implemented as a pair of lines or curves that are equidistant from the original line or curve. Offset shapes inherit line patterns from the original shapes. They do not inherit any fill patterns or text from the original shapes.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Offset method to offset a line shape by a specified amount.

VBA Copy code Copy code
Public Sub Offset_Example()

 Dim vsoShape As Visio.Shape

 Set vsoShape = Application.ActiveWindow.Page.DrawLine(3, 3, 6, 6)

 ActiveWindow.DeselectAll
 ActiveWindow.Select vsoShape, visSelect
 vsoShape.Offset(2)

End Sub


Shape.OpenDrawWindow Method (Visio)

 Copy code hover
[image]

Shape.OpenDrawWindow Method (Visio)
Send feedback

Published: July 16, 2012

Opens a new drawing window that displays a group.

Version Information

Version Added: Visio 4.1

Syntax

expression .OpenDrawWindow

expression A variable that represents a Shape object.

Return Value

Window

Remarks

The OpenDrawWindow method opens a new drawing window, even if the group is already displayed in a drawing window.


Shape.OpenSheetWindow Method (Visio)

 Copy code hover
[image]

Shape.OpenSheetWindow Method (Visio)
Send feedback

Published: July 16, 2012

Opens a ShapeSheet window for a Shape object.

Version Information

Version Added: Visio 4.1

Syntax

expression .OpenSheetWindow

expression A variable that represents a Shape object.

Return Value

Window

Remarks

The OpenSheetWindow method opens a new ShapeSheet window for the shape even if the information is already displayed in another window.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the OpenSheetWindow method to open the ShapeSheet window of a Shape object.

VBA Copy code Copy code

Public Sub OpenSheetWindow_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoSheetWindow As Visio.Window

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 1, 2, 3)

 'Open the ShapeSheet window of vsoShape.
 Set vsoSheetWindow = vsoShape.OpenSheetWindow

End Sub


Shape.Paste Method (Visio)

 Copy code hover
[image]

Shape.Paste Method (Visio)
Send feedback

Published: July 16, 2012

Pastes the contents of the Clipboard into an object.

Version Information

Version Added: Visio 2002

Syntax

expression .Paste(Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Flags | Optional | Variant | Determines how shapes are translated during the paste operation.

Return Value

Nothing

Remarks

The Paste method works only with Shape objects that are group shapes. Use the Type property of a shape to determine whether it is a group.

Possible values for Flags are declared by the Visio type library in VisCutCopyPasteCodes, and are described in the following table.

Flag | Value | Description
visCopyPasteNormal | &H0 | Follow default copying behavior.
visCopyPasteNoTranslate | &H1 | Copy shapes to their original coordinate locations.
visCopyPasteCenter | &H2 | Copy shapes to the center of the page.
visCopyPasteNoHealConnectors | &H4 | Do not clean up connectors attached to cut shapes.
visCopyPasteNoContainerMembers | &H8 | Do not cut and copy unselected members of containers or lists.
visCopyPasteNoAssociatedCallouts | &H16 | Do not cut and copy unselected callouts associated with shapes.
visCopyPasteDontAddToContainers | &H32 | Do not add pasted shapes to any underlying containers.
visCopyPasteNoCascade | &H64 | Do not offset shapes on copy.

Setting Flags to visCopyPasteNormal is the equivalent of the behavior in the user interface. You should use visCopyPasteNormal and the other flags consistently. For example, if you use the value visCopyPasteNoTranslate to copy, you should also use that value to paste, because that is the only way to ensure that shapes are pasted to their original coordinate location.

If you need to control the format of the pasted information and (optionally) establish a link to a source file (for example, a Microsoft Word document), use the PasteSpecial method.


Shape.PasteSpecial Method (Visio)

 Copy code hover
[image]

Shape.PasteSpecial Method (Visio)
Send feedback

Published: July 16, 2012

Inserts the contents of the Clipboard, allowing you to control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Word document).

Version Information

Version Added: Visio 2002

Syntax

expression .PasteSpecial(Format, Link, DisplayAsIcon)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Format | Required | Long | The internal Clipboard format.
Link | Optional | Variant | True to establish a link to the source of the pasted data; otherwise, False (the default). Ignored if the source data is not suitable for, or doesn't support, linking.
DisplayAsIcon | Optional | Variant | True to display the pasted data as an icon; otherwise, False (the default).

Return Value

Nothing

Remarks

To simply paste the contents of the Clipboard into an object, use the Paste method.

The PasteSpecial method of a Shape object works only with Shape objects that are group shapes. Use the Type property of a shape to determine whether it is a group.

The value of the Format argument can be any of the following:

  • A value from VisPasteSpecialCodes (see the following table).

  • Any of the standard Clipboard formats, for example, CF_TEXT. For more information, see the Microsoft Platform SDK on MSDN, the Microsoft Developer Network Web site.

  • Any value returned from a call to the RegisterClipboardFormat function. For details, see the Microsoft Platform SDK on MSDN.

Note Note

Before calling Microsoft Windows functions, you should understand how arguments and data types are handled by the Windows API DLLs. Incorrectly calling Windows functions may result in invalid page faults or other unexpected behaviors. For more information on calling Windows functions, search for "Windows API" on MSDN.

Possible values for Format declared by the Visio type library in VisPasteSpecialCodes are described in the following table.

Constant | Value | Description
visPasteBitmap | 2 | Paste bitmap.
visPasteDIB | 8 | Paste device-independent bitmap.
visPasteEMF | 14 | Paste enhanced metafile.
visPasteHyperlink | 65538 | Paste hyperlink.
visPasteInk | 65544 | Paste Ink data.
visPasteMetafile | 3 | Paste metafile.
visPasteOEMText | 7 | Paste OEM text.
visPasteOLEObject | 65536 | Paste OLE object.
visPasteRichText | 65537 | Paste rich text.
visPasteText | 1 | Paste ANSI text.
visPasteURL | 65539 | Paste Uniform Resource Locator (URL).
visPasteVisioIcon | 65543 | Paste Visio icon.
visPasteVisioMastersXML | 65546 | Paste Visio masters XML.
visPasteVisioMasters | 65541 | Paste Visio masters.
visPasteVisioShapesXML | 65545 | Paste Visio shapes XML.
visPasteVisioShapesWithoutDataLinks | 65548 | Paste Visio drawing data without internal data links.
visPasteVisioShapes | 65540 | Paste Visio shapes.
visPasteVisioText | 65542 | Paste Visio text.


Shape.RemoveFromContainers Method (Visio)

 Copy code hover
[image]

Shape.RemoveFromContainers Method (Visio)
Send feedback

Published: July 16, 2012

Removes the shape from all lists and containers of which it is a member.

Version Information

Version Added: Visio 2010

Syntax

expression .RemoveFromContainers

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

When you call the RemoveFromContainers method, Microsoft Visio uses the ContainerProperties.ResizeAsNeeded property setting for each container to determine how to resize the container.


Shape.ReplaceShape Method (Visio)

 Copy code hover
[image]

Shape.ReplaceShape Method (Visio)
See also Send feedback

Published: July 16, 2012

Replaces the specified shape with an instance of the master passed as the first parameter, and returns the new shape.

Syntax

expression .ReplaceShape(MasterOrMasterShortcutToDrop,ReplaceFlags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data type | Description
MasterOrMasterShortcutToDrop | Required | UNKNOWN | Specifies the replacement shape to drop. Must be either a Master or MasterShortcut object.
ReplaceFlags | Optional | INT32 | Specifies the properties of the original shape to retain in the new shape. Possible values include any of the VisReplaceFlags constants, and certain combinations of those constants. See Remarks for more information.

Return value

SHAPE

Remarks

Allowable values to pass for the ReplaceFlags parameter include either visReplaceShapeDefault or any combination of one or more of the remaining four flags.

See also

Concepts

Shape Object

Other resources

Shape Members


Shape.Resize Method (Visio)

 Copy code hover
[image]

Shape.Resize Method (Visio)
Send feedback

Published: July 16, 2012

Resizes the shape by moving shape handles as specified.

Version Information

Version Added: Visio 2010

Syntax

expression .Resize(Direction, Distance, UnitCode)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | VisResizeDirection | The direction that corresponds to the shape handle. See Remarks for possible values.
Distance | Required | Double | The distance to move the shape edge or corner; positive values move outward and negative values move inward.
UnitCode | Required | VisUnitCodes | The units of measure to use for the resize distance.

Return Value

Nothing

Remarks

Direction must be one of the following VisResizeDirection constants.

Constant | Value | Description
visResizeDirE | 0 | Right, middle shape handle.
visResizeDirNE | 1 | Right, top shape handle.
visResizeDirN | 2 | Center, top shape handle.
visResizeDirNW | 3 | Left, top shape handle.
visResizeDirW | 4 | Left, middle shape handle.
visResizeDirSW | 5 | Left, bottom shape handle.
visResizeDirS | 6 | Center, bottom shape handle.
visResizeDirSE | 7 | Right, bottom shape handle.

When you resize a shape in a diagonal direction (that is, NE, NW, SE, or SW), the specified distance is applied along both the horizontal and vertical axes (as opposed to along the compass direction.)


Shape.ReverseEnds Method (Visio)

 Copy code hover
[image]

Shape.ReverseEnds Method (Visio)
Send feedback

Published: July 16, 2012

Reverses an object by flipping it both horizontally and vertically.

Version Information

Version Added: Visio 2.0

Syntax

expression .ReverseEnds

expression A variable that represents a Shape object.

Return Value

Nothing


Shape.Rotate90 Method (Visio)

 Copy code hover
[image]

Shape.Rotate90 Method (Visio)
Send feedback

Published: July 16, 2012

Rotates an object 90 degrees counterclockwise.

Version Information

Version Added: Visio 2.0

Syntax

expression .Rotate90

expression A variable that represents a Shape object.

Return Value

Nothing


Shape.SendBackward Method (Visio)

 Copy code hover
[image]

Shape.SendBackward Method (Visio)
Send feedback

Published: July 16, 2012

Moves a shape or selected shapes back one position in the z-order.

Version Information

Version Added: Visio 2.0

Syntax

expression .SendBackward

expression A variable that represents a Shape object.

Return Value

Nothing

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to move a shape back one position in the z-order on a page.

VBA Copy code Copy code

Public Sub SendBackward_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape

 'Draw three rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 1, 5, 5)
 vsoShape1.Text = "1"
 Set vsoShape2 = ActivePage.DrawRectangle(2, 2, 6, 6)
 vsoShape2.Text = "2"
 Set vsoShape3 = ActivePage.DrawRectangle(3, 3, 7, 7)
 vsoShape3.Text = "3"

 'Move vsoShape2 back one position in the z-order.
 vsoShape2.SendBackward

End Sub


Shape.SendToBack Method (Visio)

 Copy code hover
[image]

Shape.SendToBack Method (Visio)
Send feedback

Published: July 16, 2012

Moves the shape or selected shapes to the back of the z-order.

Version Information

Version Added: Visio 2.0

Syntax

expression .SendToBack

expression A variable that represents a Shape object.

Return Value

Nothing

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to move a shape to the back of the z-order on a page.

VBA Copy code Copy code

Public Sub SendToBack_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape

 'Draw three rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 1, 5, 5)
 vsoShape1.Text = "1"
 Set vsoShape2 = ActivePage.DrawRectangle(2, 2, 6, 6)
 vsoShape2.Text = "2"
 Set vsoShape3 = ActivePage.DrawRectangle(3, 3, 7, 7)
 vsoShape3.Text = "3"

 'Move vsoShape3 to the back of the z-order.
 vsoShape3.SendToBack

End Sub


Shape.SetBegin Method (Visio)

 Copy code hover
[image]

Shape.SetBegin Method (Visio)
Send feedback

Published: July 16, 2012

Moves the begin point of a one-dimensional (1-D) shape to the coordinates represented by xPos and yPos.

Version Information

Version Added: Visio 2.0

Syntax

expression .SetBegin(xPos, yPos)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xPos | Required | Double | The new x-coordinate of the begin point.
yPos | Required | Double | The new y-coordinate of the begin point.

Return Value

Nothing

Remarks

The SetBegin method only applies to 1-D shapes. If the indicated shape is a 2-D shape, an error is generated.

The coordinates represented by the xPos and yPos arguments are parent coordinates, measured from the origin of the shape's parent (the page or group that contains the shape).


Shape.SetCenter Method (Visio)

 Copy code hover
[image]

Shape.SetCenter Method (Visio)
Send feedback

Published: July 16, 2012

Moves a shape so that its pin is positioned at the coordinates represented by xPos and yPos. .

Version Information

Version Added: Visio 2.0

Syntax

expression .SetCenter(xPos, yPos)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xPos | Required | Double | The new x-coordinate of the center of rotation (PinX).
yPos | Required | Double | The new y-coordinate of the center of rotation (PinY).

Return Value

Nothing

Remarks

The coordinates represented by the xPos and yPos arguments are parent coordinates, measured from the origin of the shape's parent (the page or group that contains the shape).

The SetCenter method only moves the point, in parent coordinates, about which the shape rotates. It does not change the point, in local coordinates, about which the shape rotates. The overall effect is to move the shape with respect to its parent shape (or the page).


Shape.SetEnd Method (Visio)

 Copy code hover
[image]

Shape.SetEnd Method (Visio)
Send feedback

Published: July 16, 2012

Moves the endpoint of a one-dimensional (1-D) shape to the coordinates represented by xPos and yPos.

Version Information

Version Added: Visio 2.0

Syntax

expression .SetEnd(xPos, yPos)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
xPos | Required | Double | The new x-coordinate of the endpoint.
yPos | Required | Double | The new y-coordinate of the endpoint.

Return Value

Nothing

Remarks

The SetEnd method applies only to 1-D shapes. If the indicated shape is a 2-D shape, an error is returned.

The coordinates represented by the xPos and yPos arguments are parent coordinates, measured from the origin of the shape's parent (the page or group that contains the shape).


Shape.SetFormulas Method (Visio)

 Copy code hover
[image]

Shape.SetFormulas Method (Visio)
Send feedback

Published: July 16, 2012

Sets the formulas of one or more cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .SetFormulas(SRCStream(), formulaArray(), Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | Stream identifying cells to be modified.
formulaArray() | Required | Variant | Formulas to be assigned to identified cells.
Flags | Required | Integer | Flags that influence the behavior of SetFormulas.

Return Value

Integer

Remarks

The SetFormulas method behaves like the Formula property except that you can use it to set the formulas of many cells at once, rather than one cell at a time.

For Shape objects, you can use the SetFormulas method to set results of any set of cells. You tell the SetFormulas method which cells you want to set by passing an array of integers in SID_SRCStream(). SID_SRCStream() is a one-dimensional array of 2-byte integers.

For Shape objects, SID_SRCStream() should be a one-dimensional array of 3n 2-byte integers for n >= 1. The SetFormulas method interprets the stream as:

VBA Copy code Copy code
{sectionIdx, rowIdx, cellIdx }n

where sectionIdx is the section index of the desired cell, rowIdx is its row index, and cellIdx is its cell index.

The formulaArray() parameter should be a one-dimensional array of 1 <= m variants. Each Variant should be a String, a reference to a String, or Empty. If formulaArray(i) is empty, the i'th cell will be set to the formula in formulaArray(j), where j is the index of the most recent prior entry that is not empty. If there is no prior entry that is not empty, the corresponding cell is not altered. If fewer formulas than cells are specified (m < n), the i'th cell, i > m, will be set to the same formula as was chosen to set the m'th cell to. Thus to set many cells to the same formula, you need pass only one copy of the formula.

The Flags argument should be a bitmask of the following values.

Constant | Value | Description
visSetBlastGuards | &H2 | Override present cell values even if they're guarded.
visSetTestCircular | &H4 | Test for establishment of circular cell references.
visSetUniversalSyntax | &H8 | Formulas are in universal syntax.

The value returned by the SetFormulas method is the number of entries in SID_SRCStream() that were successfully processed. If i < n entries process correctly, but an error occurs on the i + 1st entry, the SetFormulas method raises an exception and returns i. Otherwise, n is returned.

Example

The following macro shows how to use the SetFormulas method. It assumes that there is an active Microsoft Office Visio page that has at least three shapes on it. It uses the GetFormulas method to get the width of shape 1, the height of shape 2, and the angle of shape 3. It then uses SetFormulas to set the width of shape 1 to the height of shape 2 and the height of shape 2 to the width of shape 1. The angle of shape 3 is left unaltered.

This example uses the GetFormulas method of the Page object to get three cell formulas and the SetFormulas method of the same object to set the formulas. The input array has four slots for each cell, as it also would for Master objects. For Shape or Style objects, only three slots are needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub SetFormulas_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To 3 * 4) As Integer
 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Return the formulas of the cells.
 Dim avarFormulaArray() As Variant
 ActivePage.GetFormulas aintSheetSectionRowColumn, avarFormulaArray

 'Use SetFormulas to:
 ' - Set the width of shape 1 to height of shape 2.
 ' - Set height of shape 2 to width of shape 1.
 ' Note: avarFormulaArray() is indexed from 0 to 2.
 Dim varTemp As variant
 varTemp = avarFormulaArray(0)
 avarFormulaArray(0) = avarFormulaArray(1)
 avarFormulaArray(1) = varTemp

 'Pass the same array back to SetFormulas that we
 'just passed to GetFormulas, leaving angle alone. By setting
 'the sheet ID entry in the third slot of the
 'aintSheetSectionRowColumn array to visInvalShapeID,
 'we tell SetFormulas to ignore that slot.
 aintSheetSectionRowColumn (9) = visInvalShapeID

 'Tell Microsoft Visio to set the formulas of the cells.
 ActivePage.SetFormulas aintSheetSectionRowColumn, avarFormulaArray, 0

 Exit Sub

HandleError:

 MsgBox "Error"

 Exit Sub

End Sub


Shape.SetQuickStyle Method (Visio)

 Copy code hover
[image]

Shape.SetQuickStyle Method (Visio)
See also Send feedback

Published: July 16, 2012

Sets the quick style of the specified shape.

Syntax

expression .SetQuickStyle(lineMatrix,fillMatrix,effectsMatrix,fontMatrix,lineColor,fillColor,shadowColor,fontColor)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data type | Description
lineMatrix | Required | VISQUICKSTYLEMATRIXINDICES | Specifies the shape style index that determines the line-formatting properties (for example, dash type or weight) to retrieve from the active theme and variant.
fillMatrix | Required | VISQUICKSTYLEMATRIXINDICES | Specifies the shape style index that determines the fill-formatting properties (for example, fill type or gradient stops) to retrieve from the active theme and variant.
effectsMatrix | Required | VISQUICKSTYLEMATRIXINDICES | Specifies the shape style index that determines the font-formatting properties (for example, font style) to retrieve from the active theme and variant.
fontMatrix | Required | VISQUICKSTYLEMATRIXINDICES | Specifies the shape style index that determines the font-formatting properties (for example, font style) to retrieve from the active theme and variant.
lineColor | Required | VISQUICKSTYLECOLORS | Specifies the color index that determines the line color to retrieve from the active theme and variant to use in line formatting.
fillColor | Required | VISQUICKSTYLECOLORS | Specifies the color index that determines the fill color to retrieve from the active theme and variant to use in fill formatting.
shadowColor | Required | VISQUICKSTYLECOLORS | Specifies the color index that determines the shadow color to retrieve from the active theme and variant to use in shadows.
fontColor | Required | VISQUICKSTYLECOLORS | Specifies the color index that determines the font color to retrieve from the active theme and variant to use in shape text.

Return value

VOID

Remarks

Calling the SetQuickStyle method corresponds to setting a quick style in the Shape Styles gallery on the Home tab of the ribbon.

See also

Concepts

Shape Object

Other resources

Shape Members


Shape.SetResults Method (Visio)

 Copy code hover
[image]

Shape.SetResults Method (Visio)
Send feedback

Published: July 16, 2012

Sets the results or formulas of one or more cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .SetResults(SRCStream(), UnitsNamesOrCodes(), resultArray(), Flags)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | An array identifying cells to be modified.
UnitsNamesOrCodes() | Required | Variant | Measurement units to be attributed to entries in results array.
resultArray() | Required | Variant | Out parameter. Results or formulas to be assigned to identified cells.
Flags | Required | Integer | Flags that influence the behavior of SetResults.

Return Value

Integer

Remarks

The SetResults method is like the Result method of a Cell object, except that it can be used to set the results (values) of many cells at once, rather than one cell at a time.

For Shape objects, you can use the SetResults method to set results of any set of cells. You tell the SetResults method which cells you want to set by passing an array of integers in SID_SRCStream(). SID_SRCStream() is a one-dimensional array of 2-byte integers.

For Shape objects, SID_SRCStream() should be a one-dimensional array of 3n 2-byte integers for n >= 1. The SetResults method interprets the stream as:

VBA Copy code Copy code
{sectionIdx, rowIdx, cellIdx }n

where sectionIdx is the section index of the desired cell, rowIdx is its row index, and cellIdx is its cell index.

The UnitsNamesOrCodes() array controls what measurement units individual entries in results are in. Each entry in the array can be a string such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Office Visio units such as centimeters, meters, miles, and so on. You can also indicate desired units with integer constants (visCentimeters, visInches, and so on) declared by the Visio type library in VisUnitCodes. For a list of constants used for units of measure, see About Units of Measure. Note that the values specified in the UnitsNamesOrCodes() array have no effect if visSetFormulas is set in Flags.

If UnitsNamesOrCodes() is not empty, we expect it to be a one-dimensional array of 1 <= u variants. Each entry can be a string or integer code, or empty (nothing). If the i'th entry is empty, the i'th entry in resultArray is in the units designated by UnitsNamesOrCodes()(j), where j is the most recent prior entry that is not empty. Thus, if you want all entries in resultArray to be interpreted in the same units, you need only pass a UnitsNamesOrCodes() array that has one entry. If there is no prior entry that is not empty, or if no UnitsNamesOrCodes() array is supplied, visNumber (0x20) will be used. This causes the application to default to internal units (as does the ResultIU property of a Cell object).

The resultArray() parameter should be a one-dimensional array of 1 <= m variants. A result can be passed as Double, Integer, String, or a reference to a String. Strings are accepted only if visSetFormulas is set in Flags, in which case strings are interpreted as formulas. If resultArray(i) is empty, the i'th cell will be set to the value in resultArray(j), where j is the index of the most recent prior entry that is not empty. If there is no prior entry that is not empty, the corresponding cell is not altered. If fewer results than cells are specified (if m < n), the i'th cell, i < m, will be set to the same value as the m'th cell. Thus, to set many cells to the same value, you need only pass one copy of the value.

The Flags parameter should be a bitmask of the following values.

Constant | Value | Description
visSetFormulas | &H1 | Treat strings in results as formulas.
visSetBlastGuards | &H2 | Override present cell values even if they're guarded.
visSetTestCircular | &H4 | Test for establishment of circular cell references.
visSetUniversalSyntax | &H8 | Formulas are in universal syntax

The value returned by the SetResults method is the number of entries in SID_SRCStream() that were successfully processed. If i < n entries are processed correctly, but an error occurs on the i + 1st entry, the SetResults method raises an exception and returns i. Otherwise, n is returned.

Example

The following example shows how to use the SetResults method. This example assumes there is an active page that has at least 3 shapes on it. It uses the GetResults method to get the width of shape 1, the height of shape 2, and the angle of shape 3. It then uses SetResults to set the width of shape 1 to the height of shape 2 and the height of shape 2 to the width of shape 1.The angle of shape 3 is left unaltered.

This example uses the GetResults method of the Page object to get 3 cell formulas and the SetResults method of the same object to set the formulas. The input array has 4 slots for each cell, as it also would for Master objects. For Shape or Style objects, only 3 slots are needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub Set Results_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer
 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Get the first two values in inches. The second element in
 'the units array is left uninitialized (empty) because we
 'want the second result in the same units as the first
 'result. The third result is initialized in degrees. Note that
 'units can be expressed as a string or an integer constant.
 Dim avarUnits(1 To 3) As Variant
 avarUnits(1) = "in."
 avarUnits(3) = visDegrees

 'Return results of cells as an array of floating point numbers.
 Dim avarResults() As Variant
 ActivePage.GetResults aintSheetSectionRowColumn, visGetFloats, _
 avarUnits, avarResults

 'Use SetResults to:

 ' - Set the width of shape 1 to the height of shape 2.

 ' - Set the height of shape 2 to the width of shape 1.

 'NOTE: avarResults() is indexed from 0 to 2.

 Dim varTemp As variant
 varTemp = avarResults(0)
 avarResults(0) = avarResults(1)
 avarResults(1) = varTemp

 'Pass the same array back to SetResults that we
 'just passed to GetResults, but leave the angle
 'alone. By setting the sheet ID entry in the third
 'slot of the aintSheetSectionRowColumn array to
 'visInvalShapeID, we tell SetResults to ignore that slot.
 aintSheetSectionRowColumn(9) = visInvalShapeID

 'Set the results of the cells.
 ActivePage.SetResults aintSheetSectionRowColumn, avarUnits, avarResults, 0

 Exit Sub

HandleError:

 MsgBox "Error"

 Exit Sub

End Sub


Shape.SwapEnds Method (Visio)

 Copy code hover
[image]

Shape.SwapEnds Method (Visio)
Send feedback

Published: July 16, 2012

Swaps the begin and endpoints of a one-dimensional (1-D) shape.

Version Information

Version Added: Visio 2002

Syntax

expression .SwapEnds

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

The type of glue associated with the endpoints is also swapped. For example, if the begin point of a 1-D shape is glued to object A and the endpoint of the 1-D shape is not glued, after invoking the SwapEnds method, the endpoint is glued to object A and the begin point is not glued.


Shape.TransformXYFrom Method (Visio)

 Copy code hover
[image]

Shape.TransformXYFrom Method (Visio)
Send feedback

Published: July 16, 2012

Transforms a point expressed in the local coordinate system of one Shape object from an equivalent point expressed in the local coordinate system of another Shape object.

Version Information

Version Added: Visio 2002

Syntax

expression .TransformXYFrom(OtherShape, x, y, xprime, yprime)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
OtherShape | Required | [IVSHAPE] | An expression that returns a Shape object whose local coordinate system you are transforming the point from.
x | Required | Double | x-coordinate corresponding to x in the OtherShape coordinate system.
y | Required | Double | y-coordinate corresponding to y in the OtherShape coordinate system.
xprime | Required | Double | x-coordinate in coordinate system of object.
yprime | Required | Double | y-coordinate in coordinate system of object.

Return Value

Nothing

Remarks

The points x, y, xprime, and yprime are all treated as internal drawing units.

An exception is raised if object is not a Shape object of a Page or Master object, or if OtherShape is not in the same Page or Master object as object.


Shape.TransformXYTo Method (Visio)

 Copy code hover
[image]

Shape.TransformXYTo Method (Visio)
Send feedback

Published: July 16, 2012

Transforms a point expressed in the local coordinate system of one Shape object to an equivalent point expressed in the local coordinate system of another Shape object.

Version Information

Version Added: Visio 2000

Syntax

expression .TransformXYTo(OtherShape, x, y, xprime, yprime)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
OtherShape | Required | [IVSHAPE] | An expression that returns a Shape object whose local coordinate system you are transforming the point to.
x | Required | Double | x-coordinate in coordinate system of object.
y | Required | Double | y-coordinate in coordinate system of object.
xprime | Required | Double | x-coordinate corresponding to xin the OtherShapecoordinate system.
yprime | Required | Double | y-coordinate corresponding to yin the OtherShapecoordinate system.

Return Value

Nothing

Remarks

The points x, y, xprime and yprime are all treated as internal drawing units.

An exception is raised if object is not a Shape object of a Page or Master object, or if OtherShape is not in the same Page or Master object as object.


Shape.Ungroup Method (Visio)

 Copy code hover
[image]

Shape.Ungroup Method (Visio)
Send feedback

Published: July 16, 2012

Ungroups a group.

Version Information

Version Added: Visio 2.0

Syntax

expression .Ungroup

expression A variable that represents a Shape object.

Return Value

Nothing

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Ungroup method.

VBA Copy code Copy code

Sub Ungroup_Example()

 Dim vsoShape1 As Visio.Shape
 Dim vsoShape2 As Visio.Shape
 Dim vsoShape3 As Visio.Shape
 Dim vsoGroup As Visio.Shape
 Dim vsoSelection As Visio.Selection

 'Draw two rectangles.
 Set vsoShape1 = ActivePage.DrawRectangle(1, 2, 2, 1)
 Set vsoShape2 = ActivePage.DrawRectangle(1, 4, 2, 3)

 'Add a copy of one of the rectangles to the page.
 ActivePage.Drop vsoShape1, 3.5, 3.5
 Set vsoShape3 = ActivePage.Shapes(3)

 'Deselect all shapes, and then select all the shapes on the page.
 Set vsoSelection = ActiveWindow.Selection
 vsoSelection.Select vsoShape1, visDeselectAll + visSelect
 vsoSelection.Select vsoShape2, visSelect
 vsoSelection.Select vsoShape3, visSelect

 'Group all the shapes into a group shape.
 Set vsoGroup = vsoSelection.Group

 'Ungroup the shapes.
 vsoGroup.Ungroup

End Sub


Shape.UpdateAlignmentBox Method (Visio)

 Copy code hover
[image]

Shape.UpdateAlignmentBox Method (Visio)
Send feedback

Published: July 16, 2012

Updates the alignment box for a shape.

Version Information

Version Added: Visio 2000

Syntax

expression .UpdateAlignmentBox

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

The UpdateAlignmentBox method alters the width and height of a shape, often a group. For example, after you move a shape in a group, the shape may be outside the group's alignment box. The UpdateAlignmentBox method updates the alignment box so that it encloses all the shapes in the group.

Note Note

Many shapes are designed so that their alignment boxes don't coincide with their geometric extents. Using the UpdateAlignmentBox method on such shapes defeats the intentions of the shape designer.


Shape.XYFromPage Method (Visio)

 Copy code hover
[image]

Shape.XYFromPage Method (Visio)
Send feedback

Published: July 16, 2012

Transforms a point expressed in the local coordinate system of its Page or Master object to an equivalent point expressed in the local coordinate system of the Shape object.

Version Information

Version Added: Visio 2000

Syntax

expression .XYFromPage(x, y, xprime, yprime)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Double | x-coordinate corresponding to x in the Page or Master object's coordinate system.
y | Required | Double | y-coordinate corresponding to y in the Page or Master object's coordinate system.
xprime | Required | Double | x-coordinate in coordinate system of object.
yprime | Required | Double | y-coordinate in coordinate system of object.

Return Value

Nothing

Remarks

The points x, y, xprime, and yprime are all treated as internal drawing units.

An exception is raised if object is not a Shape object of a Page or Master object.


Shape.XYToPage Method (Visio)

 Copy code hover
[image]

Shape.XYToPage Method (Visio)
Send feedback

Published: July 16, 2012

Transforms a point expressed in the local coordinate system of a Shape object to an equivalent point expressed in the local coordinate system of its Page or Master object.

Version Information

Version Added: Visio 2000

Syntax

expression .XYToPage(x, y, xprime, yprime)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Double | x-coordinate in coordinate system of object.
y | Required | Double | y-coordinate in coordinate system of object.
xprime | Required | Double | x-coordinate corresponding to x in the Page or Master object's coordinate system.
yprime | Required | Double | y-coordinate corresponding to y in the Page or Master object's coordinate system.

Return Value

Nothing

Remarks

The points x, y, xprime, and yprime are all treated as internal drawing units.

An exception is raised if object is not a Shape object of a Page or Master object.


Shape Events (Visio)

 Copy code hover
[image]

Shape Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
BeforeSelectionDelete | Occurs before selected objects are deleted.
BeforeShapeDelete | Occurs before a shape is deleted.
BeforeShapeTextEdit | Occurs before a shape is opened for text editing in the user interface.
CellChanged | Occurs after the value changes in a cell in a document.
ConvertToGroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.
FormulaChanged | Occurs after a formula changes in a cell in the object that receives the event.
GroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.
QueryCancelConvertToGroup | Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelGroup | Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelSelectionDelete | Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
QueryCancelUngroup | Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.
SelectionAdded | Occurs after one or more shapes are added to a document.
SelectionDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.
ShapeAdded | Occurs after one or more shapes are added to a document.
ShapeChanged | Occurs after a property of a shape that is not stored in a cell is changed in a document.
ShapeDataGraphicChanged | Occurs after a data graphic is applied to or deleted from a shape.
ShapeExitedTextEdit | Occurs after a shape is no longer open for interactive text editing.
ShapeLinkAdded | Occurs after a shape is linked to a data row.
ShapeLinkDeleted | Occurs after the link between a shape and a data row is deleted.
ShapeParentChanged | Occurs after shapes are grouped or a group is ungrouped.
TextChanged | Occurs after the text of a shape is changed in a document.
UngroupCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.


Shape.BeforeSelectionDelete Event (Visio)

 Copy code hover
[image]

Shape.BeforeSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before selected objects are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selected objects that are going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. To find out if a shape is locked against deletion, check the value of its LockDelete cell.

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.BeforeShapeDelete Event (Visio)

 Copy code hover
[image]

Shape.BeforeShapeDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is deleted.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeShapeDelete(ByVal Shape As [IVSHAPE])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be deleted.

Remarks

A Shape object can serve as the source object for the BeforeShapeDelete event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use the VBA WithEvents keyword to sink the BeforeShapeDelete event.

For performance considerations, the Document object's event set does not include the BeforeShapeDelete event. To sink the BeforeShapeDelete event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this event maps to the following types:

  • Microsoft.Office.Interop.Visio.EShape_BeforeShapeDeleteEventHandler (the BeforeShapeDelete delegate.)

  • Microsoft.Office.Interop.Visio.EShape_Event.BeforeShapeDelete (the BeforeShapeDelete event.)


Shape.BeforeShapeTextEdit Event (Visio)

 Copy code hover
[image]

Shape.BeforeShapeTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a shape is opened for text editing in the user interface.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _BeforeShapeTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is going to be opened for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.CellChanged Event (Visio)

 Copy code hover
[image]

Shape.CellChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the value changes in a cell in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _CellChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose value has changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the CellChanged event.

For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

Example

This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.

VBA Copy code Copy code

Private WithEvents vsoApplication As Visio.Application

Public Sub CellChanged_Example()

 Dim vsoShape As Visio.Shape

 'Set a module-level variable to trap application-level events.
 Set vsoApplication = Application

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1)

 'Change a cell (to trigger a CellChanged event).
 vsoShape.Cells("Width").Formula = 5

End Sub

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)

 Debug.Print vsoCell.Shape.Name & " " & vsoCell.Name & " changed to =" & vsoCell.Formula

End Sub


Shape.ConvertToGroupCanceled Event (Visio)

 Copy code hover
[image]

Shape.ConvertToGroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ConvertToGroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.FormulaChanged Event (Visio)

 Copy code hover
[image]

Shape.FormulaChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a formula changes in a cell in the object that receives the event.

Version Information

Version Added: Visio 5.0

Syntax

Private Sub expression _FormulaChanged(ByVal Cell As [IVCELL])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Cell | Required | [IVCELL] | The cell whose formula changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the FormulaChanged event.

For performance considerations, the Document object's event set does not include the FormulaChanged event. To sink the FormulaChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Shape.GroupCanceled Event (Visio)

 Copy code hover
[image]

Shape.GroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _GroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be grouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.QueryCancelConvertToGroup Event (Visio)

 Copy code hover
[image]

Shape.QueryCancelConvertToGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelConvertToGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be converted to a group.

Remarks

A Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • If all handlers return False (don't cancel), the conversion is performed.

In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.QueryCancelGroup Event (Visio)

 Copy code hover
[image]

Shape.QueryCancelGroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _QueryCancelGroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be grouped.

Remarks

A Microsoft Visio instance fires QueryCancelGroup after the user has directed the instance to group a selection of shapes. The event fires only if the shapes in the selection are all sub-shapes of the parent shape.

  • If any event handler returns True (cancel), the instance fires GroupCanceled and does not group the shapes.

  • If all handlers return False (do not cancel), the grouping is performed.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you use Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.QueryCancelSelectionDelete Event (Visio)

 Copy code hover
[image]

Shape.QueryCancelSelectionDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelSelectionDelete(ByVal Selection As [IVSELECTION])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelSelectionDelete after the user has directed the instance to delete one or more shapes.

  • If any event handler returns True (cancel), the instance fires SelectionDeleteCanceled and does not delete the shapes.

  • If all handlers returnFalse (don't cancel), the instance fires BeforeSelectionDelete and BeforeShapeDelete and then deletes the shapes.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.QueryCancelUngroup Event (Visio)

 Copy code hover
[image]

Shape.QueryCancelUngroup Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelUngroup(ByVal Selection As [IVSELECTION])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that is going to be ungrouped.

Remarks

A Microsoft Visio instance fires QueryCancelUngroup after the user has directed the instance to ungroup one or more shapes.

  • If any event handler returns True (cancel), the instance fires UngroupCanceled and does not ungroup the shapes.

  • If all handlers return False (don't cancel), the instance fires ShapeParentChanged, BeforeSelectionDelete, and BeforeShapeDelete, and then ungroups the shapes.

While a Visio instance is firing a query or cancel event, it respondsto inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.SelectionAdded Event (Visio)

 Copy code hover
[image]

Shape.SelectionAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionAdded(ByVal Selection As [IVSELECTION])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the SelectionAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the SelectionAdded event.

For performance considerations, the Document object's event set does not include the SelectionAdded event. To sink the SelectionAdded event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.


Shape.SelectionDeleteCanceled Event (Visio)

 Copy code hover
[image]

Shape.SelectionDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _SelectionDeleteCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.ShapeAdded Event (Visio)

 Copy code hover
[image]

Shape.ShapeAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after one or more shapes are added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _ShapeAdded(ByVal Shape As [IVSHAPE])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape or group of shapes that was added to the document.

Remarks

A Shape object can serve as the source object for the ShapeAdded event if the shape's Type property is visTypeGroup(2) or visTypePage(1).

The SelectionAdded and ShapeAdded events are similar in that they both fire after shape(s) are created. They differ in how they behave when a single operation adds several shapes. Suppose a Paste operation creates three new shapes. The ShapeAdded event fires three times and acts on each of the three objects. The SelectionAdded event fires once, and it acts on a Selection object in which the three new shapes are selected.

To determine if a ShapeAdded event was triggered by a new shape or group of shapes being added to the page, by a set of existing shapes being grouped, or by a paste action, you can use the Application.IsInScope property. If IsInScope returns True when passed visCmdObjectGroup, the ShapeAdded event was triggered by a grouping action. If IsInScope returns True when passed visCmdUFEditPaste or visCmdEditPasteSpecial, the ShapeAdded event was triggered by a paste operation. If IsInScope returns False when passed all of these arguments, the event must have been triggered by new shapes being added to the page.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This VBA example shows how to count shapes added to a drawing that are based on a master called Square. Paste the code into the active document's project in Visio.

The DocumentSaved event handler runs when the active document is saved. The handler initializes an integer variable, intNumberOfSquares, which is used to store the count.

The ShapeAdded event handler runs each time a shape is added to the drawing page, whether the shape is dragged from a stencil, drawn with a drawing tool, or pasted from the Clipboard. The handler checks the Master property of the new shape and, if the shape is based on the Square master, increments intNumberOfSquares.

VBA Copy code Copy code

Dim intNumberOfSquares As Integer

Private Sub Document_DocumentSaved(ByVal vsoDocument As Visio.IVDocument)

 'Initialize number of squares added.
 intNumberOfSquares = 0

End Sub

Private Sub Document_ShapeAdded(ByVal vsoShape As Visio.IVShape)

 Dim vsoMaster As Visio.Master

 'Get the Master property of the shape.
 Set vsoMaster = vsoShape.Master

 'Check whether the shape has a master. If not,
 'the shape was created locally.
 If Not (vsoMaster Is Nothing) Then

 'Check whether the master is "Square".
 If vsoMaster.Name = "Square" Then

 'Increment the count for the number of squares added.
 intNumberOfSquares = intNumberOfSquares + 1

 End If

 End If

 MsgBox "Number of squares: " & intNumberOfSquares, vbInformation, _
 "Document Created Example"

End Sub


Shape.ShapeChanged Event (Visio)

 Copy code hover
[image]

Shape.ShapeChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a property of a shape that is not stored in a cell is changed in a document.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _ShapeChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose property changed.

Remarks

To determine which properties have changed when ShapeChanged fires, use the EventInfo property. The string returned by the EventInfo property contains a list of substrings that identify the properties that changed.

Changes to the following shape properties cause the ShapeChanged event to fire:

  • Name (the EventInfo property contains "/name")

  • Data1 (the EventInfo property contains "/data1")

  • Data2 (the EventInfo property contains "/data2")

  • Data3 (the EventInfo property contains "/data3")

  • UniqueID (the EventInfo property contains "/uniqueid")

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification over a connection that was created by using AddAdvise, the varMoreInfo argument to VisEventProc contains the string: "/doc=1 /page=1 /shape=Sheet.3"

Note Note

You can use VBA WithEvents variables to sink the ShapeChanged event.

For performance considerations, the Document object's event set does not include the ShapeChanged event. To sink the ShapeChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Shape.ShapeDataGraphicChanged Event (Visio)

 Copy code hover
[image]

Shape.ShapeDataGraphicChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a data graphic is applied to or deleted from a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeDataGraphicChanged(ByVal Shape As IVSHAPE)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape to which the data graphic was applied or from which it was deleted.

Remarks

A data graphic is a Master object of type visTypeDataGraphic. When the same master that is already applied to a shape is re-applied to the shape, the ShapeDataGraphicChanged event does not fire, even if the master has been modified since it was applied originally. If, however, a different data graphic master is applied to the shape, the event does fire.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.ShapeExitedTextEdit Event (Visio)

 Copy code hover
[image]

Shape.ShapeExitedTextEdit Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is no longer open for interactive text editing.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeExitedTextEdit(ByVal Shape As [IVSHAPE])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that was closed for text editing.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.ShapeLinkAdded Event (Visio)

 Copy code hover
[image]

Shape.ShapeLinkAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a shape is linked to a data row.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkAdded(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape that is linked to data.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row linked to the shape.
DataRowID | Required | Long | The ID of the data row linked to the shape.

Remarks

The ShapeLinkAdded event of the Shape object does not occur when a link is created between the source shape itself and a data row. It occurs only when a link is added between one or more sub-shapes of the source shape and a data row or rows.

The ShapeLinkAdded event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkAdded event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.ShapeLinkDeleted Event (Visio)

 Copy code hover
[image]

Shape.ShapeLinkDeleted Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the link between a shape and a data row is deleted.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

Private Sub expression _ShapeLinkDeleted(ByVal Shape As [IVSHAPE], ByVal DataRecordsetID As Long, ByVal DataRowID As Long )

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose link to a data row was broken.
DataRecordsetID | Required | Long | The ID of the data recordset containing the data row that was linked to the shape.
DataRowID | Required | Long | The ID of the data row that was linked to the shape.

Remarks

The ShapeLinkDeleted event of the Shape object does not occur when the link is broken between the source shape itself and a data row. It occurs only when the link is broken between one or more sub-shapes of the source shape and a data row or rows.

The ShapeLinkDeleted event is one of a group of events for which the EventInfo property of the Application object contains extra information.

When the ShapeLinkDeleted event is fired, the EventInfo property returns the following string:

/DataRecordsetID = n /DataRowID = m

where n and m represent the IDs of the data recordset and data row, respectively, associated with the event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.ShapeParentChanged Event (Visio)

 Copy code hover
[image]

Shape.ShapeParentChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after shapes are grouped or a group is ungrouped.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ShapeParentChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose parent changed.

Remarks

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shape.TextChanged Event (Visio)

 Copy code hover
[image]

Shape.TextChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the text of a shape is changed in a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _TextChanged(ByVal Shape As [IVSHAPE])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | [IVSHAPE] | The shape whose text changed.

Remarks

The TextChanged event is fired when the raw text of a shape changes, such as when the characters Microsoft Visio stores for the shape change. If a shape's characters change because a user is typing, the TextChanged event does not fire until the text editing session terminates.

When a field is added to or removed from a shape's text, its raw text changes; hence, a TextChanged event fires. However, no TextChanged event fires when the text in a field changes. For example, a shape has a text field that shows its width. A TextChanged event does not fire when the shape's width changes, because the raw text stored for the shape has not changed, even though the apparent (expanded) text of the shape does change. Use the CellChanged event for one of the cells in the Text Fields section to detect when the text in a text field changes.

To access a shape's raw text, use the Text property. To access the text of a shape in which text fields have been expanded, use the Characters.Text property. You can determine the location and properties of text fields in a shape's text by using the Shape.Characters object.

In Visio 5.0 and earlier versions, the raw characters reported by the Text property for a field included four characters, the first being the escape character. Starting with Visio 2000, only a single escape character is present in the raw text stream.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Note Note

You can use VBA WithEvents variables to sink the TextChanged event.

For performance considerations, the Document object's event set does not include the TextChanged event. To sink the TextChanged event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.


Shape.UngroupCanceled Event (Visio)

 Copy code hover
[image]

Shape.UngroupCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _UngroupCanceled(ByVal Selection As [IVSELECTION])

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Selection | Required | [IVSELECTION] | The selection of shapes that was going to be ungrouped.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Shapes Object (Visio)

 Copy code hover
[image]

Shapes Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Shape object for each basic shape, group, guide, or object from another application (linked or embedded in Microsoft Visio) on a drawing page, master, or group.

Remarks

To retrieve a Shapes collection, use the Shapes property of a Page, Master, or Shape object.

The default property of a Shapes collection is Item.

The order of items in a Shapes collection corresponds to the stacking (drawing) order of the shapes.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this collection maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShapes


Shapes Members (Visio)

 Copy code hover
[image]

Shapes Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Shape object for each basic shape, group, guide, or object from another application (linked or embedded in Microsoft Visio) on a drawing page, master, or group.

Methods

Name | Description
CenterDrawing | Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ContainingMaster | Returns the Master object that contains an object. Read-only.
ContainingPage | Returns the page that contains an object.
ContainingShape | Returns the Shape object that contains an object or collection. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ItemFromUniqueID | Returns the Shape object that matches the specified UniqueID property value. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Stat | Returns status information for an object. Read-only.


Shapes Properties (Visio)

 Copy code hover
[image]

Shapes Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
ContainingMaster | Returns the Master object that contains an object. Read-only.
ContainingPage | Returns the page that contains an object.
ContainingShape | Returns the Shape object that contains an object or collection. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ItemFromUniqueID | Returns the Shape object that matches the specified UniqueID property value. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Stat | Returns status information for an object. Read-only.


Shapes.Application Property (Visio)

 Copy code hover
[image]

Shapes.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Shapes object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

    Dim vsoApplication As Visio.Application
    Dim vsoDocument As Visio.Document

    Set vsoDocument = ActiveDocument

    'Get the instance of Visio associated with the Document object.
    Set vsoApplication = vsoDocument.Application
    Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Shapes.ContainingMaster Property (Visio)

 Copy code hover
[image]

Shapes.ContainingMaster Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Master object that contains an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ContainingMaster

expression A variable that represents a Shapes object.

Return Value

Master

Remarks

If the object isn't in a Master object, the ContainingMaster property returns Nothing. For example, if a Shape object belongs to the Shapes collection of a Page object, the ContainingMaster property returns Nothing.


Shapes.ContainingPage Property (Visio)

 Copy code hover
[image]

Shapes.ContainingPage Property (Visio)
Send feedback

Published: July 16, 2012

Returns the page that contains an object.

Version Information

Version Added: Visio 4.0

Syntax

expression .ContainingPage

expression A variable that represents a Shapes object.

Return Value

Page

Remarks

If the object isn't in a Page object, the ContainingPage property returns Nothing. For example, if a Shape object belongs to a Masters collection, the ContainingPage property returns Nothing.


Shapes.ContainingShape Property (Visio)

 Copy code hover
[image]

Shapes.ContainingShape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that contains an object or collection. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ContainingShape

expression A variable that represents a Shapes object.

Return Value

Shape

Remarks

If the Shape object is the member of a group, the ContainingShape property returns that group.

If the Shape object is a top-level shape in its Page or Master object (it is not a member of a group), the ContainingShape property returns the page sheet of its page or master.

If the Shape object is the page sheet of a page or master, the ContainingShape property returns Nothing.


Shapes.Count Property (Visio)

 Copy code hover
[image]

Shapes.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Shapes object.

Return Value

Long

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Shapes.Document Property (Visio)

 Copy code hover
[image]

Shapes.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Shapes object.

Return Value

Document


Shapes.EventList Property (Visio)

 Copy code hover
[image]

Shapes.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Shapes object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Shapes.Item Property (Visio)

 Copy code hover
[image]

Shapes.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameUIDOrIndex)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
NameUIDOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

Shape

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

If you retrieve a Shape object by name, the Item property searches all shapes in the Shapes collection's containing page or containing master, in addition to the collection's containing shape. Therefore, the Shape object returned by the Item property can be a shape that is not in the Shapes collection.

You can also pass the unique ID string of a Master or Shape object to the Item property. For example:

VBA Copy code Copy code
objRet = vsoShapes.Item("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

If such a string is passed to the Item property of a Shapes collection, all the shapes contained in the collection are searched. Shapes within the group shapes in the containing shape are not searched.

To search all shapes in the collection, plus the shapes inside groups and the containing shape of the collection, prefix the unique ID string with an asterisk (*). For example:

VBA Copy code Copy code
objRet = vsoShapes.Item("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

  • In Visio 2000 only, Shapes.Item("{guid}") examined the Shapes collection's containing shape and all descendants, and Shapes.Item("*{guid}") examined all shapes in the Shapes collection's containing page or containing master.

  • Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.) As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Item property to get a Page object from the Pages collection of the active document, and all the Shape objects in the Shapes collection of the Page object. It prints the names of all shapes on Page1 in the Immediate window.

Before running this macro, make sure that the active document has shapes on Page1.

VBA Copy code Copy code
Public Sub Item_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.Item(1).Shapes

    Debug.Print "Shape Name List For..."
    Debug.Print "Document: "; ActiveDocument.Name
    Debug.Print "Page: "; ActiveDocument.Pages.Item(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then
        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.Item(intCounter).Name
        Next intCounter
    Else
        Debug.Print " No Shapes On Page"
    End If

End Sub


Shapes.ItemFromID Property (Visio)

 Copy code hover
[image]

Shapes.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item of a collection using the ID of the item. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemFromID(nID)

expression A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
nID | Required | Long | The ID of the object to retrieve.

Return Value

Shape

Remarks

The ID of a Shape object uniquely identifies the shape within its page or master. You can determine the ID of a shape by displaying the Special dialog box (select the shape, and then click Shape Name on the Developer tab.)

The ID of a Style object uniquely identifies the style within its document.

The ID of a Font object corresponds to the number stored in the Font cell of a row in a shape's Character Properties section. The ID associated with a particular font varies between systems or as fonts are installed on and removed from a given system.

The ID of an Event object uniquely identifies an event in its EventList collection for the life of the collection.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVShapes.get_ItemFromID


Shapes.ItemFromUniqueID Property (Visio)

 Copy code hover
[image]

Shapes.ItemFromUniqueID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that matches the specified UniqueID property value. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ItemFromUniqueID(UniqueID)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
UniqueID | Required | String | The unique ID of a Shape object.

Return Value

Shape

Remarks

Microsoft Visio identifies shapes by two different IDs: shape IDs and unique IDs. Shape IDs are numeric and uniquely identify shapes within the scope of an individual drawing page or master. They are not unique within the scope of the drawing, however.

Unique IDs are GUIDs. They are unique within the scope of the document.

To convert between shape IDs and unique IDs, you can use two methods of the Page object, ShapeIDsToUniqueIDs and UniqueIDsToShapeIDs.

By default, a shape does not have a unique ID. A shape acquires a unique ID only if you get its read-only UniqueID property value by calling the property on the shape, passing it the visGetOrMake constant from the VisUniqueIDArgs enumeration.

If a Shape object has a unique ID, no other shape in the same document will have the same ID.


Shapes.ItemU Property (Visio)

 Copy code hover
[image]

Shapes.ItemU Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ItemU(NameUIDOrIndex)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the universal name, unique ID, or index of the object to retrieve.

Return Value

Shape

Remarks

You can retrieve an object in an Addons, Hyperlinks, Layers, Masters, MasterShortcuts, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

If you retrieve a Shape object by name, the ItemU property searches all shapes in the Shapes collection's containing page or containing master, in addition to the collection's containing shape. Therefore, the Shape object returned by the ItemU property can be a shape that is not in the Shapes collection.

You can also pass the unique ID string of a Master or Shape object to the ItemU property. For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

If such a string is passed to the ItemU property of a Shapes collection, all the shapes contained in the collection are searched. Shapes within the group shapes in the containing shape are not searched.

To search all shapes in the collection, plus the shapes inside groups and the containing shape of the collection, prefix the unique ID string with an asterisk (*). For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")
Note Note

  • In Visio 2000 only, vsoShapes.ItemU("{guid}") examined the Shapes collection's containing shape and all descendants, and vsoShapes.ItemU("*{guid}") examined all shapes in the Shapes collection's containing page or containing master.

  • Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

    As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

Example

This Microsoft Visual Basic macro shows how to use the ItemU property of the Pages collection to get the Shapes collection. Then it uses the ItemU property of the Shapes collection to print the universal names of all shapes on Page-1 in the Immediate window.

To run this macro, make sure the active document has shapes on Page-1.

VBA Copy code Copy code
Public Sub ItemU_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.ItemU(1).Shapes

    Debug.Print "Shapes in Document: "; ActiveDocument.Name
    Debug.Print "          on  Page: "; ActiveDocument.Pages.ItemU(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then

        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.ItemU(intCounter).Name
        Next intCounter

    Else

        Debug.Print " No Shapes On Page"

    End If

End Sub


Shapes.ObjectType Property (Visio)

 Copy code hover
[image]

Shapes.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Shapes object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Shapes.PersistsEvents Property (Visio)

 Copy code hover
[image]

Shapes.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Shapes object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Shapes.Stat Property (Visio)

 Copy code hover
[image]

Shapes.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Shapes object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Shapes Methods (Visio)

 Copy code hover
[image]

Shapes Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CenterDrawing | Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .


Shapes.CenterDrawing Method (Visio)

 Copy code hover
[image]

Shapes.CenterDrawing Method (Visio)
Send feedback

Published: July 16, 2012

Centers a page's, master's, or group's shapes with respect to the extent of the page, master, or group. .

Version Information

Version Added: Visio 4.0

Syntax

expression .CenterDrawing

expression A variable that represents a Shapes object.

Return Value

Nothing

Remarks

Centering shapes does not change their position relative to each other.


Style Object (Visio)

 Copy code hover
[image]

Style Object (Visio)
Send feedback

Published: July 16, 2012

Represents a style defined in a document.

Version Information

Version Added: Visio 2.0

Remarks

You retrieve a particular style from the Styles collection of a Document object.

The default property of a Style object is Name.

Any Shape object to which a style is applied inherits the attributes defined by the style. Use the LineStyle, FillStyle, TextStyle, or Style property of a Shape object to apply a style to a shape or to determine what style is applied to a shape.

Like a Shape object, a Style object has cells whose formulas define the values of the style's attributes. To retrieve one of these cells, use the Cells or CellsSRC property of the Style object.


Style Members (Visio)

 Copy code hover
[image]

Style Members (Visio)
Send feedback

Published: July 16, 2012

Represents a style defined in a document.

Events

Name | Description
BeforeStyleDelete | Occurs before a style is deleted.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.

Methods

Name | Description
Delete | Deletes an object.
GetFormulas | Returns the formulas of many cells.
GetFormulasU | Returns the formulas of many cells.
GetResults | Gets the results or formulas of many cells.
SetFormulas | Sets the formulas of one or more cells.
SetResults | Sets the results or formulas of one or more cells.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
BasedOn | Gets or sets the style on which a Style object is based. Read/write.
CellExists | Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.
CellExistsU | Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.
Cells | Returns a Cell object that represents a ShapeSheet cell. Read-only.
CellsSRC | Returns a Cell object that represents a ShapeSheet cell identified by section, row, and column indices. Read-only.
CellsSRCExists | Determines whether a ShapeSheet cell exists in the scope of a search. Read-only.
CellsU | Returns a Cell object that represents a ShapeSheet cell. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
FillBasedOn | Gets or sets the fill style on which the Style object is based. Read/write.
Hidden | Hides or shows a master on a stencil or a style in the user interface. Read/write.
ID | Gets the ID of an object. Read-only.
IncludesFill | Indicates whether the style includes fill attributes. Read/write.
IncludesLine | Indicates whether the style includes line attributes. Read/write.
IncludesText | Indicates whether the style includes text attributes. Read/write.
Index | Gets the ordinal position of a Style object in the Styles collection. Read-only.
LineBasedOn | Gets or sets the line style on which a Style object is based. Read/write.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Style object. Read/write.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Section | Returns the requested Section object belonging to a style. Read-only.
Stat | Returns status information for an object. Read-only.
TextBasedOn | Gets or sets the text style on which a Style object is based. Read/write.


Style Properties (Visio)

 Copy code hover
[image]

Style Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
BasedOn | Gets or sets the style on which a Style object is based. Read/write.
CellExists | Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.
CellExistsU | Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.
Cells | Returns a Cell object that represents a ShapeSheet cell. Read-only.
CellsSRC | Returns a Cell object that represents a ShapeSheet cell identified by section, row, and column indices. Read-only.
CellsSRCExists | Determines whether a ShapeSheet cell exists in the scope of a search. Read-only.
CellsU | Returns a Cell object that represents a ShapeSheet cell. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
FillBasedOn | Gets or sets the fill style on which the Style object is based. Read/write.
Hidden | Hides or shows a master on a stencil or a style in the user interface. Read/write.
ID | Gets the ID of an object. Read-only.
IncludesFill | Indicates whether the style includes fill attributes. Read/write.
IncludesLine | Indicates whether the style includes line attributes. Read/write.
IncludesText | Indicates whether the style includes text attributes. Read/write.
Index | Gets the ordinal position of a Style object in the Styles collection. Read-only.
LineBasedOn | Gets or sets the line style on which a Style object is based. Read/write.
Name | Specifies the name of an object. Read-only.
NameU | Specifies the universal name of a Style object. Read/write.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Section | Returns the requested Section object belonging to a style. Read-only.
Stat | Returns status information for an object. Read-only.
TextBasedOn | Gets or sets the text style on which a Style object is based. Read/write.


Style.Application Property (Visio)

 Copy code hover
[image]

Style.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Style object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Style.BasedOn Property (Visio)

 Copy code hover
[image]

Style.BasedOn Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the style on which a Style object is based. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .BasedOn

expression A variable that represents a Style object.

Return Value

String

Remarks

To base a style on no style, set the BasedOn property to a zero-length string ("").


Style.CellExists Property (Visio)

 Copy code hover
[image]

Style.CellExists Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CellExists(localeSpecificCellName, fExistsLocally)

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
localeSpecificCellName | Required | String | The local or universal name of the ShapeSheet cell for which you want to search.
fExistsLocally | Required | Integer | The scope of the search.

Return Value

Integer

Remarks

The localeSpecificCellName argument can specify a cell name in either local or universal syntax. To search for a cell by section, row, and column index, use the CellsSRCExists property.

The fExistsLocally argument specifies the scope of the search.

  • If fExistsLocally is non-zero (True), the CellExists property value is True only if the object contains the cell locally; if the cell is inherited, the CellExists property value is False.

  • If fExistsLocally is zero (False), the CellExists property value is True if the object either contains or inherits the cell.

For a list of cell index values, view the Visio type library for the members of class VisCellIndices.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the CellExists property to determine if a cell exists by passing either the cell's local name or its universal name. Use the CellExistsU property to determine if a cell exists by passing the cell's universal name.


Style.CellExistsU Property (Visio)

 Copy code hover
[image]

Style.CellExistsU Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a particular ShapeSheet cell exists in the scope of the search. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CellExistsU(localeIndependentCellName, fExistsLocally)

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
localeIndependentCellName | Required | String | The universal name of the ShapeSheet cell for which you want to search.
fExistsLocally | Required | Integer | The scope of the search.

Return Value

Integer

Remarks

The localeIndependentCellName argument must specify a universal cell name. To search for a cell by section, row, and column index, use the CellsSRCExists property.

The fExistsLocally argument specifies the scope of the search.

  • If fExistsLocally is non-zero (True), the CellExistsU property value is True only if the object contains the cell locally; if the cell is inherited, the CellExistsU property value is False.

  • If fExistsLocally is zero (False), the CellExistsU property value is True if the object either contains or inherits the cell.

For a list of cell index values, view the Visio type library for the members of class VisCellIndices.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the CellExists property to determine if a cell exists by passing either the cell's local name or its universal name. Use the CellExistsU property to determine if a cell exists by passing the cell's universal name.


Style.Cells Property (Visio)

 Copy code hover
[image]

Style.Cells Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Cell object that represents a ShapeSheet cell. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Cells(localeSpecificCellName)

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
localeSpecificCellName | Required | String | The name of a ShapeSheet cell.

Return Value

Cell

Remarks

Cells("somestring") raises an "Unexpected end of file" exception if "somestring" does not name an actual cell. You can use the CellExists property to determine if a cell with the name "somestring" exists.

The cells in a shape's User-Defined Cells and Shape Data sections belong to rows whose names have been assigned by the user or a program. You can use the Cells property to access cells in named rows.

For example, if "Row_1" is the name of a row in a shape's User-Defined Cells section, you can use this statement to access the first cell in this row (the cell in column zero, which holds the name of the row):

VBA Copy code Copy code
vsoCell = vsoShape.Cells("User.Row_1")

You can use this statement to access the prompt cell in Row_1:

VBA Copy code Copy code
vsoCell = vsoShape.Cells("User.Row_1.Prompt")

Next, assume that Row_1 is in the Shape Data section instead of the User- Defined Cells section. You can use this statement to access the first cell in this row (the cell in column zero, which holds the name of the row):

VBA Copy code Copy code
vsoCell = vsoShape.Cells("Prop.Row_1")

You can use this statement to access other cells in the row:

VBA Copy code Copy code
vsoCell = vsoShape.Cells("Prop.Row_1.xxx")

where xxx is one of these cells: Label, Prompt, SortKey, Type, Format, Invisible, or Ask.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Cells property to get a Cell object by using the cell's local name. Use the CellsU property to get a Cell object by using the cell's universal name.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Cells property to get a particular ShapeSheet cell by its name. It draws a rectangle on a page and bows, or curves the lines of the rectangle by changing the shape's lines to arcs. This is accomplished by changing the ShapeSheet row types for each side of the rectangle from LineTo to ArcTo and then changing the values of the X and Y cells in each of these rows.

VBA Copy code Copy code

Public Sub Cells_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim strBowCell As String
 Dim strBowFormula As String
 Dim intCounter As Integer

 'Set the value of the strBowCell string.
 strBowCell = "Scratch.X1"

 'Set the value of the strBowFormula string.
 strBowFormula = "=Min(Width, Height) / 5"

 Set vsoPage = ActivePage

 'If there isn't an active page, set vsoPage
 'to the first page of the active document.
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle on the active page.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section and add a row to the scratch section.
 vsoShape.AddSection visSectionScratch
 vsoShape.AddRow visSectionScratch, visRowScratch, 0

 'Set vsoCell to the Scratch.X1 cell and set its formula.
 Set vsoCell = vsoShape.Cells(strBowCell)
 vsoCell.Formula = strBowFormula

 'Bow in or curve the rectangle's lines by changing
 'each row type from LineTo to ArcTo and entering the bow value.
 For intCounter = 1 To 4
 vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
 Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
 vsoCell.Formula = "-" & strBowCell
 Next intCounter

End Sub


Style.CellsSRC Property (Visio)

 Copy code hover
[image]

Style.CellsSRC Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Cell object that represents a ShapeSheet cell identified by section, row, and column indices. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .CellsSRC(Section, Row, Column)

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The cell's section index.
Row | Required | Integer | The cell's row index.
Column | Required | Integer | The cell's column index.

Return Value

Cell

Remarks

To access any shape formula by its section, row, and column indices, use the CellsSRC property. Constants for section, row, and column indices are declared by the Visio type library as members of VisSectionIndices, VisRowIndices, and VisCellIndices, respectively.

The CellsSRC property might raise an exception if index values for section, row, and column do not identify an actual cell, depending on the section. However, even if no exception is raised, subsequent methods invoked on the returned object fail. You can determine if a cell with particular index values exists by using the CellsSRCExists property.

The CellsSRC property is typically used to iterate through the cells in a section or row. To retrieve a single cell, use the Cells property and specify a cell name. For example:

VBA Copy code Copy code
Set vsoCell = Cells("PinX")

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the CellsSRC property to set a particular ShapeSheet cell by its section, row, and column indices. It draws a rectangle on a page and bows, or curves the lines of the rectangle by changing the shape's lines to arcs. The macro then draws an inner rectangle within the bowed lines of the first rectangle.

VBA Copy code Copy code

Public Sub CellsSRC_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim strBowCell As String
 Dim strBowFormula As String
 Dim intIndex As Integer
 Dim intCounter As Integer

 'Set the value of the strBowCell string.
 strBowCell = "Scratch.X1"

 'Set the value of the strBowFormula string.
 strBowFormula = "=Min(Width, Height) / 5"

 Set vsoPage = ActivePage

 'If there isn't an active page, set vsoPage
 'to the first page of the active document.
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle on the active page.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section to the shape's ShapeSheet
 vsoShape.AddSection visSectionScratch

 'Add a row to the scratch section.
 vsoShape.AddRow visSectionScratch, visRowScratch, 0

 'Set vsoCell to the Scratch.X1 cell and set its formula.
 Set vsoCell = vsoShape.Cells(strBowCell)
 vsoCell.Formula = strBowFormula

 'Bow in or curve the rectangle's lines by changing
 'each row type from LineTo to ArcTo and entering the bow value.
 For intCounter = 1 To 4
 vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
 Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
 vsoCell.Formula = "-" & strBowCell
 Next intCounter

 'Create an inner rectangle.
 'Set the section index for the inner rectangle's Geometry section.
 intIndex = visSectionFirstComponent + 1

 'Add an inner rectangle Geometry section.
 vsoShape.AddSection intIndex

 'Add the first 2 rows to the section.
 vsoShape.AddRow intIndex, visRowComponent, visTagComponent
 vsoShape.AddRow intIndex, visRowVertex, visTagMoveTo

 'Add 4 LineTo rows to the section
 For intCounter = 1 To 4
 vsoShape.AddRow intIndex, visRowLast, visTagLineTo
 Next intCounter

 'Set the inner rectangle start point cell formulas.
 Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 0)
 vsoCell.Formula = "Width * 0 + " & strBowCell
 Set vsoCell = vsoShape.CellsSRC(intIndex, 1, 1)
 vsoCell.Formula = "Height * 0 + " & strBowCell

 'Draw the inner rectangle bottom line.
 Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 0)
 vsoCell.Formula = "Width * 1 - " & strBowCell
 Set vsoCell = vsoShape.CellsSRC(intIndex, 2, 1)
 vsoCell.Formula = "Height * 0 + " & strBowCell

 'Draw the inner rectangle right side line.
 Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 0)
 vsoCell.Formula = "Width * 1 - " & strBowCell
 Set vsoCell = vsoShape.CellsSRC(intIndex, 3, 1)
 vsoCell.Formula = "Height * 1 - " & strBowCell

 'Draw the inner rectangle top line.
 Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 0)
 vsoCell.Formula = "Width * 0 + " & strBowCell
 Set vsoCell = vsoShape.CellsSRC(intIndex, 4, 1)
 vsoCell.Formula = "Height * 1 - " & strBowCell

 'Draw the inner rectangle left side line.
 Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 0)
 vsoCell.Formula = "Geometry2.X1"
 Set vsoCell = vsoShape.CellsSRC(intIndex, 5, 1)
 vsoCell.Formula = "Geometry2.Y1"

End Sub


Style.CellsSRCExists Property (Visio)

 Copy code hover
[image]

Style.CellsSRCExists Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a ShapeSheet cell exists in the scope of a search. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .CellsSRCExists(Section, Row, Column, fExistsLocally)

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
Section | Required | Integer | The cell's section index.
Row | Required | Integer | The cell's row index.
Column | Required | Integer | The cell's column index.
fExistsLocally | Required | Integer | The scope of the search.

Return Value

Integer

Remarks

Constants for section, row, and column indices are declared by the Visio type library as members of VisSectionIndices, VisRowIndices, and VisCellIndices, respectively.

The fExistsLocally argument specifies the scope of the search:

  • If fExistsLocally is non-zero (True), the CellsSRCExists property returns True only if the object contains the cell locally; if the cell is inherited, the CellsSRCExists property returns False.

  • If fExistsLocally is zero (False), the CellsSRCExists property returns True if the object either contains or inherits the cell.

To search for a cell by name, use the CellExists or CellExistsU property.


Style.CellsU Property (Visio)

 Copy code hover
[image]

Style.CellsU Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Cell object that represents a ShapeSheet cell. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .CellsU(localeIndependentCellName)

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
localeIndependentCellName | Required | String | The name of a ShapeSheet cell.

Return Value

Cell

Remarks

CellsU("somestring") raises an "Unexpected end of file" exception if "somestring" does not name an actual cell. You can use the CellExistsU property to determine if a cell with the universal name "somestring" exists.

The cells in a shape's User-Defined Cells and Shape Data sections belong to rows whose names have been assigned by the user or a program. You can use the CellsU property to access cells in named rows.

For example, if "Row_1" is the name of a row in a shape's User-Defined Cells section, you can use this statement to access the first cell in this row (the cell in column zero, which holds the name of the row):

VBA Copy code Copy code
vsoCell = vsoShape.CellsU("User.Row_1")

You can use this statement to access the prompt cell in Row_1:

VBA Copy code Copy code
vsoCell = vsoShape.CellsU("User.Row_1.Prompt")

Next, assume that Row_1 is in the Shape Data section instead of the User- Defined Cells section. You can use this statement to access the first cell in the row (the cell in column zero, which holds the name of the row):

VBA Copy code Copy code
vsoCell = vsoShape.CellsU("Prop.Row_1")

You can use this statement to access other cells in the row:

VBA Copy code Copy code
vsoCell = vsoShape.CellsU("Prop.Row_1.xxx")

where xxx is one of these cells: Label, Prompt, SortKey, Type, Format, Invisible, or Ask.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Cells property to get a Cell object by using the cell's local name. Use the CellsU property to get a Cell object by using the cell's universal name.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the CellsU property to get a particular ShapeSheet cell by its universal name. It draws a rectangle on a page and bows, or curves the lines of the rectangle by changing the shape's lines to arcs. This is accomplished by changing the ShapeSheet row types for each side of the rectangle from LineTo to ArcTo and then changing the values of the X and Y cells in each of these rows.

VBA Copy code Copy code

Public Sub CellsU_Example()

 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim strBowCell As String
 Dim strBowFormula As String
 Dim intCounter As Integer

 'Set the value of the strBowCell string.
 strBowCell = "Scratch.X1"

 'Set the value of the strBowFormula string.
 strBowFormula = "=Min(Width, Height) / 5"

 Set vsoPage = ActivePage

 'If there isn't an active page, set vsoPage
 'to the first page of the active document.
 If vsoPage Is Nothing Then
 Set vsoPage = ActiveDocument.Pages(1)
 End If

 'Draw a rectangle on the active page.
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1)

 'Add a scratch section and add a row to the scratch section.
 vsoShape.AddSection visSectionScratch
 vsoShape.AddRow visSectionScratch, visRowScratch, 0

 'Set vsoCell to the Scratch.X1 cell and set its formula.
 Set vsoCell = vsoShape.CellsU(strBowCell)
 vsoCell.Formula = strBowFormula

 'Bow in or curve the rectangle's lines by changing
 'each row type from LineTo to ArcTo and entering the bow value.
 For intCounter = 1 To 4
 vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
 Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
 vsoCell.Formula = "-" & strBowCell
 Next intCounter

End Sub


Style.Document Property (Visio)

 Copy code hover
[image]

Style.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Style object.

Return Value

Document


Style.EventList Property (Visio)

 Copy code hover
[image]

Style.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Style object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Style.FillBasedOn Property (Visio)

 Copy code hover
[image]

Style.FillBasedOn Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the fill style on which the Style object is based. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .FillBasedOn

expression A variable that represents a Style object.

Return Value

String

Remarks

To base a style on no style, set the FillBasedOn property to a zero-length string ("").


Style.Hidden Property (Visio)

 Copy code hover
[image]

Style.Hidden Property (Visio)
Send feedback

Published: July 16, 2012

Hides or shows a master on a stencil or a style in the user interface. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Hidden

expression A variable that represents a Style object.

Return Value

Integer

Remarks

A master that is hidden still appears in the Drawing Explorer window.


Style.ID Property (Visio)

 Copy code hover
[image]

Style.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ID of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ID

expression A variable that represents a Style object.

Return Value

Long

Remarks

The ID of a shape is unique only within the scope of the page or master. The ID of a page, master, or style is unique within the scope of the document.

If a shape, page, master, or style is deleted, future objects in the same scope may be assigned the same ID. Therefore, persisting shape or style IDs in separate data stores is generally not as sound as persisting unique IDs using the UniqueID property.


Style.IncludesFill Property (Visio)

 Copy code hover
[image]

Style.IncludesFill Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether the style includes fill attributes. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .IncludesFill

expression A variable that represents a Style object.

Return Value

Integer


Style.IncludesLine Property (Visio)

 Copy code hover
[image]

Style.IncludesLine Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether the style includes line attributes. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .IncludesLine

expression A variable that represents a Style object.

Return Value

Integer


Style.IncludesText Property (Visio)

 Copy code hover
[image]

Style.IncludesText Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether the style includes text attributes. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .IncludesText

expression A variable that represents a Style object.

Return Value

Integer


Style.Index Property (Visio)

 Copy code hover
[image]

Style.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Style object in the Styles collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Style object.

Return Value

Long

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.

There are some exceptions. The Colors collection is indexed starting with 0. This is consistent with the numbering displayed next to the colors that appear in the Color Palette dialog box (on the Tools menu, click Color Palette ).

These collections are also indexed starting with 0: AccelItems, AccelTables, MenuSets, MenuItems, Menus, ToolbarItems, Toolbars, and ToolbarSets.


Style.LineBasedOn Property (Visio)

 Copy code hover
[image]

Style.LineBasedOn Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the line style on which a Style object is based. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .LineBasedOn

expression A variable that represents a Style object.

Return Value

String

Remarks

To base a style on no style, set the LineBasedOn property to a zero-length string ("").


Style.Name Property (Visio)

 Copy code hover
[image]

Style.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a Style object.

Return Value

String

Remarks

You can set the Name property of a Style object that represents a style that is not a default Microsoft Visio style. If you attempt to set the Name property of a default Visio style, an error is generated.

A cell has both a local name and a universal name. The local name differs depending on the locale for which the running version of Microsoft Windows is installed. The universal name is the same regardless of what locale is installed. To get the universal name of a cell, use the Name property. To get the local name, use the LocalName property.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Style.NameU Property (Visio)

 Copy code hover
[image]

Style.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of a Style object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .NameU

expression A variable that represents a Style object.

Return Value

String

Remarks

You can set the NameU property of a Style object that represents a style that is not a default Microsoft Office Visio style. If you attempt to set the NameU property of a default Visio style, an error is generated.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Name property to get or set a Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style, or Row object's local name. Use the NameU property to get or set its universal name.


Style.ObjectType Property (Visio)

 Copy code hover
[image]

Style.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Style object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Style.PersistsEvents Property (Visio)

 Copy code hover
[image]

Style.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Style object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Style.Section Property (Visio)

 Copy code hover
[image]

Style.Section Property (Visio)
Send feedback

Published: July 16, 2012

Returns the requested Section object belonging to a style. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Section(Index)

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Integer | A section index.

Return Value

Section

Remarks

Constants that represent sections are prefixed with visSection and are declared by the Microsoft Visio type library in VisSectionIndices.


Style.Stat Property (Visio)

 Copy code hover
[image]

Style.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Style object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Style.TextBasedOn Property (Visio)

 Copy code hover
[image]

Style.TextBasedOn Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the text style on which a Style object is based. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TextBasedOn

expression A variable that represents a Style object.

Return Value

String

Remarks

To base a style on no style, set the TextBasedOn property to a zero-length string ("").


Style Methods (Visio)

 Copy code hover
[image]

Style Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.
GetFormulas | Returns the formulas of many cells.
GetFormulasU | Returns the formulas of many cells.
GetResults | Gets the results or formulas of many cells.
SetFormulas | Sets the formulas of one or more cells.
SetResults | Sets the results or formulas of one or more cells.


Style.Delete Method (Visio)

 Copy code hover
[image]

Style.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a Style object.

Return Value

Nothing


Style.GetFormulas Method (Visio)

 Copy code hover
[image]

Style.GetFormulas Method (Visio)
Send feedback

Published: July 16, 2012

Returns the formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetFormulas(SRCStream(), formulaArray())

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | A stream identifying cells to be queried.
formulaArray() | Required | Variant | Out parameter. An array that receives formulas of queried cells.

Return Value

Nothing

Remarks

The GetFormulas method is like the Formula property of a Cell object, except you can use it to obtain the formulas of many cells at once rather than one cell at a time. The GetFormulas method is a specialization of the GetResults method, which can be used to obtain cell formulas or results. Setting up a call to the GetFormulas method involves slightly less work than setting up the GetResults method.

For Style objects, you can use the GetFormulas method to get formulas of any set of cells.

SID_SRCStream() is an array of 2-byte integers. For Style objects, SID_SRCStream() should be a one-dimensional array of 3n 2-byte integers for some n >= 1. GetFormulas interprets the stream as:

VBA Copy code Copy code
{sectionIdx, rowIdx, cellIdx}n

where sectionIdx is the section index of the desired cell, rowIdx is its row index and cellIdx is its cell index.

If the GetFormulas method succeeds, formulaArray() returns a one-dimensional array of n variants indexed from 0 to n - 1. Each variant returns a formula as a string. formulaArray() is an out parameter that is allocated by the GetFormulas method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetFormulas method returns. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.) The GetFormulas method fails if formulaArray() is null.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetFormulas method to get more than one formula when you are using local syntax. Use the GetFormulasU method to get more than one formula when you are using universal syntax.

Example

The following macro shows how to use the GetFormulas method. It assumes that there is an active Microsoft Visio page that has at least three shapes on it. It uses GetFormulas to get the width of shape 1, the height of shape 2, and the angle of shape 3.

This example uses the GetFormulas method of the Page object to get three cell formulas. The input array has four slots for each cell, as it also would for Master objects. For Shape or Style objects, only three slots would be needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub GetFormulas_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer

 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Return the formulas of the cells.
 Dim avarFormulaArray() As Variant
 ActivePage.GetFormulas aintSheetSectionRowColumn, avarFormulaArray

 Debug.Print "Shape 1 width is "; avarFormulaArray(0)
 Debug.Print "Shape 2 height is "; avarFormulaArray(1)
 Debug.Print "Shape 3 angle is "; avarFormulaArray(2)

Exit Sub

HandleError:
 MsgBox "Error"
Exit Sub

End Sub


Style.GetFormulasU Method (Visio)

 Copy code hover
[image]

Style.GetFormulasU Method (Visio)
Send feedback

Published: July 16, 2012

Returns the formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetFormulasU(SRCStream(), formulaArray())

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
SRCStream() | Required | Integer | A stream identifying cells to be queried.
formulaArray() | Required | Variant | Out parameter. An array that receives formulas of queried cells.

Return Value

Nothing

Remarks

The GetFormulasU method is like the FormulaU property of a Cell object, except you can use it to obtain the formulas of many cells at once rather than one cell at a time. The GetFormulasU method is a specialization of the GetResults method, which can be used to obtain cell formulas or results. Setting up a call to the GetFormulasU method involves slightly less work than setting up the GetResults method.

You can use the GetFormulasU method to get formulas of any set of cells.

SRCStream() is an array of 2-byte integers. For Style objects, SRCStream() should be a one-dimensional array of 3n 2-byte integers for some n >= 1. GetFormulasU interprets the stream as:

VBA Copy code Copy code
{sectionIdx, rowIdx, cellIdx}n

where sectionIdx is the section index of the desired cell, rowIdx is its row index and cellIdx is its cell index.

If the GetFormulasU method succeeds, formulaArray() returns a one-dimensional array of n variants indexed from 0 to n - 1. Each variant returns a formula as a string. formulaArray() is an out parameter that is allocated by the GetFormulasU method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetFormulas method returns. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.) The GetFormulasU method fails if formulaArray() is Null.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetFormulas method to get more than one formula when you are using local syntax. Use the GetFormulasU method to get more than one formula when you are using universal syntax.


Style.GetResults Method (Visio)

 Copy code hover
[image]

Style.GetResults Method (Visio)
Send feedback

Published: July 16, 2012

Gets the results or formulas of many cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetResults(SRCStream(), Flags, UnitsNamesOrCodes(), resultArray())

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | An array identifying cells to be queried.
Flags | Required | Integer | Flags that influence the type of entries returned in results.
UnitsNamesOrCodes() | Required | Variant | An array of measurement units that results are to be returned in.
resultArray() | Required | Variant | Out parameter. An array that receives results or formulas of queried cells.

Return Value

Nothing

Remarks

The GetResults method is like the Result property for the Cell object, except that it can be used to get the results (values) of many cells at once, rather than one cell at a time.

For Style objects, you can use the GetResults method to get results of any set of cells.

SID_SRCStream() is an array of 2-byte integers. For Style objects, SID_SRCStream() should be a one-dimensional array of 3n 2-byte integers for n >= 1. The GetResults method interprets SID_SRCStream() as:

VBA Copy code Copy code
{sectionIdx, rowIdx, cellIdx }n

where sectionIdx is the section index of the desired cell, rowIdx is its row index and cellIdx is its cell index.

The Flags argument indicates what data type the returned results should be expressed in. Its value should be one of the following.

Constant | Value | Description
visGetFloats | 0 | Results returned as doubles (VT_R8).
visGetTruncatedInts | 1 | Results returned as truncated long integers (VT_I4).
visGetRoundedInts | 2 | Results returned as rounded long integers (VT_I4).
visGetStrings | 3 | Results returned as strings (VT_BSTR).
visGetFormulas | 4 | Formulas returned as strings (VT_BSTR).
visGetFormulasU | 5 | Formulas returned in universal syntax (VT_BSTR).

The UnitsNamesOrCodes() argument is an array that controls what measurement units individual results are returned in. Each entry in the array can be a string such as "inches", "inch", "in.", or "i". Strings may be used for all supported Visio units such as centimeters, meters, miles, and so on. You can also indicate desired units with integer constants (visCentimeters, visInches, and so on) declared by the Visio type library. Note that the values specified in the UnitsNamesOrCodes() array have no effect if Flags is visGetFormulas.

If UnitsNamesOrCodes() is not null, the application expects it to be a one-dimensional array of 1 <= u Variants. Each entry can be a string or integer code, or empty (nothing). If the i'th entry is empty, the i'th returned result is returned in the units designated by UnitsNamesOrCodes(j), where j is the index of the most recent prior non-empty entry. Thus if you want all returned values to be in the same units, you need only pass a UnitsNamesOrCodes() array with one entry. If there is no prior non-empty entry, or if no UnitsNameOrCodes() array is supplied, visNumber (0x20) is used. This causes internal units (like the ResultIU property of a Cell object) to be returned.

If the GetResults method succeeds, results returns a one-dimensional array of n variants indexed from zero (0) to n - 1. The type of the returned variants is a function of Flags. The resultArray() parameter is an out parameter that is allocated by the GetResults method, which passes ownership back to the caller. The caller should eventually perform SafeArrayDestroy on the returned array. Note that SafeArrayDestroy has the side effect of clearing the variants referenced by the array's entries, hence deallocating any strings the GetResults method returns. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.)

Example

The following example shows how to use the GetResults method. This example assumes there is an active page that has at least 3 shapes on it. It uses the GetResults method to get the width of shape 1, the height of shape 2, and the angle of shape 3.

This example uses the GetResults method of the Page object to get 3 cell formulas. The input array has 4 slots for each cell, as it also would for Master objects. For Shape or Style objects, only 3 slots would be needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub GetResults_Example()

 On Error GoTo HandleError

 Dim intCounter As Integer
 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer

 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Get first two values in inches. The second element in
 'the units array is left uninitialized (empty) because we
 'want the second result in the same units as the first
 'result. The third result is initialized in degrees. Note that
 'units can be expressed as a string or an integer constant.
 Dim avarUnits(1 To 3) As Variant
 avarUnits(1) = "in."
 avarUnits(3) = visDegrees

 'Return results of cells as an array of floating point numbers.
 Dim avarResults() As Variant
 ActivePage.GetResults aintSheetSectionRowColumn, visGetFloats, _
 avarUnits, avarResults

 For intCounter = 0 To 3
 Debug.Print avarResults(intCounter)
 Next

 Exit Sub

HandleError:
 MsgBox "Error"
 Exit Sub

End Sub


Style.SetFormulas Method (Visio)

 Copy code hover
[image]

Style.SetFormulas Method (Visio)
Send feedback

Published: July 16, 2012

Sets the formulas of one or more cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .SetFormulas(SRCStream(), formulaArray(), Flags)

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | Stream identifying cells to be modified.
formulaArray() | Required | Variant | Formulas to be assigned to identified cells.
Flags | Required | Integer | Flags that influence the behavior of SetFormulas.

Return Value

Integer

Remarks

The SetFormulas method behaves like the Formula property except that you can use it to set the formulas of many cells at once, rather than one cell at a time.

For Style objects, you can use the SetFormulas method to set results of any set of cells. You tell the SetFormulas method which cells you want to set by passing an array of integers in SID_SRCStream(). SID_SRCStream() is a one-dimensional array of 2-byte integers.

For Style objects, SID_SRCStream() should be a one-dimensional array of 3n 2-byte integers for n >= 1. The SetFormulas method interprets the stream as:

VBA Copy code Copy code
{sectionIdx, rowIdx, cellIdx }n

where sectionIdx is the section index of the desired cell, rowIdx is its row index, and cellIdx is its cell index.

The formulaArray() parameter should be a one-dimensional array of 1 <= m variants. Each Variant should be a String, a reference to a String, or empty. If formulaArray(i) is empty, the i'th cell will be set to the formula in formulaArray(j), where j is the index of the most recent prior entry that is not empty. If there is no prior entry that is not empty, the corresponding cell is not altered. If fewer formulas than cells are specified (m < n), the i'th cell, i > m, will be set to the same formula as was chosen to set the m'th cell to. Thus to set many cells to the same formula, you need pass only one copy of the formula.

The Flags argument should be a bitmask of the following values.

Constant | Value | Description
visSetBlastGuards | &H2 | Override present cell values even if they're guarded.
visSetTestCircular | &H4 | Test for establishment of circular cell references.
visSetUniversalSyntax | &H8 | Formulas are in universal syntax.

The value returned by the SetFormulas method is the number of entries in SID_SRCStream() that were successfully processed. If i < n entries process correctly, but an error occurs on the i + 1st entry, the SetFormulas method raises an exception and returns i. Otherwise, n is returned.

Example

The following macro shows how to use the SetFormulas method. It assumes that there is an active Microsoft Office Visio page that has at least three shapes on it. It uses the GetFormulas method to get the width of shape 1, the height of shape 2, and the angle of shape 3. It then uses SetFormulas to set the width of shape 1 to the height of shape 2 and the height of shape 2 to the width of shape 1. The angle of shape 3 is left unaltered.

This example uses the GetFormulas method of the Page object to get three cell formulas and the SetFormulas method of the same object to set the formulas. The input array has four slots for each cell, as it also would for Master objects. For Shape or Style objects, only three slots are needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub SetFormulas_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To 3 * 4) As Integer
 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Return the formulas of the cells.
 Dim avarFormulaArray() As Variant
 ActivePage.GetFormulas aintSheetSectionRowColumn, avarFormulaArray

 'Use SetFormulas to:
 ' - Set the width of shape 1 to height of shape 2.
 ' - Set height of shape 2 to width of shape 1.
 ' Note: avarFormulaArray() is indexed from 0 to 2.
 Dim varTemp As variant
 varTemp = avarFormulaArray(0)
 avarFormulaArray(0) = avarFormulaArray(1)
 avarFormulaArray(1) = varTemp

 'Pass the same array back to SetFormulas that we
 'just passed to GetFormulas, leaving angle alone. By setting
 'the sheet ID entry in the third slot of the
 'aintSheetSectionRowColumn array to visInvalShapeID,
 'we tell SetFormulas to ignore that slot.
 aintSheetSectionRowColumn (9) = visInvalShapeID

 'Tell Microsoft Visio to set the formulas of the cells.
 ActivePage.SetFormulas aintSheetSectionRowColumn, avarFormulaArray, 0

 Exit Sub

HandleError:

 MsgBox "Error"

 Exit Sub

End Sub


Style.SetResults Method (Visio)

 Copy code hover
[image]

Style.SetResults Method (Visio)
Send feedback

Published: July 16, 2012

Sets the results or formulas of one or more cells.

Version Information

Version Added: Visio 4.5

Syntax

expression .SetResults(SRCStream(), UnitsNamesOrCodes(), resultArray(), Flags)

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
SID_SRCStream() | Required | Integer | An array identifying cells to be modified.
UnitsNamesOrCodes() | Required | Variant | An array of measurement units to be attributed to entries in the results array.
resultArray() | Required | Variant | Results or formulas to be assigned to identified cells.
Flags | Required | Integer | Flags that influence the behavior of SetResults.

Return Value

Integer

Remarks

The SetResults method is like the Result method of a Cell object, except that it can be used to set the results (values) of many cells at once, rather than one cell at a time.

For Style objects, you can use the SetResults method to set results of any set of cells. You tell the SetResults method which cells you want to set by passing an array of integers in SID_SRCStream(). SID_SRCStream() is a one-dimensional array of 2-byte integers.

For Style objects, SID_SRCStream() should be a one-dimensional array of 3n 2-byte integers for n >= 1. The SetResults method interprets the stream as:

VBA Copy code Copy code
{sectionIdx, rowIdx, cellIdx }n

where sectionIdx is the section index of the desired cell, rowIdx is its row index, and cellIdx is its cell index.

The UnitsNamesOrCodes() array controls what measurement units individual entries in results are in. Each entry in the array can be a string such as "inches", "inch", "in.", or "i". Strings may be used for all supported Microsoft Office Visio units such as centimeters, meters, miles, and so on. You can also indicate desired units with integer constants (visCentimeters, visInches, and so on) declared by the Visio type library in VisUnitCodes. For a list of constants used for units of measure, see About Units of Measure. Note that the values specified in the UnitsNamesOrCodes() array have no effect if visSetFormulas is set in Flags.

If UnitsNamesOrCodes() is not empty, we expect it to be a one-dimensional array of 1 <= u variants. Each entry can be a string or integer code, or empty (nothing). If the i'th entry is empty, the i'th entry in resultArray() is in the units designated by units(j), where j is the most recent prior entry that is not empty. Thus, if you want all entries in resultArray() to be interpreted in the same units, you need only pass a UnitsNamesOrCodes() array that has one entry. If there is no prior entry that is not empty, or if no units array is supplied, visNumber (0x20) will be used. This causes the application to default to internal units (as does the ResultIU property of a Cell object).

The resultArray() parameter should be a one-dimensional array of 1 <= m variants. A result can be passed as Double, Integer, String, or a reference to a String. Strings are accepted only if visSetFormulas is set in Flags, in which case strings are interpreted as formulas. If resultArray(i) is empty, the i'th cell will be set to the value in resultArray(j), where j is the index of the most recent prior entry that is not empty. If there is no prior entry that is not empty, the corresponding cell is not altered. If fewer results than cells are specified (if m < n), the i'th cell, i < m, will be set to the same value as the m'th cell. Thus, to set many cells to the same value, you need only pass one copy of the value.

The Flags parameter should be a bitmask of the following values.

Constant | Value | Description
visSetFormulas | &H1 | Treat strings in results as formulas.
visSetBlastGuards | &H2 | Override present cell values even if they're guarded.
visSetTestCircular | &H4 | Test for establishment of circular cell references.
visSetUniversalSyntax | &H8 | Formulas are in universal syntax

The value returned by the SetResults method is the number of entries in SID_SRCStream() that were successfully processed. If i < n entries are processed correctly, but an error occurs on the i + 1st entry, the SetResults method raises an exception and returns i. Otherwise, n is returned.

Example

The following example shows how to use the SetResults method. This example assumes there is an active page that has at least 3 shapes on it. It uses the GetResults method to get the width of shape 1, the height of shape 2, and the angle of shape 3. It then uses SetResults to set the width of shape 1 to the height of shape 2 and the height of shape 2 to the width of shape 1.The angle of shape 3 is left unaltered.

This example uses the GetResults method of the Page object to get 3 cell formulas and the SetResults method of the same object to set the formulas. The input array has 4 slots for each cell, as it also would for Master objects. For Shape or Style objects, only 3 slots are needed for each cell (section, row, and cell).

VBA Copy code Copy code

Public Sub Set Results_Example()

 On Error GoTo HandleError

 Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer
 aintSheetSectionRowColumn(1) = ActivePage.Shapes(1).ID
 aintSheetSectionRowColumn(2) = visSectionObject
 aintSheetSectionRowColumn(3) = visRowXFormOut
 aintSheetSectionRowColumn(4) = visXFormWidth

 aintSheetSectionRowColumn(5) = ActivePage.Shapes(2).ID
 aintSheetSectionRowColumn(6) = visSectionObject
 aintSheetSectionRowColumn(7) = visRowXFormOut
 aintSheetSectionRowColumn(8) = visXFormHeight

 aintSheetSectionRowColumn(9) = ActivePage.Shapes(3).ID
 aintSheetSectionRowColumn(10) = visSectionObject
 aintSheetSectionRowColumn(11) = visRowXFormOut
 aintSheetSectionRowColumn(12) = visXFormAngle

 'Get the first two values in inches. The second element in
 'the units array is left uninitialized (empty) because we
 'want the second result in the same units as the first
 'result. The third result is initialized in degrees. Note that
 'units can be expressed as a string or an integer constant.
 Dim avarUnits(1 To 3) As Variant
 avarUnits(1) = "in."
 avarUnits(3) = visDegrees

 'Return results of cells as an array of floating point numbers.
 Dim avarResults() As Variant
 ActivePage.GetResults aintSheetSectionRowColumn, visGetFloats, _
 avarUnits, avarResults

 'Use SetResults to:

 ' - Set the width of shape 1 to the height of shape 2.

 ' - Set the height of shape 2 to the width of shape 1.

 'NOTE: avarResults() is indexed from 0 to 2.

 Dim varTemp As variant
 varTemp = avarResults(0)
 avarResults(0) = avarResults(1)
 avarResults(1) = varTemp

 'Pass the same array back to SetResults that we
 'just passed to GetResults, but leave the angle
 'alone. By setting the sheet ID entry in the third
 'slot of the aintSheetSectionRowColumn array to
 'visInvalShapeID, we tell SetResults to ignore that slot.
 aintSheetSectionRowColumn(9) = visInvalShapeID

 'Set the results of the cells.
 ActivePage.SetResults aintSheetSectionRowColumn, avarUnits, avarResults, 0

 Exit Sub

HandleError:

 MsgBox "Error"

 Exit Sub

End Sub


Style Events (Visio)

 Copy code hover
[image]

Style Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
BeforeStyleDelete | Occurs before a style is deleted.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.


Style.BeforeStyleDelete Event (Visio)

 Copy code hover
[image]

Style.BeforeStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a style is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Style.QueryCancelStyleDelete Event (Visio)

 Copy code hover
[image]

Style.QueryCancelStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelStyleDelete after the user has directed the instance to delete a style.

  • If any event handler returns True (cancel), the instance fires StyleDeleteCanceled and does not delete the style.

  • If all handlers return False (don't cancel), the instance fires BeforeStyleDelete and then deletes the style.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Style.StyleChanged Event (Visio)

 Copy code hover
[image]

Style.StyleChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleChanged(ByVal Style As [IVSTYLE])

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Style.StyleDeleteCanceled Event (Visio)

 Copy code hover
[image]

Style.StyleDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _StyleDeleteCanceled(ByVal Style As [IVSTYLE])

expression A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Styles Object (Visio)

 Copy code hover
[image]

Styles Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Style object for each style defined in a document.

Version Information

Version Added: Visio 2.0

Remarks

To retrieve a Styles collection, use the Styles property of a Document object.

The default property of a Styles collection is Item.


Styles Members (Visio)

 Copy code hover
[image]

Styles Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Style object for each style defined in a document.

Events

Name | Description
BeforeStyleDelete | Occurs before a style is deleted.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
StyleAdded | Occurs after a new style is added to a document.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.

Methods

Name | Description
Add | Adds a new Style object to a Styles collection.
GetNames | Returns the names of all items in a collection.
GetNamesU | Returns the universal names of all items in a collection.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Stat | Returns status information for an object. Read-only.


Styles Properties (Visio)

 Copy code hover
[image]

Styles Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ItemU | Returns an object from a collection. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
Stat | Returns status information for an object. Read-only.


Styles.Application Property (Visio)

 Copy code hover
[image]

Styles.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Styles object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Styles.Count Property (Visio)

 Copy code hover
[image]

Styles.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Styles object.

Return Value

Long

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Styles.Document Property (Visio)

 Copy code hover
[image]

Styles.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Styles object.

Return Value

Document


Styles.EventList Property (Visio)

 Copy code hover
[image]

Styles.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Styles object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Styles.Item Property (Visio)

 Copy code hover
[image]

Styles.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(NameOrIndex)

expression A variable that represents a Styles collection.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the name, unique ID, or index of the object to retrieve.

Return Value

Style

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statements are equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)
objRet = object(stringExpression)

You can retrieve an object in an Addons, Documents, Fonts, Hyperlinks, Layers, Masters, MasterShortcuts, OLEObjects, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

For more information about passing ID strings to the Item property, see the topic for the UniqueID property in this Automation Reference.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.


Styles.ItemFromID Property (Visio)

 Copy code hover
[image]

Styles.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item of a collection using the ID of the item. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemFromID(nID)

expression A variable that represents a Styles collection.

Parameters

Name | Required/Optional | Data Type | Description
nID | Required | Long | The ID of the object to retrieve.

Return Value

Style

Remarks

The ID of a Shape object uniquely identifies the shape within its page or master.

The ID of a Style object uniquely identifies the style within its document.

The ID of a Font object corresponds to the number stored in the Font cell of a row in a shape's Character Properties section. The ID associated with a particular font varies between systems or as fonts are installed on and removed from a given system.

The ID of an Event object uniquely identifies an event in its EventList collection for the life of the collection.


Styles.ItemU Property (Visio)

 Copy code hover
[image]

Styles.ItemU Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .ItemU(NameOrIndex)

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
NameOrIndex | Required | Variant | Contains the universal name, unique ID, or index of the object to retrieve.

Return Value

Style

Remarks

You can retrieve an object in an Addons, Hyperlinks, Layers, Masters, MasterShortcuts, Pages, Shapes, or Styles collection by passing the object's name as a string expression in a Variant.

If you retrieve a Shape object by name, the ItemU property searches all shapes in the Shapes collection's containing page or containing master, in addition to the collection's containing shape. Therefore, the Shape object returned by the ItemU property can be a shape that is not in the Shapes collection.

You can also pass the unique ID string of a Master or Shape object to the ItemU property. For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("{2287DC42-B167-11CE-88E9-0020AFDDD917}")

If such a string is passed to the ItemU property of a Shapes collection, all the shapes contained in the collection are searched. Shapes within the group shapes in the containing shape are not searched.

To search all shapes in the collection, plus the shapes inside groups and the containing shape of the collection, prefix the unique ID string with an asterisk (*). For example:

VBA Copy code Copy code
objRet = vsoShapes.ItemU("*{2287DC42-B167-11CE-88E9-0020AFDDD917}")
Note Note

  • In Visio 2000 only, vsoShapes.ItemU("{guid}") examined the Shapes collection's containing shape and all descendants, and vsoShapes.ItemU("*{guid}") examined all shapes in the Shapes collection's containing page or containing master.

  • Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

    As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the Item property to access an object in the Masters, Pages, Shapes, Styles, Layers, or MasterShortcuts collection by using its local name. Use the ItemU property to access an object from one of these collections by using the object's universal name.

Example

This Microsoft Visual Basic macro shows how to use the ItemU property of the Pages collection to get the Shapes collection. Then it uses the ItemU property of the Shapes collection to print the universal names of all shapes on Page-1 in the Immediate window.

To run this macro, make sure the active document has shapes on Page-1.

VBA Copy code Copy code
Public Sub ItemU_Example()

    Dim intCounter As Integer
    Dim intShapeCount As Integer
    Dim vsoShapes As Visio.Shapes

    Set vsoShapes = ActiveDocument.Pages.ItemU(1).Shapes

    Debug.Print "Shapes in Document: "; ActiveDocument.Name
    Debug.Print "          on  Page: "; ActiveDocument.Pages.ItemU(1).Name

    intShapeCount = vsoShapes.Count

    If intShapeCount > 0 Then

        For intCounter = 1 To intShapeCount
            Debug.Print " "; vsoShapes.ItemU(intCounter).Name
        Next intCounter

    Else

        Debug.Print " No Shapes On Page"

    End If

End Sub


Styles.ObjectType Property (Visio)

 Copy code hover
[image]

Styles.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Styles object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Styles.PersistsEvents Property (Visio)

 Copy code hover
[image]

Styles.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Styles object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Styles.Stat Property (Visio)

 Copy code hover
[image]

Styles.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Styles object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Styles Methods (Visio)

 Copy code hover
[image]

Styles Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new Style object to a Styles collection.
GetNames | Returns the names of all items in a collection.
GetNamesU | Returns the universal names of all items in a collection.


Styles.Add Method (Visio)

 Copy code hover
[image]

Styles.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new Style object to a Styles collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add(StyleName, BasedOn, fIncludesText, fIncludesLine, fIncludesFill)

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
StyleName | Required | String | The new style name.
BasedOn | Required | String | The name of the style on which to base the new style.
fIncludesText | Required | Integer | Zero to disable text attributes, or non-zero to enable them.
fIncludesLine | Required | Integer | Zero to disable line attributes, or non-zero to enable them.
fIncludesFill | Required | Integer | Zero to disable fill attributes, or non-zero to enable them.

Return Value

Style

Remarks

To base the new style on no style, pass a zero-length string ("") for the BasedOn argument.

Example

The following macro shows how to add Style objects to the Styles collection. It shows how to add a new style based on an existing style, as well as how to add a new style created from scratch.

VBA Copy code Copy code
Public Sub AddStyle_Example()

 Dim vsoDocument As Visio.Document
 Dim vsoStyles As Visio.Styles
 Dim vsoStyle As Visio.Style

 'Add a document based on the Basic Diagram template.
 Set vsoDocument = Documents.Add("Basic Diagram.vst")

 'Add a style named "My FillStyle" to the Styles collection.
 'This style is based on the Basic style and includes
 'only a Fill style.
 Set vsoStyles = vsoDocument.Styles
 Set vsoStyle = vsoStyles.Add("My FillStyle", "Basic", 0, 0, 1)

 'Add a style named "My NoStyle" to the Styles collection.
 'This style is not based on an existing style and includes
 'Text, Line, and Fill styles.
 Set vsoStyle = vsoStyles.Add("My NoStyle", "", 1, 1, 1)

End Sub


Styles.GetNames Method (Visio)

 Copy code hover
[image]

Styles.GetNames Method (Visio)
Send feedback

Published: July 16, 2012

Returns the names of all items in a collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNames(localeSpecificNameArray())

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
localeSpecificNameArray() | Required | String | Out parameter. An array that receives names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNames method succeeds, localeSpecificNameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. localeSpecificNameArray() is an out parameter that is allocated by the GetNames method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Visual Basic for Applications take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.


Styles.GetNamesU Method (Visio)

 Copy code hover
[image]

Styles.GetNamesU Method (Visio)
Send feedback

Published: July 16, 2012

Returns the universal names of all items in a collection.

Version Information

Version Added: Visio 4.5

Syntax

expression .GetNamesU(localeIndependentNameArray())

expression A variable that represents a Styles collection.

Parameters

Name | Required/Optional | Data Type | Description
localeIndependentNameArray() | Required | String | Out parameter. An array that receives the names of members of the indicated object.

Return Value

Nothing

Remarks

If the GetNamesU method succeeds, localeIndependentNameArray() returns a one-dimensional array of n strings indexed from 0 to n - 1, where n equals the Count property of the object. The localeIndependentNameArray() parameter is an out parameter that is allocated by the GetNamesU method, which passes ownership back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. (Microsoft Visual Basic and Microsoft Visual Basic for Applications take care of this for you.)

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, and layers. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized. Use the GetNames method to get the local name of more than one object. Use the GetNamesU method to get the universal name of more than one object.


Styles Events (Visio)

 Copy code hover
[image]

Styles Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
BeforeStyleDelete | Occurs before a style is deleted.
QueryCancelStyleDelete | Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.
StyleAdded | Occurs after a new style is added to a document.
StyleChanged | Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.
StyleDeleteCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.


Styles.BeforeStyleDelete Event (Visio)

 Copy code hover
[image]

Styles.BeforeStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a style is deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Styles.QueryCancelStyleDelete Event (Visio)

 Copy code hover
[image]

Styles.QueryCancelStyleDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelStyleDelete(ByVal Style As [IVSTYLE])

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that is going to be deleted.

Remarks

A Microsoft Visio instance fires QueryCancelStyleDelete after the user has directed the instance to delete a style.

  • If any event handler returns True (cancel), the instance fires StyleDeleteCanceled and does not delete the style.

  • If all handlers return False (don't cancel), the instance fires BeforeStyleDelete and then deletes the style.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Styles.StyleAdded Event (Visio)

 Copy code hover
[image]

Styles.StyleAdded Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a new style is added to a document.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleAdded(ByVal Style As [IVSTYLE])

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was added to the document.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Styles.StyleChanged Event (Visio)

 Copy code hover
[image]

Styles.StyleChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _StyleChanged(ByVal Style As [IVSTYLE])

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
style | Required | [IVSTYLE] | The style that changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Styles.StyleDeleteCanceled Event (Visio)

 Copy code hover
[image]

Styles.StyleDeleteCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _StyleDeleteCanceled(ByVal Style As [IVSTYLE])

expression A variable that represents a Styles object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | [IVSTYLE] | The style that was going to be deleted.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Toolbar Object (Visio)

 Copy code hover
[image]

Toolbar Object (Visio)
Send feedback

Published: July 16, 2012

Represents a group of toolbar items in a Microsoft Visio window.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The default property of a Toolbar object is Caption.

The index of the Toolbar object within the Toolbars collection corresponds to its order in the Visio window, starting with zero (0) for the toolbar closest to the top. Up to 10 toolbars can be displayed in a Visio window at one time.


Toolbar Members (Visio)

 Copy code hover
[image]

Toolbar Members (Visio)
Send feedback

Published: July 16, 2012

Represents a group of toolbar items in a Microsoft Visio window.

Methods

Name | Description
Delete | Deletes an object.

Properties

Name | Description
BuiltIn | Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.
Caption | Gets or sets the caption for an object. Read/write.
Enabled | Determines whether or not an object is currently enabled. Read/write.
Height | Gets or sets the height of a toolbar. Read/write.
Index | Gets the ordinal position of a Toolbar object in a Toolbars collection. Read-only.
Left | Gets the distance in pixels between the left edge of the object and the left side of the docking area. Sets the distance in pixels between the left edge of an object and the left edge of the screen. Read/write.
Parent | Determines the parent of an object. Read-only.
Position | Gets or sets the position of an object. Read/write.
Protection | Determines how a Toolbar object is protected from user customization. Read/write.
RowIndex | Gets or sets the docking order of a Toolbar object in relation to other items in the same docking area. Read/write.
ToolbarItems | Returns the ToolbarItems collection of a Toolbar object. Read-only.
Top | Gets the distance between the top of an object and the top of the docking area or the top of the screen if the object isn't docked; it sets the distance between the top of a Toolbar object and the top of the screen. Read/write.
Visible | Determines whether an object is visible. Read/write.
Width | Gets the width of an object in pixels. Read/write.


Toolbar Properties (Visio)

 Copy code hover
[image]

Toolbar Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
BuiltIn | Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.
Caption | Gets or sets the caption for an object. Read/write.
Enabled | Determines whether or not an object is currently enabled. Read/write.
Height | Gets or sets the height of a toolbar. Read/write.
Index | Gets the ordinal position of a Toolbar object in a Toolbars collection. Read-only.
Left | Gets the distance in pixels between the left edge of the object and the left side of the docking area. Sets the distance in pixels between the left edge of an object and the left edge of the screen. Read/write.
Parent | Determines the parent of an object. Read-only.
Position | Gets or sets the position of an object. Read/write.
Protection | Determines how a Toolbar object is protected from user customization. Read/write.
RowIndex | Gets or sets the docking order of a Toolbar object in relation to other items in the same docking area. Read/write.
ToolbarItems | Returns the ToolbarItems collection of a Toolbar object. Read-only.
Top | Gets the distance between the top of an object and the top of the docking area or the top of the screen if the object isn't docked; it sets the distance between the top of a Toolbar object and the top of the screen. Read/write.
Visible | Determines whether an object is visible. Read/write.
Width | Gets the width of an object in pixels. Read/write.


Toolbar.BuiltIn Property (Visio)

 Copy code hover
[image]

Toolbar.BuiltIn Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .BuiltIn

expression A variable that represents a Toolbar object.

Return Value

Boolean


Toolbar.Caption Property (Visio)

 Copy code hover
[image]

Toolbar.Caption Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the caption for an object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Caption

expression A variable that represents a Toolbar object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.


Toolbar.Enabled Property (Visio)

 Copy code hover
[image]

Toolbar.Enabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether or not an object is currently enabled. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Enabled

expression A variable that represents a Toolbar object.

Return Value

Boolean

Example

This example shows how to use the Enabled property to enable hiding or showing a toolbar. The example adds a custom toolbar to the Toolbars collection. This toolbar appears in the Visio user interface and is available while the document is active.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Sub Enabled_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'Check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'Use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'Use the application custom toolbars.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'Use the document custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add

 'Set the title of the toolbar.
 vsoToolbar.Caption = "Example"

 'Enable hiding or showing the toolbar.
 vsoToolbar.Enabled = True

 'Show the toolbar.
 vsoToolbar.Visible = True

 'Add an item to the toolbar.
 Set vsoToolbarItem = vsoToolbar.ToolbarItems.Add
 With vsoToolbarItem

 'Set the new item to be a button.
 .CntrlType = Visio.visCtrlTypeBUTTON

 'Set the icon of the new button.
 .FaceID = Visio.visIconIXCUSTOM_CARDS

 'Set the CmdNum property of the new button.
 .CmdNum = 1

 'Set the Width property of the new button
 'wide enough that the toolbar name is readable.
 .Width = 100

 End With

 'Tell Visio to use the new UIOjbect object while
 'this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


Toolbar.Height Property (Visio)

 Copy code hover
[image]

Toolbar.Height Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the height of a toolbar. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Height

expression A variable that represents a Toolbar object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the object is docked or protected from resizing, the application returns an error.


Toolbar.Index Property (Visio)

 Copy code hover
[image]

Toolbar.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Toolbar object in a Toolbars collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Toolbar object.

Return Value

Long

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

These collections are indexed starting with 0: AccelItems, AccelTables, MenuSets, MenuItems, Menus, ToolbarItems, Toolbars, and ToolbarSets.


Toolbar.Left Property (Visio)

 Copy code hover
[image]

Toolbar.Left Property (Visio)
Send feedback

Published: July 16, 2012

Gets the distance in pixels between the left edge of the object and the left side of the docking area. Sets the distance in pixels between the left edge of an object and the left edge of the screen. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Left

expression A variable that represents a Toolbar object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The value of Left must be greater than or equal to zero.

Example

This example shows how to use the Left property to set the position of a UIObject object. The example adds a custom toolbar to the cloned toolbars collection. This toolbar appears in the Microsoft Visio user interface and is available while the document is active.

To restore Visio's built-in toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Sub Left_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'Check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'Use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'Use the application custom toolbars.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'Use the document custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set VsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add
 With vsoToolbar

 'Set the title of the toolbar.
 .Caption = "My New Toolbar"

 'Float the toolbar at coordinates (300,200).
 .Position = Visio.visBarFloating
 .Left = 300
 .Top = 200

 End With

 'Tell Microsoft Office Visio to use the new UIObject object while
 'this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


Toolbar.Parent Property (Visio)

 Copy code hover
[image]

Toolbar.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a Toolbar object.

Return Value

Toolbars

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it.


Toolbar.Position Property (Visio)

 Copy code hover
[image]

Toolbar.Position Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the position of an object. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Position

expression A variable that represents a Toolbar object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constants that represent possible Position property values are listed below. They are also declared by the Visio type library in VisUIBarPosition.

Constant | Value
visBarLeft | 0
visBarTop | 1
visBarRight | 2
visBarBottom | 3
visBarFloating | 4
visBarPopup | 5
visBarMenu | 6

Example

This example shows how to use the Position property to set the position of a custom toolbar. The example adds a custom toolbar to the Toolbars collection. The toolbar appears in the Visio user interface and is available while the document is active.

To restore the built-in toolbars in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Sub Position_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'Check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'Use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'Use the application custom toolbars.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'Use the document custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add
 With vsoToolbar

 'Set the title of the toolbar.
 .Caption = "Test"

 'Float the toolbar at coordinates (300,200).
 .Position = Visio.visBarFloating
 .Left = 300
 .Top = 200

 'Disallow docking the new toolbar.
 .Protection = Visio.visBarNoHorizontalDock _
 + Visio.visBarNoVerticalDock

 End With

 'Use the new UIObject object while
 'this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


Toolbar.Protection Property (Visio)

 Copy code hover
[image]

Toolbar.Protection Property (Visio)
Send feedback

Published: July 16, 2012

Determines how a Toolbar object is protected from user customization. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Protection

expression A variable that represents a Toolbar object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The value of the Protection property can be one or a combination of the following constants declared by the Visio type library in VisUIBarProtection.

Constant | Value | Description
visBarNoProtection | 0 | No protection.
visBarNoCustomize | 1 | Cannot be customized.
visBarNoResize | 2 | Cannot be resized.
visBarNoMove | 4 | Cannot be moved.
visBarNoChangeDock | 16 | Cannot be docked or floating.
visBarNoVerticalDock | 32 | Cannot be docked vertically.
visBarNoHorizontalDock | 64 | Cannot be docked horizontally.

Example

This example shows how to use the Protection property to prevent users from docking a custom toolbar. The example adds a custom toolbar to the Toolbars collection and then adds a button to the toolbar. The toolbar appears in the Microsoft Visio user interface and is available while the document is active.

To restore Visio's built-in toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Sub Protection_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'Check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'Use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'Use the application custom toolbars.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'Use the document custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add
 With vsoToolbar

 'Set the title of the toolbar.
 .Caption = "My New Toolbar"

 'Float the toolbar at coordinates (300,200).
 .Position = Visio.visBarFloating
 .Left = 300
 .Top = 200

 'Disallow docking the new toolbar.
 .Protection = Visio.visBarNoHorizontalDock _
 + Visio.visBarNoVerticalDock

 End With

 'Add an item to the toolbar.
 Set vsoToolbarItem = vsoToolbar.ToolbarItems.Add
 With vsoToolbarItem

 'Set the new item to be a button.
 .CntrlType = Visio.visCtrlTypeBUTTON

 'Set the icon of the new button.
 .FaceID = Visio.visIconIXCUSTOM_CARDS

 'Set the CmdNum property of the new button
 .CmdNum = 1

 'Set the Width property of the new button
 'wide enough that the toolbar name is readable.
 .Width = 100

 End With

 'Tell Visio to use the new UIObject object while
 'this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


Toolbar.RowIndex Property (Visio)

 Copy code hover
[image]

Toolbar.RowIndex Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the docking order of a Toolbar object in relation to other items in the same docking area. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .RowIndex

expression A variable that represents a Toolbar object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Objects that have lower numbers are docked first. Several items can share the same row index. If two or more items share the same row index, the item most recently assigned is displayed first in its group.

Constants that represent the first and last positions (see the following table) are declared by the Visio type library in member VisUIBarRow.

Constant | Value
visBarRowFirst | 0
visBarRowLast | -1


Toolbar.ToolbarItems Property (Visio)

 Copy code hover
[image]

Toolbar.ToolbarItems Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ToolbarItems collection of a Toolbar object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ToolbarItems

expression A variable that represents a Toolbar object.

Return Value

ToolbarItems

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ToolbarItems property to get a particular object in a collection. It also shows how to get a copy of the built-in Visio toolbars, add a toolbar button, set the button icon, and replace the built-in toolbar set with the custom set.

Before running this code, replace path\filename with the full path to and name of a valid icon (.ico) file on your computer.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub ToolbarItems_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = visCmdPanZoom

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


Toolbar.Top Property (Visio)

 Copy code hover
[image]

Toolbar.Top Property (Visio)
Send feedback

Published: July 16, 2012

Gets the distance between the top of an object and the top of the docking area or the top of the screen if the object isn't docked; it sets the distance between the top of a Toolbar object and the top of the screen. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Top

expression A variable that represents a Toolbar object.

Return Value

Integer

Example

This example shows how to use the Top property to set the position of a UIObject object. The example adds a custom toolbar to the cloned toolbars collection. This toolbar appears in the Microsoft Visio user interface and is available while the document is active.

To restore Visio's built-in toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub Top_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'If not, check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'If not, use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'If there are application custom toolbars, clone them.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'If there are custom toolbars in the document, use them.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add
 With vsoToolbar

 'Set the title of the toolbar.
 .Caption = "My New Toolbar"

 'Float the toolbar at coordinates (300,200).
 .Position = Visio.visBarFloating
 .Left = 300
 .Top = 200

 End With

 'Use the custom toolbars in this document.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


Toolbar.Visible Property (Visio)

 Copy code hover
[image]

Toolbar.Visible Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is visible. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Visible

expression A variable that represents a Toolbar object.

Return Value

Boolean

Example

This example shows how to use the Visible property to determine if a UIObject object is visible in the user interface. The example adds a custom toolbar to the cloned toolbars collection. This toolbar appears in the Microsoft Visio user interface and is available while the document is active.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub Visible_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'If not, check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'If not, use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'If there are application custom toolbars, clone them.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'If there are custom toolbars in the document, use them.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add
 With vsoToolbar

 'Set the title of the toolbar.
 .Caption = "My New Toolbar"

 'Float the toolbar at coordinates (300,200).
 .Position = Visio.visBarFloating
 .Left = 300
 .Top = 200

 'Make the toolbar visible.
 .Visible = True

 End With

 'Use the custom toolbars in this document.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


Toolbar.Width Property (Visio)

 Copy code hover
[image]

Toolbar.Width Property (Visio)
Send feedback

Published: July 16, 2012

Gets the width of an object in pixels. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Width

expression A variable that represents a Toolbar object.

Return Value

Integer


Toolbar Methods (Visio)

 Copy code hover
[image]

Toolbar Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.


Toolbar.Delete Method (Visio)

 Copy code hover
[image]

Toolbar.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a Toolbar object.

Return Value

Nothing


ToolbarItem Object (Visio)

 Copy code hover
[image]

ToolbarItem Object (Visio)
Send feedback

Published: July 16, 2012

Represents one item in a Toolbar object. A ToolbarItem object can represent a button, combo box, or any other item on the Microsoft Visio toolbars.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The index of the ToolbarItem object within the ToolbarItems collection corresponds to its position on the toolbar, starting with zero (0) for the item farthest to the left if the toolbars are arranged horizontally.

Beginning with Microsoft Visio 2002, use the BeginGroup property to create spaces on a toolbar.


ToolbarItem Members (Visio)

 Copy code hover
[image]

ToolbarItem Members (Visio)
Send feedback

Published: July 16, 2012

Represents one item in a Toolbar object. A ToolbarItem object can represent a button, combo box, or any other item on the Microsoft Visio toolbars.

Methods

Name | Description
Delete | Deletes an object.
IconFileName | Sets a custom icon file for a menu or toolbar item.

Properties

Name | Description
ActionText | Gets or sets the action text for a toolbar item. Read/write.
AddOnArgs | Gets or sets the argument string that you send to the add-on associated with a particular toolbar. Read/write.
AddOnName | Gets or sets the name of an add-on or procedure that is run when its associated toolbar button is clicked. Read/write.
BeginGroup | Determines whether a toolbar item appears at the beginning of a group of items on the toolbar. Read/write.
BuiltIn | Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.
Caption | Gets or sets the caption for an object. Read/write.
CmdNum | Gets or sets the command ID associated with a toolbar item. Read/write.
CntrlType | Gets or sets the control type of a menu, menu item, or toolbar item. Read/write.
Enabled | Determines whether or not an object is currently enabled. Read/write.
FaceID | Gets or sets the icon for an item. Read/write.
Index | Gets the ordinal position of a ToolbarItem object in the ToolbarItems collection. Read-only.
IsHierarchical | Indicates whether a toolbar item is hierarchical; that is, whether it contains a drop-down menu that contains more items, which can in turn be accessed by iterating through the ToolbarItems collection of the toolbar. Read-only.
PaletteWidth | Gets or sets the width of a palette in pixels. Read/write.
Parent | Determines the parent of an object. Read-only.
State | Determines a button's state, pressed or not pressed. Read/write.
Style | Determines whether a toolbar button shows an icon, a caption, or some combination. Read/write.
ToolbarItems | Returns the ToolbarItems collection of a ToolbarItem object. Read-only.
TypeSpecific1 | Gets or sets the type of a toolbar item. Read/write.
TypeSpecific2 | Gets or sets the type of a toolbar item. Read/write.
Visible | Determines whether an object is visible. Read/write.
Width | Gets the width of an object in pixels. Read/write.


ToolbarItem Properties (Visio)

 Copy code hover
[image]

ToolbarItem Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActionText | Gets or sets the action text for a toolbar item. Read/write.
AddOnArgs | Gets or sets the argument string that you send to the add-on associated with a particular toolbar. Read/write.
AddOnName | Gets or sets the name of an add-on or procedure that is run when its associated toolbar button is clicked. Read/write.
BeginGroup | Determines whether a toolbar item appears at the beginning of a group of items on the toolbar. Read/write.
BuiltIn | Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.
Caption | Gets or sets the caption for an object. Read/write.
CmdNum | Gets or sets the command ID associated with a toolbar item. Read/write.
CntrlType | Gets or sets the control type of a menu, menu item, or toolbar item. Read/write.
Enabled | Determines whether or not an object is currently enabled. Read/write.
FaceID | Gets or sets the icon for an item. Read/write.
Index | Gets the ordinal position of a ToolbarItem object in the ToolbarItems collection. Read-only.
IsHierarchical | Indicates whether a toolbar item is hierarchical; that is, whether it contains a drop-down menu that contains more items, which can in turn be accessed by iterating through the ToolbarItems collection of the toolbar. Read-only.
PaletteWidth | Gets or sets the width of a palette in pixels. Read/write.
Parent | Determines the parent of an object. Read-only.
State | Determines a button's state, pressed or not pressed. Read/write.
Style | Determines whether a toolbar button shows an icon, a caption, or some combination. Read/write.
ToolbarItems | Returns the ToolbarItems collection of a ToolbarItem object. Read-only.
TypeSpecific1 | Gets or sets the type of a toolbar item. Read/write.
TypeSpecific2 | Gets or sets the type of a toolbar item. Read/write.
Visible | Determines whether an object is visible. Read/write.
Width | Gets the width of an object in pixels. Read/write.


ToolbarItem.ActionText Property (Visio)

 Copy code hover
[image]

ToolbarItem.ActionText Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the action text for a toolbar item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .ActionText

expression A variable that represents a ToolbarItem object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Action text is a string that describes the action on the Undo, Redo, and Repeat menu items on the Edit menu.

If the ActionText property is empty and the object's CmdNum property is set to one of the Microsoft Visio built-in command IDs, the item uses the default action text from the built-in Visio user interface.


ToolbarItem.AddOnArgs Property (Visio)

 Copy code hover
[image]

ToolbarItem.AddOnArgs Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the argument string that you send to the add-on associated with a particular toolbar. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddOnArgs

expression A variable that represents a ToolbarItem object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

An argument's string can be anything appropriate for the add-on. However, the arguments are packaged together with other information into a command string, which cannot exceed 127 characters. For best results, limit arguments to 50 characters.

An object's AddOnName property indicates the name of the add-on to which the arguments are sent.

Beginning with Visio 2002, the AddOnName property used in the following example cannot execute a string that contains arbitrary Microsoft Visual Basic code. To call code that in previous versions of Visio you would have passed to the AddOnName property, move it to a procedure in a document's Visual Basic project that is called from the AddOnName property, as shown in the following example.


ToolbarItem.AddOnName Property (Visio)

 Copy code hover
[image]

ToolbarItem.AddOnName Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the name of an add-on or procedure that is run when its associated toolbar button is clicked. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddOnName

expression A variable that represents a ToolbarItem object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Assuming that the name of the add-on in the Addons collection is string, if the project of the currently active document (or another project if it is referenced) does not have a procedure named string, or if the arguments passed in string do not match those specified in the procedure, Microsoft Visio runs the add-on named string. If no add-on named string can be found, Visio does nothing and reports no error. (You can use the TraceFlags property to monitor the procedures and add-ons that Visio attempts to run.)

If string is an add-on, use the AddOnArgs property to specify arguments to send to the add-on when it is run.

If string is a procedure, specify arguments using procname(arguments) or procname arguments.

When calling a procedure in a standard module it is recommended that you prefix the string with the module name that contains the procedure (for example, moduleName.procName) because more than one module can have a procedure with the same name.

To call a procedure in a project other than the project of the active document, use the syntax projName.modName.procName (you must have explicitly set a reference to projName in your Visual Basic project).

If the AddOnName property is set, Visio ignores the object's CmdNum property.

Note Note

Beginning with Visio 2002, the AddOnName property cannot execute a string that contains arbitrary VBA code. To call code that in previous versions of Visio you would have passed to the AddOnName property, move the code to a procedure in a document's VBA project that is called from the AddOnName property.


ToolbarItem.BeginGroup Property (Visio)

 Copy code hover
[image]

ToolbarItem.BeginGroup Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a toolbar item appears at the beginning of a group of items on the toolbar. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .BeginGroup

expression A variable that represents a ToolbarItem object.

Return Value

Boolean

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If you set the BeginGroup property of a ToolbarItem object to True, a spacer is inserted into the toolbar preceding this item.

Note Note

In Microsoft Visio 2000, the only way to create a separator in a menu or a spacer in a toolbar was to add a dummy item with a CmdNum property of zero, a Caption property that contained "", and an empty MenuItems or ToolbarItems collection. This technique continues to work in later versions.


ToolbarItem.BuiltIn Property (Visio)

 Copy code hover
[image]

ToolbarItem.BuiltIn Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is a default Microsoft Visio user interface object or a custom object. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .BuiltIn

expression A variable that represents a ToolbarItem object.

Return Value

Boolean


ToolbarItem.Caption Property (Visio)

 Copy code hover
[image]

ToolbarItem.Caption Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the caption for an object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Caption

expression A variable that represents a ToolbarItem object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.


ToolbarItem.CmdNum Property (Visio)

 Copy code hover
[image]

ToolbarItem.CmdNum Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the command ID associated with a toolbar item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CmdNum

expression A variable that represents a ToolbarItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

When the AddOnName property of a ToolbarItem object indicates an add-on to run, Microsoft Visio automatically assigns a CmdNum property.

To insert a separator in a spacer in a toolbar preceding a ToolbarItem object, use the BeginGroup property.

Valid command IDs are declared by the Visio type library in VisUICmds. They have the prefix visCmd.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how use the CmdNum property to get a particular built-in Visio toolbar button, and then it shows how to change the button's icon. The new icon persists as long as the document is active.

This macro assumes you are not using a custom user interface (UI).

Before running this macro, replace fullpath\filename in the following code with the full path to and file name of an icon file (.ico) on your computer.

To restore the built-in toolbars in Visio after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub CmdNum_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem
 Dim intCounter As Integer
 Dim blsFound As Boolean

 'Get the UIObject object for the copy of the Microsoft Office toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the vsoToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Get the toolbar item for the Save toolbar button.
 blsFound = False
 For intCounter = 0 To vsoToolbarItems.Count - 1

 Set vsoToolbarItem = vsoToolbarItems(intCounter)
 If vsoToolbarItem.CmdNum = visCmdFileSave Then
 blsFound = True
 Exit For

 End If

 Next intCounter

 If blsFound Then

 'Set the icon.
 vsoToolbarItem.IconFileName "fullpath\filename"
 'Indicate to Visio to use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

 End If

End Sub


ToolbarItem.CntrlType Property (Visio)

 Copy code hover
[image]

ToolbarItem.CntrlType Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the control type of a menu, menu item, or toolbar item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .CntrlType

expression A variable that represents a ToolbarItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If you are adding a custom toolbar button, set the CntrlType property to visCtrlTypeBUTTON. The following table describes the control types declared by the Visio type library in VisUICtrlTypes.

Constant | Value | Description
visCtrlTypeSPLITBUTTON_MRU_COMMAND | 18 | Split button, with MRU command behavior.
visCtrlTypeBUTTON_OWNERDRAW | 33 | Owner-draw push button.
visCtrlTypeDROPDOWN | 272 | Drop-down combo box.
visCtrlTypeEDITBOX | 64 | Text box.
visCtrlTypeCOMBOBOX | 128 | Combo box.
visCtrlTypeBUTTON | 2 | Push button.
visCtrlTypeSPLITBUTTON_MRU_COLOR | 16 | Split button, with MRU color behavior.
visCtrlTypeLABEL | 2048 | Label.
visCtrlTypeSPLITBUTTON | 17 | Split button.

Example

The following two examples demonstrate different ways to use the CntrlType property in your programs.

This first example shows how to use the CntrlType property to set the type of a new toolbar item. The example adds a custom toolbar to the Toolbars collection, and then adds a button to the toolbar. The toolbar appears in the Visio user interface and is available while the document is active.

VBA Copy code Copy code

Sub CntrlType_Example1()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'Check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'Use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'Use the application custom toolbars.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'Use the document custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add

 'Add an item to the toolbar.
 Set vsoToolbarItem = vsoToolbar.ToolbarItems.Add

 With vsoToolbarItem

 'Set the new item to be a button.
 .CntrlType = Visio.visCtrlTypeBUTTON

 'Set the icon of the new button.
 .FaceID = Visio.visIconIXCUSTOM_CARDS

 'Set the CmdNum property of the new button
 .CmdNum = 1

 'Set the Width property of the new button
 'wide enough that the toolbar name is readable.
 .Width = 100

 End With

 'Tell Microsoft Office Visio to use the new UI object while
 'this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub

This second example shows another way to use the CntrlType property to add a toolbar button and set the button icon.

Before running this macro, replace fullpath\filename in the code below with the full path to and file name of an icon file (.ico) on your computer. To restore the built-in toolbars in Visio after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub CntrlType_Example2()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the Microsoft Office toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection of the first toolbar in the collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new toolbar item in the first position on the toolbar.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Make the new toolbar item a button.
 'This requires setting both the CmdNum and CntrlType properties
 vsoToolbarItem.CmdNum = 1
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "fullpath\filename"

 'Tell Visio to actually use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarItem.Enabled Property (Visio)

 Copy code hover
[image]

ToolbarItem.Enabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether or not an object is currently enabled. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Enabled

expression A variable that represents a ToolbarItem object.

Return Value

Boolean

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Example

This example shows how to use the Enabled property to enable hiding or showing a toolbar. The example adds a custom toolbar to the Toolbars collection. This toolbar appears in the Visio user interface and is available while the document is active.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Sub Enabled_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'Check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'Use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'Use the application custom toolbars.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'Use the document custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add

 'Set the title of the toolbar.
 vsoToolbar.Caption = "Example"

 'Enable hiding or showing the toolbar.
 vsoToolbar.Enabled = True

 'Show the toolbar.
 vsoToolbar.Visible = True

 'Add an item to the toolbar.
 Set vsoToolbarItem = vsoToolbar.ToolbarItems.Add
 With vsoToolbarItem

 'Set the new item to be a button.
 .CntrlType = Visio.visCtrlTypeBUTTON

 'Set the icon of the new button.
 .FaceID = Visio.visIconIXCUSTOM_CARDS

 'Set the CmdNum property of the new button.
 .CmdNum = 1

 'Set the Width property of the new button
 'wide enough that the toolbar name is readable.
 .Width = 100

 End With

 'Tell Visio to use the new UIOjbect object while
 'this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarItem.FaceID Property (Visio)

 Copy code hover
[image]

ToolbarItem.FaceID Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the icon for an item. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .FaceID

expression A variable that represents a ToolbarItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You can use any of the constants prefixed with visIconIX that are declared by the Visio type library in VisUIIconIDs.

The FaceID property determines a button's icon, but not its function. Use the CmdNum property of a ToolbarItem object to set a button's function.

The FaceID property is the same as the TypeSpecific1 property when the CtrlType property is type visCtrlTypeBUTTON, which is declared in the Visio type library in VisUICtrlTypes.

Example

This example adds a custom toolbar to the Toolbars collection and then adds a button to the toolbar. The example shows how to use the FaceID property to assign the icon for the button. This toolbar appears in the Microsoft Visio user interface and is available while the document is active.

To restore the built-in toolbars in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Sub FaceID_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'Check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'Use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'Use the application custom toolbars.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'Use the document custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set VsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add

 'Set the title of the toolbar.
 vsoToolbar.Caption = "Example"

 'Add an item to the toolbar.
 Set vsoToolbarItem = vsoToolbar.ToolbarItems.Add
 With vsoToolbarItem

 'Set the new item to be a button.
 .CntrlType = Visio.visCtrlTypeBUTTON

 'Set the icon of the new button.
 .FaceID = Visio.visIconIXCUSTOM_CARDS

 'Set the CmdNum property of the new button.
 .CmdNum = 1

 'Set the Width property of the new button
 'wide enough that the toolbar name is readable.
 .Width = 100

 End With

 'Tell Visio to use the new UIObject object while
 'this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarItem.Index Property (Visio)

 Copy code hover
[image]

ToolbarItem.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a ToolbarItem object in the ToolbarItems collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a ToolbarItem object.

Return Value

Long

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

These collections are indexed starting with 0: AccelItems, AccelTables, MenuSets, MenuItems, Menus, ToolbarItems, Toolbars, and ToolbarSets.


ToolbarItem.IsHierarchical Property (Visio)

 Copy code hover
[image]

ToolbarItem.IsHierarchical Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether a toolbar item is hierarchical; that is, whether it contains a drop-down menu that contains more items, which can in turn be accessed by iterating through the ToolbarItems collection of the toolbar. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .IsHierarchical

expression A variable that represents a ToolbarItem object.

Return Value

Integer


ToolbarItem.PaletteWidth Property (Visio)

 Copy code hover
[image]

ToolbarItem.PaletteWidth Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the width of a palette in pixels. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .PaletteWidth

expression A variable that represents a ToolbarItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

A palette, like a toolbar, is organized horizontally, and items wrap to a new row if there is not enough horizontal space available. By default, only the icons of the items are shown.

Example

This example shows how to use the PaletteWidth property to set the width of a palette on a custom toolbar. The example adds a custom toolbar to the Toolbars collection and then adds a button to the toolbar. The toolbar appears in the Microsoft Visio user interface and is available while the document is active.

To restore the built-in toolbars in Visio after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Sub PaletteWidth_Example1()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'Check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'Use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'Use the application custom toolbars.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'Use the document custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add
 With vsoToolbar

 'Set the title of the toolbar.
 .Caption = "My New Toolbar"

 'Float the toolbar at coordinates (300,200).
 .Position = Visio.visBarFloating
 .Left = 300
 .Top = 200

 'Disallow docking the new toolbar.
 .Protection = Visio.visBarNoHorizontalDock _
 + Visio.visBarNoVerticalDock

 End With

 'Add an item to the toolbar.
 Set vsoToolbarItem = vsoToolbar.ToolbarItems.Add
 With vsoToolbarItem

 'Set the new item to be a button.
 'Because the CmdNum property isn't specified,
 'the button type defaults to palette.
 .CntrlType = Visio.visCtrlTypeBUTTON

 'Set the icon of the new button.
 .FaceID = Visio.visIconIXCUSTOM_CARDS

 'Make the button wide enough that
 'we can read the toolbar name.
 .Width = 150

 'Set the PaletteWidth property of the new button.
 .PaletteWidth = 50

 End With

 'Add some buttons to the palette.
 Set vsoToolbarItems = vsoToolbarItem.ToolbarItems
 With vsoToolbarItems.Add
 .FaceID = Visio.visIconIXCUSTOM_SPADE
 .CmdNum = Visio.visCmdFileSave
 End With
 With vsoToolbarItems.Add
 .FaceID = Visio.visIconIXCUSTOM_DIAMOND
 .CmdNum = Visio.visCmdFilePrint
 End With
 With vsoToolbarItems.Add
 .FaceID = Visio.visIconIXCUSTOM_CLUB
 .CmdNum = Visio.visCmdToolsRunVBE
 End With
 With vsoToolbarItems.Add
 .FaceID = Visio.visIconIXCUSTOM_HEART
 .CmdNum = Visio.visCmdToolsMacroDlg
 End With

 'Use the new UIObject object while
 'this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarItem.Parent Property (Visio)

 Copy code hover
[image]

ToolbarItem.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a ToolbarItem object.

Return Value

ToolbarItems

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it.


ToolbarItem.State Property (Visio)

 Copy code hover
[image]

ToolbarItem.State Property (Visio)
Send feedback

Published: July 16, 2012

Determines a button's state, pressed or not pressed. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .State

expression A variable that represents a ToolbarItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The State property can be one of the following constants declared by the Visio type library in VisUIButtonState.

Constant | Value | Description
visButtonUp | 0 | Button is not pressed
visButtonDown | -1 | Button is pressed

Example

This example shows how to use the State property to set the state of a toolbar button (make it appear pressed). The example adds a custom toolbar button to the Standard toolbar. Pressing the button saves the active document. This button appears in the Microsoft Visio user interface and is available while the document is active.

Before running this code, replace path\filename with the full path to and name of a valid icon (.ico) file on your computer.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Sub State_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'If not, check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'If there are no custom toolbars, use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'If there are application custom toolbars, copy them.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'If there already are document custom toolbars, use them.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the set of toolbar items for the Standard toolbar.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = visCmdFileSave
 vsoToolbarItem.Style = visButtonIconandCaption
 vsoToolbarItem.State = visButtonDown
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new UIObject object while this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarItem.Style Property (Visio)

 Copy code hover
[image]

ToolbarItem.Style Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a toolbar button shows an icon, a caption, or some combination. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Style

expression A variable that represents a ToolbarItem object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Possible values for the Style property are listed in the following table. These constants are declared by the Visio type library in VisUIButtonStyle.

Constant | Value
visButtonAutomatic | 0
visButtonCaption | 1
visButtonIcon | 2
visButtonIconandCaption | 3

Example

This example shows how to use the Style property to set the style of a toolbar button. The example adds a custom toolbar button and sets it to display both an icon and a caption. This button appears in the Visio user interface and is available while the document is active.

Before running this code, replace path\filename with the full path to and name of a valid icone (.ico) file on your computer.

To restore the built-in toolbars in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code
Sub Style_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'If not, check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'If not, use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'If there are application custom toolbars, copy them.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone
 End If

 Else

 'If there already are document custom toolbars, use them.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the set of toolbar items for the Standard toolbar.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = visCmdFileSave
 vsoToolbarItem.Style = visButtonIconandCaption
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new UIObject object while this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarItem.ToolbarItems Property (Visio)

 Copy code hover
[image]

ToolbarItem.ToolbarItems Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ToolbarItems collection of a ToolbarItem object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ToolbarItems

expression A variable that represents a ToolbarItem object.

Return Value

ToolbarItems

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ToolbarItems property to get a particular object in a collection. It also shows how to get a copy of the built-in Visio toolbars, add a toolbar button, set the button icon, and replace the built-in toolbar set with the custom set.

Before running this code, replace path\filename with the full path to and name of a valid icon (.ico) file on your computer.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub ToolbarItems_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = visCmdPanZoom

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarItem.TypeSpecific1 Property (Visio)

 Copy code hover
[image]

ToolbarItem.TypeSpecific1 Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the type of a toolbar item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TypeSpecific1

expression A variable that represents a ToolbarItem object.

Return Value

Integer

Remarks

The value of an object's TypeSpecific1 property depends on the value of its CntrlType property.

CntrlType value | TypeSpecific1 value
visCtrlTypeBUTTON | Any constant prefixed with visIconIX that is declared by the Visio type library.
visCtrlTypeCOMBOBOX | Zero (0).
visCtrlTypeEDITBOX | Zero (0).
visCtrlTypeLABEL | The TypeSpecific1 property is not used.


ToolbarItem.TypeSpecific2 Property (Visio)

 Copy code hover
[image]

ToolbarItem.TypeSpecific2 Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the type of a toolbar item. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .TypeSpecific2

expression A variable that represents a ToolbarItem object.

Return Value

Integer

Remarks

The value of an object's TypeSpecific2 property depends on the value of its CntrlType property.

CntrlType value | TypeSpecific1 value
visCtrlTypeBUTTON | The TypeSpecific2 property is not used.
visCtrlTypeCOMBOBOX | The current width of the control expressed in pixels.
visCtrlTypeEDITBOX | The current width of the control expressed in pixels.
visCtrlTypeLABEL | The TypeSpecific2 property is not used.


ToolbarItem.Visible Property (Visio)

 Copy code hover
[image]

ToolbarItem.Visible Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether an object is visible. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Visible

expression A variable that represents a ToolbarItem object.

Return Value

Boolean

Example

This example shows how to use the Visible property to determine if a UIObject object is visible in the user interface. The example adds a custom toolbar to the cloned toolbars collection. This toolbar appears in the Microsoft Visio user interface and is available while the document is active.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub Visible_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'If not, check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'If not, use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'If there are application custom toolbars, clone them.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'If there are custom toolbars in the document, use them.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _
 Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add
 With vsoToolbar

 'Set the title of the toolbar.
 .Caption = "My New Toolbar"

 'Float the toolbar at coordinates (300,200).
 .Position = Visio.visBarFloating
 .Left = 300
 .Top = 200

 'Make the toolbar visible.
 .Visible = True

 End With

 'Use the custom toolbars in this document.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarItem.Width Property (Visio)

 Copy code hover
[image]

ToolbarItem.Width Property (Visio)
Send feedback

Published: July 16, 2012

Gets the width of an object in pixels. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Width

expression A variable that represents a ToolbarItem object.

Return Value

Integer


ToolbarItem Methods (Visio)

 Copy code hover
[image]

ToolbarItem Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.
IconFileName | Sets a custom icon file for a menu or toolbar item.


ToolbarItem.Delete Method (Visio)

 Copy code hover
[image]

ToolbarItem.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a ToolbarItem object.

Return Value

Nothing


ToolbarItem.IconFileName Method (Visio)

 Copy code hover
[image]

ToolbarItem.IconFileName Method (Visio)
Send feedback

Published: July 16, 2012

Sets a custom icon file for a menu or toolbar item.

Version Information

Version Added: Visio 4.0

Syntax

expression .IconFileName(IconFileName)

expression A variable that represents a ToolbarItem object.

Parameters

Name | Required/Optional | Data Type | Description
IconFileName | Required | String | The path and name of the ICO, EXE, DLL, or VSL file to load.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The IconFileName method loads the file that contains the icon, saves the bits, and discards the file name.

If the icon contains multiple images, Microsoft Visio chooses the best icon, based on both icon size and color depth.

Unless IconFileName is a fully qualified path, the application searches for the ICO, EXE, DLL, or VSL file in the folders indicated by the Application object's AddonPaths property (assuming that the UIObject object is in the Visio process).

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how use the IconFileName method to set the icon for a toolbar button. It retrieves a copy of the built-in Visio toolbars, adds a toolbar button, and sets the button icon.

Before running this code, replace path\filename with the full path to and name of a valid icon (.ico file) on your computer.

To restore the built-in Visio user interface after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code
Public Sub IconFileName_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = 1

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarItems Object (Visio)

 Copy code hover
[image]

ToolbarItems Object (Visio)
Send feedback

Published: July 16, 2012

Includes a ToolbarItem object for each item on a toolbar.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

To retrieve a ToolbarItems collection, use the ToolbarItems property of a Toolbar object.

The default property of a ToolbarItems collection is Item.

Unlike other Microsoft Visio collections, the ToolbarItems collection is indexed starting with zero (0) rather than 1.


ToolbarItems Members (Visio)

 Copy code hover
[image]

ToolbarItems Members (Visio)
Send feedback

Published: July 16, 2012

Includes a ToolbarItem object for each item on a toolbar.

Methods

Name | Description
Add | Adds a new object to a collection.
AddAt | Creates a new ToolbarItem object at a specified index in the ToolbarItems collection. .

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only.
Parent | Determines the parent of an object. Read-only.
ParentItem | Returns the parent object of a hierarchical toolbar. Read-only.


ToolbarItems Properties (Visio)

 Copy code hover
[image]

ToolbarItems Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only.
Parent | Determines the parent of an object. Read-only.
ParentItem | Returns the parent object of a hierarchical toolbar. Read-only.


ToolbarItems.Count Property (Visio)

 Copy code hover
[image]

ToolbarItems.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a ToolbarItems object.

Return Value

Long


ToolbarItems.Item Property (Visio)

 Copy code hover
[image]

ToolbarItems.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(Index)

expression A variable that represents a ToolbarItems collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Contains the index of the object to retrieve.

Return Value

ToolbarItem

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


ToolbarItems.Parent Property (Visio)

 Copy code hover
[image]

ToolbarItems.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a ToolbarItems object.

Return Value

Toolbar

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it.


ToolbarItems.ParentItem Property (Visio)

 Copy code hover
[image]

ToolbarItems.ParentItem Property (Visio)
Send feedback

Published: July 16, 2012

Returns the parent object of a hierarchical toolbar. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .ParentItem

expression A variable that represents a ToolbarItems object.

Return Value

ToolbarItem


ToolbarItems Methods (Visio)

 Copy code hover
[image]

ToolbarItems Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.
AddAt | Creates a new ToolbarItem object at a specified index in the ToolbarItems collection. .


ToolbarItems.Add Method (Visio)

 Copy code hover
[image]

ToolbarItems.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents a ToolbarItems collection.

Return Value

ToolbarItem

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.


ToolbarItems.AddAt Method (Visio)

 Copy code hover
[image]

ToolbarItems.AddAt Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new ToolbarItem object at a specified index in the ToolbarItems collection. .

Version Information

Version Added: Visio 4.0

Syntax

expression .AddAt(lIndex)

expression A variable that represents a ToolbarItems object.

Parameters

Name | Required/Optional | Data Type | Description
lIndex | Required | Long | The index at which to add the object.

Return Value

ToolbarItem

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the index is zero (0), the object is added at the beginning of the collection.

The beginning of a ToolbarItems collection is the leftmost item in a toolbar that is arranged horizontally.


Toolbars Object (Visio)

 Copy code hover
[image]

Toolbars Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Toolbar object for each toolbar in a window context.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

To retrieve a Toolbars collection, use the Toolbars property of a ToolbarSet object.

The default property of a Toolbars collection is Item.

Unlike other Microsoft Visio collections, the Toolbars collection is indexed starting with zero (0) rather than 1.


Toolbars Members (Visio)

 Copy code hover
[image]

Toolbars Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Toolbar object for each toolbar in a window context.

Methods

Name | Description
Add | Adds a new object to a collection.
AddAt | Creates a new Toolbar object at a specified index in the Toolbars collection. .

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only.
Parent | Determines the parent of an object. Read-only.


Toolbars Properties (Visio)

 Copy code hover
[image]

Toolbars Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only.
Parent | Determines the parent of an object. Read-only.


Toolbars.Count Property (Visio)

 Copy code hover
[image]

Toolbars.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Toolbars object.

Return Value

Long


Toolbars.Item Property (Visio)

 Copy code hover
[image]

Toolbars.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(lIndex)

expression A variable that represents a Toolbars collection.

Parameters

Name | Required/Optional | Data Type | Description
lIndex | Required | Long | Contains the index of the object to retrieve.

Return Value

Toolbar

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


Toolbars.Parent Property (Visio)

 Copy code hover
[image]

Toolbars.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a Toolbars object.

Return Value

ToolbarSet

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it.


Toolbars Methods (Visio)

 Copy code hover
[image]

Toolbars Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.
AddAt | Creates a new Toolbar object at a specified index in the Toolbars collection. .


Toolbars.Add Method (Visio)

 Copy code hover
[image]

Toolbars.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents a Toolbars collection.

Return Value

Toolbar

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.


Toolbars.AddAt Method (Visio)

 Copy code hover
[image]

Toolbars.AddAt Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new Toolbar object at a specified index in the Toolbars collection. .

Version Information

Version Added: Visio 4.0

Syntax

expression .AddAt(lIndex)

expression A variable that represents a Toolbars object.

Parameters

Name | Required/Optional | Data Type | Description
lIndex | Required | Long | The index at which to add the object.

Return Value

Toolbar

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If the index is zero (0), the object is added at the beginning of the collection.


ToolbarSet Object (Visio)

 Copy code hover
[image]

ToolbarSet Object (Visio)
Send feedback

Published: July 16, 2012

Represents the set of toolbars for a Microsoft Visio window context.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Version Information

Version Added: Visio 4.0


ToolbarSet Members (Visio)

 Copy code hover
[image]

ToolbarSet Members (Visio)
Send feedback

Published: July 16, 2012

Represents the set of toolbars for a Microsoft Visio window context.

Methods

Name | Description
Delete | Deletes an object.

Properties

Name | Description
Caption | Gets or sets the caption for an object. Read/write.
Parent | Determines the parent of an object. Read-only.
SetID | Returns the set ID of an ToolbarSet object in its collection. Read-only.
Toolbars | Returns the Toolbars collection of a ToolbarSet object. Read-only.


ToolbarSet Properties (Visio)

 Copy code hover
[image]

ToolbarSet Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Caption | Gets or sets the caption for an object. Read/write.
Parent | Determines the parent of an object. Read-only.
SetID | Returns the set ID of an ToolbarSet object in its collection. Read-only.
Toolbars | Returns the Toolbars collection of a ToolbarSet object. Read-only.


ToolbarSet.Caption Property (Visio)

 Copy code hover
[image]

ToolbarSet.Caption Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the caption for an object. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Caption

expression A variable that represents a ToolbarSet object.

Return Value

String

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Visio does not use the Caption property of a ToolbarSet object.


ToolbarSet.Parent Property (Visio)

 Copy code hover
[image]

ToolbarSet.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a ToolbarSet object.

Return Value

ToolbarSets

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it.


ToolbarSet.SetID Property (Visio)

 Copy code hover
[image]

ToolbarSet.SetID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the set ID of an ToolbarSet object in its collection. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .SetID

expression A variable that represents a ToolbarSet object.

Return Value

Long

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Each ToolbarSet object has a set ID that corresponds to a Microsoft Visio window context. For ToolbarSet objects, they also correspond to drop-down menus under toolbar buttons (such as Fill Color or Line Weight).

You can retrieve an object from its collection by passing the object's set ID to the ItemAtID property. You can also set the set ID of an object by using the AddAtID method.

Valid set ID values are declared by the Visio type library in VisUIObjSets.


ToolbarSet.Toolbars Property (Visio)

 Copy code hover
[image]

ToolbarSet.Toolbars Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Toolbars collection of a ToolbarSet object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .Toolbars

expression A variable that represents a ToolbarSet object.

Return Value

Toolbars

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Toolbars property to get a particular object in a collection. It also shows how to get a copy of the built-in Visio toolbars, add a toolbar button, set the button icon, and replace the built-in toolbar set with the custom set.

Before running this code, replace path\filename with the full path to and name of a valid icon (.ico) file on your computer.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub Toolbars_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = visCmdPanZoom

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarSet Methods (Visio)

 Copy code hover
[image]

ToolbarSet Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes an object.


ToolbarSet.Delete Method (Visio)

 Copy code hover
[image]

ToolbarSet.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Delete

expression A variable that represents a ToolbarSet object.

Return Value

Nothing


ToolbarSets Object (Visio)

 Copy code hover
[image]

ToolbarSets Object (Visio)
Send feedback

Published: July 16, 2012

Includes a ToolbarSet object for each window context that can display toolbars.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

To retrieve a ToolbarSets collection, use the ToolbarSets property of a UIObject object.

The default property of a ToolbarSets collection is Item.

Unlike other Microsoft Visio collections, the ToolbarSets collection is indexed starting with zero (0) rather than 1.

A ToolbarSet object is identified in the ToolbarSets collection by its SetID property, which corresponds to a Visio window context. For a list of SetID values for ToolbarSet objects, see the SetID property.


ToolbarSets Members (Visio)

 Copy code hover
[image]

ToolbarSets Members (Visio)
Send feedback

Published: July 16, 2012

Includes a ToolbarSet object for each window context that can display toolbars.

Methods

Name | Description
Add | Adds a new object to a collection.
AddAtID | Creates a new object with a specified ID in a collection.

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only.
ItemAtID | Returns the ToolbarSet object for an ID within a collection. Read-only.
Parent | Determines the parent of an object. Read-only.


ToolbarSets Methods (Visio)

 Copy code hover
[image]

ToolbarSets Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new object to a collection.
AddAtID | Creates a new object with a specified ID in a collection.


ToolbarSets.Add Method (Visio)

 Copy code hover
[image]

ToolbarSets.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new object to a collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Add

expression A variable that represents a ToolbarSets collection.

Return Value

ToolbarSet

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

All properties of the new object are initialized to zero, so you need to set only the properties that you want to change.


ToolbarSets.AddAtID Method (Visio)

 Copy code hover
[image]

ToolbarSets.AddAtID Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new object with a specified ID in a collection.

Version Information

Version Added: Visio 4.0

Syntax

expression .AddAtID(lID)

expression A variable that represents a ToolbarSets object.

Parameters

Name | Required/Optional | Data Type | Description
lID | Required | Long | The window context for the new object.

Return Value

ToolbarSet

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The ID corresponds to a window or context menu. If the collection already contains an object at the specified ID, the AddAtID method returns an error.

Valid IDs are declared by the Visio type library in member VisUIObjSets. Not all collections include an object for every possible ID.


ToolbarSets Properties (Visio)

 Copy code hover
[image]

ToolbarSets Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Count | Returns the number of objects in a collection. Read-only.
Item | Returns an object from a collection. The Item property is the default property for all collections. Read-only.
ItemAtID | Returns the ToolbarSet object for an ID within a collection. Read-only.
Parent | Determines the parent of an object. Read-only.


ToolbarSets.Count Property (Visio)

 Copy code hover
[image]

ToolbarSets.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a ToolbarSets object.

Return Value

Long

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


ToolbarSets.Item Property (Visio)

 Copy code hover
[image]

ToolbarSets.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(lIndex)

expression A variable that represents a ToolbarSets collection.

Parameters

Name | Required/Optional | Data Type | Description
lIndex | Required | Long | Contains the index of the object to retrieve.

Return Value

ToolbarSet

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


ToolbarSets.ItemAtID Property (Visio)

 Copy code hover
[image]

ToolbarSets.ItemAtID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ToolbarSet object for an ID within a collection. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemAtID(lID)

expression A variable that represents a ToolbarSets object.

Parameters

Name | Required/Optional | Data Type | Description
lID | Required | Long | The Visio context ID of the object to retrieve.

Return Value

ToolbarSet

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The ID corresponds to a window or context menu. Constants for IDs are prefixed with visUIObjectSet and are declared by the Visio type library in VisUIObjSets.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ItemAtID property to get a particular object in a collection. It also shows how to get a copy of the built-in Visio toolbars, add a toolbar button, set the button icon, and replace the built-in toolbar set with the custom set.

Before running this code, replace path\filename with the full path to and name of a valid icon (.ico) file on your computer.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code
Public Sub ItemAtID_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON

 'Set the toolbar button caption.
 vsoToolbarItem.Caption = "MyButton"

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "path\filename"

 'Tell Visio to actually use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


ToolbarSets.Parent Property (Visio)

 Copy code hover
[image]

ToolbarSets.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a ToolbarSets object.

Return Value

UIObject

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

In general, an object's parent is the object that contains it.


UIObject Object (Visio)

 Copy code hover
[image]

UIObject Object (Visio)
Send feedback

Published: July 16, 2012

Represents a set of Microsoft Visio menus, toolbars, and accelerators, from either the built-in Visio user interface or a customized version of it.

Version Information

Version Added: Visio 4.0

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

To retrieve a UIObject object that contains

  • Visio menus and accelerators, use the BuiltInMenus property of an Application object and then the MenuSets or AccelTables collections of the UIObject object returned from the BuiltInMenus property.

  • Visio toolbars, use the BuiltInToolbars property of an Application object and then the ToolbarSets collection of the UIObject object returned from the BuiltInToolbars property.

If an Application object or Document object has a customized user interface, use the CustomMenus or CustomToolbars properties to retrieve UIObject objects that represent these.

A UIObject object can be stored in a file and loaded into Visio. Use the SaveToFile method to save the object and the LoadFromFile method to load it, or set the CustomMenusFile or CustomToolbarsFile property of an Application object or Document object to the name of the stored user interface file.

Beginning with Visio 2002, a program can manipulate menus and toolbars in the Visio user interface by manipulating the CommandBars collection returned by the CommandBars property. The CommandBars collection has an interface identical to the CommandBars collection exposed by the suite of Microsoft System applications such as Microsoft Word and Microsoft Excel. Consequently, programs can manipulate the Visio menus and toolbars by using either the CommandBars collection or UIObject objects.


UIObject Members (Visio)

 Copy code hover
[image]

UIObject Members (Visio)
Send feedback

Published: July 16, 2012

Represents a set of Microsoft Visio menus, toolbars, and accelerators, from either the built-in Visio user interface or a customized version of it.

Methods

Name | Description
LoadFromFile | Loads a Microsoft Visio application UIObject object from a file.
SaveToFile | Saves the user interface represented by a UIObject object in a file.
UpdateUI | Causes Microsoft Visio to display changes to the user interface represented by a UIObject object.

Properties

Name | Description
AccelTables | Returns the AccelTables collection of a UIObject object. Read-only.
Clone | Returns a copy of the UIObject object. Read-only.
DisplayKeysInTooltips | Determines whether ScreenTip text includes keyboard shortcuts. Read/write.
DisplayTooltips | Determines whether feature descriptions are shown in ScreenTips. Read/write.
LargeButtons | Determines whether large toolbar buttons are shown. Read/write.
MenuAnimationStyle | Gets or sets the way in which a menu is displayed. Read/write.
MenuSets | Returns the MenuSets collection of a UIObject object. Read-only.
Name | Specifies the name of an object. Read-only.
ToolbarSets | Returns the ToolbarSets collection of a UIObject object. Read-only.


UIObject Properties (Visio)

 Copy code hover
[image]

UIObject Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AccelTables | Returns the AccelTables collection of a UIObject object. Read-only.
Clone | Returns a copy of the UIObject object. Read-only.
DisplayKeysInTooltips | Determines whether ScreenTip text includes keyboard shortcuts. Read/write.
DisplayTooltips | Determines whether feature descriptions are shown in ScreenTips. Read/write.
LargeButtons | Determines whether large toolbar buttons are shown. Read/write.
MenuAnimationStyle | Gets or sets the way in which a menu is displayed. Read/write.
MenuSets | Returns the MenuSets collection of a UIObject object. Read-only.
Name | Specifies the name of an object. Read-only.
ToolbarSets | Returns the ToolbarSets collection of a UIObject object. Read-only.


UIObject.AccelTables Property (Visio)

 Copy code hover
[image]

UIObject.AccelTables Property (Visio)
Send feedback

Published: July 16, 2012

Returns the AccelTables collection of a UIObject object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .AccelTables

expression A variable that represents a UIObject object.

Return Value

AccelTables

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If a UIObject object represents menu items and accelerators (for example, if you used the BuiltInMenus property of an Application object to retrieve the UIObject object), its AccelTables collection represents tables of accelerator keys for that UIObject object.

To retrieve accelerators for a particular window context, for example, the drawing window, use the ItemAtID property of an AccelTables collection. If a window context does not include accelerators, it has no AccelTables collection. Valid window context IDs are declared in VisUIObjSets in the Visio type library.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AccelTables property to delete an accelerator key from a built-in menu.

To restore the built-in menus in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code

Public Sub AccelTables_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoAccelTable As Visio.AccelTable
 Dim vsoAccelItems As Visio.AccelItems
 Dim vsoAccelItem As Visio.AccelItem
 Dim intCounter As Integer

 'Retrieve the UIObject object for the copy of the built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Set vsoAccelTable to the drawing menu set.
 Set vsoAccelTable = vsoUIObject.AccelTables.ItemAtID(visUIObjSetDrawing)

 'Retrieve the accelerator items collection.
 Set vsoAccelItems = vsoAccelTable.AccelItems

 'Retrieve the accelerator item for the Visual Basic Editor.
 'To do this, we must iterate through the collection
 'and locate the item we want to manipulate.
 'The item can be identified either by checking
 'the CmdNum property or by checking for the specific key.
 'Because checking for the key requires looking at the Alt,
 'Control, Shift, and Key properties, it is better to use the
 'CmdNum property. Because we retrieved the built-in menus,
 'we know that we can find the accelerator.
 For intCounter = 0 To vsoAccelItems.Count - 1
 Set vsoAccelItem = vsoAccelItems.Item(intCounter)
 If vsoAccelItem.CmdNum = Visio.visCmdToolsRunVBE Then
 Exit For

 End If
 Next intCounter

 'Delete the accelerator.
 vsoAccelItem.Delete

 'Tell Visio to use the new UI.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


UIObject.Clone Property (Visio)

 Copy code hover
[image]

UIObject.Clone Property (Visio)
Send feedback

Published: July 16, 2012

Returns a copy of the UIObject object. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .Clone

expression A variable that represents a UIObject object.

Return Value

UIObject

Example

This example shows how to use the Clone property to make a copy of a UIObject object. The example adds a custom toolbar to the cloned toolbars collection. This toolbar appears in the Microsoft Visio user interface and is available while the document is active.

To restore the built-in toolbars in Visio after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Sub Clone_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbars As Visio.Toolbars
 Dim vsoToolbar As Visio.Toolbar

 'Check whether there are document custom toolbars.
 If ThisDocument.CustomToolbars Is Nothing Then

 'Check whether there are application custom toolbars.
 If Visio.Application.CustomToolbars Is Nothing Then

 'Use the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 Else

 'Use the application custom toolbars.
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone

 End If

 Else

 'Use the document custom toolbars.
 Set vsoUIObject = ThisDocument.CustomToolbars

 End If

 'Get the Toolbars collection for the drawing window context.
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID(Visio.visUIObjSetDrawing).Toolbars

 'Add a toolbar to the collection.
 Set vsoToolbar = vsoToolbars.Add

 'Set the title of the toolbar.
 vsoToolbar.Caption = "My New Toolbar"

 'Tell Visio to use the new UIObject object while
 'this document is active.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


UIObject.DisplayKeysInTooltips Property (Visio)

 Copy code hover
[image]

UIObject.DisplayKeysInTooltips Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether ScreenTip text includes keyboard shortcuts. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .DisplayKeysInTooltips

expression A variable that represents a UIObject object.

Return Value

Boolean

Remarks

To show ScreenTips, you must set the DisplayTooltips property to True.

It does not matter which UIObject object you use when getting or setting this property. The property affects the entire application.

This property setting corresponds to the Show shortcut keys in ScreenTips setting on the General tab in the Visio Options dialog box (click the File tab, and then click Options), and is shared between Visio and all Microsoft Office applications.


UIObject.DisplayTooltips Property (Visio)

 Copy code hover
[image]

UIObject.DisplayTooltips Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether feature descriptions are shown in ScreenTips. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .DisplayTooltips

expression A variable that represents a UIObject object.

Return Value

Boolean

Remarks

It does not matter which UIObject object you use when getting or setting this property. The property affects the entire application.

This property setting corresponds to the ScreenTip style setting on the General tab in the Visio Options dialog box (click the File tab, and then click Options), and is shared between Visio and all Microsoft Office applications.


UIObject.LargeButtons Property (Visio)

 Copy code hover
[image]

UIObject.LargeButtons Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether large toolbar buttons are shown. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .LargeButtons

expression A variable that represents a UIObject object.

Return Value

Boolean

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You can use any UIObject object to get or set this property.


UIObject.MenuAnimationStyle Property (Visio)

 Copy code hover
[image]

UIObject.MenuAnimationStyle Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the way in which a menu is displayed. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .MenuAnimationStyle

expression A variable that represents a UIObject object.

Return Value

Integer

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You can use any UIObject object to get or set this property. The property affects the entire application and affects the appearance of buttons in the currently visible set of toolbars.

Constants representing animation styles are prefixed with visMenuAnimation and are declared by the Visio type library in member VisUIMenuAnimation.

Constant | Value
visMenuAnimationNone | 0
visMenuAnimationRandom | 1
visMenuAnimationUnfold | 2
visMenuAnimationSlide | 3


UIObject.MenuSets Property (Visio)

 Copy code hover
[image]

UIObject.MenuSets Property (Visio)
Send feedback

Published: July 16, 2012

Returns the MenuSets collection of a UIObject object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .MenuSets

expression A variable that represents a UIObject object.

Return Value

MenuSets

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If a UIObject object represents menus and accelerators (for example, if the object was retrieved using the BuiltInMenus property of an Application or Document object), its MenuSets collection represents all of the menus for that UIObject object.

Use the ItemAtID property of a MenuSets object to retrieve menus for a particular window context such as the drawing window. If a context does not include menus, it has no MenuSets collection.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the MenuSets property to get the MenuSets collection of a UIObject object. It adds a menu and menu item to the drawing window menu set and sets the menu and menu item's Caption properties.

To restore the built-in menus in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

VBA Copy code Copy code
Public Sub MenuSets_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoMenuSets As Visio.MenuSets
 Dim vsoMenuSet As Visio.MenuSet
 Dim vsoMenus As Visio.Menus
 Dim vsoMenu As Visio.Menu
 Dim vsoMenuItems As Visio.MenuItems
 Dim vsoMenuItem As Visio.MenuItem

 'Get a UIObject object that represents Microsoft Visio built-in menus.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Get the MenuSets collection.
 Set vsoMenuSets = vsoUIObject.MenuSets

 'Get the drawing window menu set.
 Set vsoMenuSet = vsoMenuSets.ItemAtId(visUIObjSetDrawing)

 'Get the Menus collection.
 Set vsoMenus = vsoMenuSet.Menus

 'Add a new menu before the Window menu.
 Set vsoMenu = vsoMenus.AddAt(7)
 vsoMenu.Caption = "MyNewMenu"

 'Get the MenuItems collection.
 Set vsoMenuItems = vsoMenu.MenuItems

 'Add a menu item to the new menu.
 Set vsoMenuItem = vsoMenuItems.Add

 'Set the Caption property for the new menu item.
 vsoMenuItem.Caption = "&MyNewMenuItem"

 'Tell Visio to use the new UI when the document is active.
 ThisDocument.SetCustomMenus vsoUIObject

End Sub


UIObject.Name Property (Visio)

 Copy code hover
[image]

UIObject.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Name

expression A variable that represents a UIObject object.

Return Value

String


UIObject.ToolbarSets Property (Visio)

 Copy code hover
[image]

UIObject.ToolbarSets Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ToolbarSets collection of a UIObject object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ToolbarSets

expression A variable that represents a UIObject object.

Return Value

ToolbarSets

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

If a UIObject object represents toolbars (for example, if the object was retrieved by using the BuiltInToolbars property of an Application object), its ToolbarSets collection represents all of the toolbars for that UIObject object.

Use the ItemAtID property of a ToolbarSets object to retrieve toolbars for a particular window context, for example, the drawing window. If a context does not include toolbars, it has no ToolbarSets collection.

Example

This Microsoft Visual Basic macro shows how to use the ToolbarSets property to get a particular object in a collection. It also shows how to get a copy of the built-in Visio toolbars, add a toolbar button, set the button icon, and replace the built-in toolbar set with the custom set.

Before running this code, replace path\filename with the full path to and name of a valid icon (.ico) file on your computer.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

VBA Copy code Copy code

Public Sub ToolbarSets_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim vsoToolbarSet As Visio.ToolbarSet
 Dim vsoToolbarItems As Visio.ToolbarItems
 Dim vsoToolbarItem As Visio.ToolbarItem

 'Get the UIObject object for the copy of the built-in toolbars.
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0)

 'Get the drawing window toolbar sets.
 'NOTE: Use ItemAtID to get the toolbar set.
 'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
 Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)

 'Get the ToolbarItems collection.
 Set vsoToolbarItems = vsoToolbarSet.Toolbars(0).ToolbarItems

 'Add a new button in the first position.
 Set vsoToolbarItem = vsoToolbarItems.AddAt(0)

 'Set properties for the new toolbar button.
 vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
 vsoToolbarItem.CmdNum = visCmdPanZoom

 'Set the toolbar button icon.
 vsoToolbarItem.IconFileName "path\filename"

 'Use the new custom UI.
 ThisDocument.SetCustomToolbars vsoUIObject

End Sub


UIObject Methods (Visio)

 Copy code hover
[image]

UIObject Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
LoadFromFile | Loads a Microsoft Visio application UIObject object from a file.
SaveToFile | Saves the user interface represented by a UIObject object in a file.
UpdateUI | Causes Microsoft Visio to display changes to the user interface represented by a UIObject object.


UIObject.LoadFromFile Method (Visio)

 Copy code hover
[image]

UIObject.LoadFromFile Method (Visio)
Send feedback

Published: July 16, 2012

Loads a Microsoft Visio application UIObject object from a file.

Version Information

Version Added: Visio 4.0

Syntax

expression .LoadFromFile(FileName)

expression A variable that represents a UIObject object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file to load.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

You must use the SaveToFile method to save a UIObject object in a file that the LoadFromFile method can load.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to save and then load a custom user interface file (.vsu). It does not manipulate any menus or menu items.

Before running this code, replace path\filename with the full path to and name of a valid .vsu file on your computer.

VBA Copy code Copy code

Public Sub LoadFromFile_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim strPath As String

 'Get Menus object from Visio.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Save Menus object to a file.
 strPath = "path\filename.vsu"
 vsoUIObject.SaveToFile (strPath)
 MsgBox ("Menus successfully saved to " & strPath)

 'Load menus from the file.
 vsoUIObject.LoadFromFile (strPath)
 Visio.Application.SetCustomMenus vsoUIObject
 MsgBox ("Menus successfully loaded from " & strPath)

End Sub


UIObject.SaveToFile Method (Visio)

 Copy code hover
[image]

UIObject.SaveToFile Method (Visio)
Send feedback

Published: July 16, 2012

Saves the user interface represented by a UIObject object in a file.

Version Information

Version Added: Visio 4.0

Syntax

expression .SaveToFile(FileName)

expression A variable that represents a UIObject object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file in which to save the UIObject object.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The file can be loaded into the application by using the LoadFromFile method of a UIObject object.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to save a custom user interface file (.vsu). It does not manipulate any Visio menus or menu items. Before running this macro, change path to the location where you want to save the file, and change filename to the name you'd like to assign the file.

VBA Copy code Copy code

Public Sub SaveMenusToFile_Example()

 Dim vsoUIObject As Visio.UIObject
 Dim strPath As String

 'Get the Menus object from Visio.
 Set vsoUIObject = Visio.Application.BuiltInMenus

 'Save the Menus object to a file.
 strPath = "path\filename.vsu"
 vsoUIObject.SaveToFile (strPath)
 MsgBox ("Menus successfully saved to " & strPath)

End Sub


UIObject.UpdateUI Method (Visio)

 Copy code hover
[image]

UIObject.UpdateUI Method (Visio)
Send feedback

Published: July 16, 2012

Causes Microsoft Visio to display changes to the user interface represented by a UIObject object.

Version Information

Version Added: Visio 4.0

Syntax

expression .UpdateUI

expression A variable that represents a UIObject object.

Return Value

Nothing

Remarks

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

The UpdateUI method updates the Visio user interface with changes made to a UIObject object during a session. Use the CustomMenus or CustomToolbars property of an Application object or Document object to obtain the UIObject object.


Validation Object (Visio)

 Copy code hover
[image]

Validation Object (Visio)
Send feedback

Published: July 16, 2012

Stores information about diagram validation for the document.

Version Information

Version Added: Visio 2010

Remarks

To get a Validation object, use the Validation property of the Document object.


Validation Members (Visio)

 Copy code hover
[image]

Validation Members (Visio)
Send feedback

Published: July 16, 2012

Stores information about diagram validation for the document.

Methods

Name | Description
Validate | Validates the specified validation rule set.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Document | Returns the Document object that is associated with an object. Read-only.
Issues | Returns the collection of all the validation issues in the document. Read-only.
LastValidatedDate | Returns the time and date the document was last validated. Read-only.
ObjectType | Returns visObjTypeValidation, the type of this object. Read-only.
RuleSets | Returns the collection of all the validation rule sets in the document. Read-only.
ShowIgnoredIssues | Determines whether ignored validation issues appear in the Issues window. Read/write.
Stat | Returns status information for an object. Read-only.


Validation Properties (Visio)

 Copy code hover
[image]

Validation Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:


Validation.Application Property (Visio)

 Copy code hover
[image]

Validation.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Application

expression A variable that represents a Validation object.

Return Value

Application

Example

The following Visual Basic for Applications (VBA) macro gets the Application object associated with the Validation object for the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code
Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoValidation As Validation

 Set vsoValidation = ActiveDocument.Validation

 'Get the instance of Visio associated with the Validation object.
 Set vsoApplication = vsoValidation.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Validation.Document Property (Visio)

 Copy code hover
[image]

Validation.Document Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Document

expression A variable that represents a Validation object.

Return Value

Document


Validation.Issues Property (Visio)

 Copy code hover
[image]

Validation.Issues Property (Visio)
Send feedback

Published: July 16, 2012

Returns the collection of all the validation issues in the document. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Issues

expression A variable that represents a Validation object.

Return Value

ValidationIssues

Example

The following Visual Basic for Applications (VBA) example shows how to use the Issues property to get an object that represents the collection of all the validation issues in the document.

VBA Copy code Copy code
Dim vsoDocument As Visio.Document
Dim vsoIssues As Visio.ValidationIssues

Set vsoDocument = Visio.ActiveDocument
Set vsoIssues = vsoDocument.Validation.Issues


Validation.LastValidatedDate Property (Visio)

 Copy code hover
[image]

Validation.LastValidatedDate Property (Visio)
Send feedback

Published: July 16, 2012

Returns the time and date the document was last validated. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .LastValidatedDate

expression A variable that represents a Validation object.

Remarks

If the document has never been validated, the LastValidatedDate property returns zero (0).


Validation.ObjectType Property (Visio)

 Copy code hover
[image]

Validation.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeValidation, the type of this object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression A variable that represents a Validation object.

Return Value

visObjTypeValidation

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


Validation.RuleSets Property (Visio)

 Copy code hover
[image]

Validation.RuleSets Property (Visio)
Send feedback

Published: July 16, 2012

Returns the collection of all the validation rule sets in the document. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .RuleSets

expression A variable that represents a Validation object.

Return Value

ValidationRuleSets

Example

The following sample code is based on code provided by: David Parker

The following Visual Basic for Applications (VBA) example shows how to use the RuleSets property to get the names of all the validation rule sets in the active document and print those names in the Immediate window.

VBA Copy code Copy code
Public Sub RuleSets_Example()

    Dim vsoDocument As Visio.Document
    Dim vsoRuleSet As Visio.ValidationRuleSet
    Dim vsoValidationRule As Visio.ValidationRule

    Set vsoDocument = Visio.ActiveDocument

    For Each vsoRuleSet In vsoDocument.Validation.RuleSets

        If vsoRuleSet.Enabled Then

            Debug.Print vsoRuleSet.NameU

        End If
    Next

End Sub


Validation.ShowIgnoredIssues Property (Visio)

 Copy code hover
[image]

Validation.ShowIgnoredIssues Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether ignored validation issues appear in the Issues window. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .ShowIgnoredIssues

expression A variable that represents a Validation object.

Return Value

Boolean


Validation.Stat Property (Visio)

 Copy code hover
[image]

Validation.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression A variable that represents a Validation object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


Validation Methods (Visio)

 Copy code hover
[image]

Validation Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Validate | Validates the specified validation rule set.


Validation.Validate Method (Visio)

 Copy code hover
[image]

Validation.Validate Method (Visio)
Send feedback

Published: July 16, 2012

Validates the specified validation rule set.

Version Information

Version Added: Visio 2010

Syntax

expression .Validate(RuleSet, Flags)

expression A variable that represents a Validation object.

Parameters

Name | Required/Optional | Data Type | Description
RuleSet | Optional | ValidationRuleSet | The rule set to validate across the entire document.
Flags | Optional | VisValidationFlags | Whether to open the Issues window after validation.

Return Value

Nothing

Remarks

To validate all rule sets active in the document, pass Nothing for RuleSet.

Flags must be one of the following VisValidationFlags constants.

Constant | Value | Description
visValidationDefault | 0 | Validate document and open Issues window. The default.
visValidationNoOpenWindow | 1 | Validate document but do not open Issues window.

If you do not set the optional Flags parameter, Microsoft Visio applies the default behavior (visValidationDefault).

When you call the Validate method, Microsoft Visio checks whether the rule set is active before evaluating it. Visio does not display message boxes during the evalution, except to notify you if, when Flags is set to visValidationDefault, it finds no errors; and it displays the progress bar only if Application.ShowProgressBars is True.

Example

The following Visual Basic for Applications (VBA) example shows how to use the Validate method to validate the active document.

VBA Copy code Copy code
' Validate the document.
Call Visio.ActiveDocument.Validation.Validate(,Visio.VisValidationFlags.visValidationDefault)


ValidationIssue Object (Visio)

 Copy code hover
[image]

ValidationIssue Object (Visio)
Send feedback

Published: July 16, 2012

Represents a single validation issue in the ValidationIssues collection of a document.

Version Information

Version Added: Visio 2010

Remarks

To get a particular ValidationIssue object, you can use the Item or ItemFromID property of the ValidationIssues collection of a Document object.

The default property of the ValidationIssue object is Ignored.


ValidationIssue Members (Visio)

 Copy code hover
[image]

ValidationIssue Members (Visio)
Send feedback

Published: July 16, 2012

Represents a single validation issue in the ValidationIssues collection of a document.

Methods

Name | Description
Delete | Deletes the ValidationIssue object from the document.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Document | Returns the Document object that is associated with an object. Read-only.
ID | Gets the identifier of the ValidationIssue object assigned by Microsoft Visio. Read-only.
Ignored | Determines whether the validation issue is currently ignored. Read/write.
ObjectType | Returns visObjTypeValidationIssue, the type of this object. Read-only.
Rule | Returns the ValidationRule object that generated the validation issue. Read-only.
Stat | Returns status information for an object. Read-only.
TargetPage | Returns the Page object that is associated with the validation issue. Read-only.
TargetPageID | Returns the ID of the page that is associated with the validation issue. Read-only.
TargetShape | Returns the Shape object that is associated with the validation issue. Read-only.


ValidationIssue Properties (Visio)

 Copy code hover
[image]

ValidationIssue Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Document | Returns the Document object that is associated with an object. Read-only.
ID | Gets the identifier of the ValidationIssue object assigned by Microsoft Visio. Read-only.
Ignored | Determines whether the validation issue is currently ignored. Read/write.
ObjectType | Returns visObjTypeValidationIssue, the type of this object. Read-only.
Rule | Returns the ValidationRule object that generated the validation issue. Read-only.
Stat | Returns status information for an object. Read-only.
TargetPage | Returns the Page object that is associated with the validation issue. Read-only.
TargetPageID | Returns the ID of the page that is associated with the validation issue. Read-only.
TargetShape | Returns the Shape object that is associated with the validation issue. Read-only.


ValidationIssue.Application Property (Visio)

 Copy code hover
[image]

ValidationIssue.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Application

expression A variable that represents a ValidationIssue object.

Return Value

Application


ValidationIssue.Document Property (Visio)

 Copy code hover
[image]

ValidationIssue.Document Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Document

expression A variable that represents a ValidationIssue object.

Return Value

Document


ValidationIssue.ID Property (Visio)

 Copy code hover
[image]

ValidationIssue.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the identifier of the ValidationIssue object assigned by Microsoft Visio. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ID

expression A variable that represents a ValidationIssue object.

Return Value

Long

Remarks

The ID of a validation issue is unique within the scope of the document.


ValidationIssue.Ignored Property (Visio)

 Copy code hover
[image]

ValidationIssue.Ignored Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the validation issue is currently ignored. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .Ignored

expression A variable that represents a ValidationIssue object.

Return Value

Boolean

Remarks

Ignored issues are still recorded but, by default, they are not displayed in the Issues window.

Ignored is the default property of the ValidationIssue object.


ValidationIssue.ObjectType Property (Visio)

 Copy code hover
[image]

ValidationIssue.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeValidationIssue, the type of this object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression A variable that represents a ValidationIssue object.

Return Value

visObjTypeValidationIssue

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


ValidationIssue.Rule Property (Visio)

 Copy code hover
[image]

ValidationIssue.Rule Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ValidationRule object that generated the validation issue. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Rule

expression A variable that represents a ValidationIssue object.

Return Value

ValidationRule


ValidationIssue.Stat Property (Visio)

 Copy code hover
[image]

ValidationIssue.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression A variable that represents a ValidationIssue object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


ValidationIssue.TargetPage Property (Visio)

 Copy code hover
[image]

ValidationIssue.TargetPage Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Page object that is associated with the validation issue. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .TargetPage

expression A variable that represents a ValidationIssue object.

Return Value

Page

Remarks

If the issue is not associated with a specific page, the TargetPage property returns Nothing.

If the target page is not valid (for example, if it has been deleted), the TargetPage property returns an error.


ValidationIssue.TargetPageID Property (Visio)

 Copy code hover
[image]

ValidationIssue.TargetPageID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ID of the page that is associated with the validation issue. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .TargetPageID

expression A variable that represents a ValidationIssue object.

Return Value

Long

Remarks

If the issue is not associated with a specific page, the TargetPageID property returns -1.


ValidationIssue.TargetShape Property (Visio)

 Copy code hover
[image]

ValidationIssue.TargetShape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that is associated with the validation issue. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .TargetShape

expression A variable that represents a ValidationIssue object.

Return Value

Shape

Remarks

If the error is not associated with a specific shape, the TargetShape property returns Nothing.


ValidationIssue Methods (Visio)

 Copy code hover
[image]

ValidationIssue Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the ValidationIssue object from the document.


ValidationIssue.Delete Method (Visio)

 Copy code hover
[image]

ValidationIssue.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes the ValidationIssue object from the document.

Version Information

Version Added: Visio 2010

Syntax

expression .Delete

expression A variable that represents a ValidationIssue object.

Return Value

Nothing

Example

The following Visual Basic for Applications (VBA) example shows how to use the Delete method to delete validation issues that belong to a particular validation rule set.

VBA Copy code Copy code
Set vsoDocument = Visio.ActiveDocument
Set vsoIssues = vsoDocument.Validation.Issues
intIssueTotal = vsoIssues.Count
intIssueNumber = 1

' Iterate through the validation issues.
 For intCurrentIssue = 1 To intIssueTotal
      Set vsoIssue = vsoDocument.Validation.Issues(intIssueNumber)

     ' Delete the issues that belong to the vsoValidationRuleSet rule set.
     If vsoIssue.Rule.RuleSet Is vsoValidationRuleSet Then
         vsoIssue.Delete
     Else
        intIssueNumber = intIssueNumber + 1
     End If

 Next intCurrentIssue


ValidationIssues Object (Visio)

 Copy code hover
[image]

ValidationIssues Object (Visio)
Send feedback

Published: July 16, 2012

Includes a ValidationIssue object for each validation issue in the document.

Version Information

Version Added: Visio 2010

Remarks

To get a ValidationIssues collection, use the Issues property of the Validation object.

The default property of the ValidationIssues collection is Item.


ValidationIssues Members (Visio)

 Copy code hover
[image]

ValidationIssues Members (Visio)
Send feedback

Published: July 16, 2012

Includes a ValidationIssue object for each validation issue in the document.

Methods

Name | Description
Clear | Removes all ValidationIssue objects from the ValidationRules collection of the document.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of ValidationIssue objects in the collection. Read-only.
Document | Returns the Document object that is associated with an object. Read-only.
Item | Returns the ValidationIssue object that has the specified name or index position. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns the ValidationIssue object that matches the specified ID. Read-only.
ObjectType | Returns visObjTypeValidationIssues, the type of this object. Read-only.
Stat |


ValidationIssues Properties (Visio)

 Copy code hover
[image]

ValidationIssues Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of ValidationIssue objects in the collection. Read-only.
Document | Returns the Document object that is associated with an object. Read-only.
Item | Returns the ValidationIssue object that has the specified name or index position. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns the ValidationIssue object that matches the specified ID. Read-only.
ObjectType | Returns visObjTypeValidationIssues, the type of this object. Read-only.
Stat |


ValidationIssues.Application Property (Visio)

 Copy code hover
[image]

ValidationIssues.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Application

expression A variable that represents a ValidationIssues object.

Return Value

Application


ValidationIssues.Count Property (Visio)

 Copy code hover
[image]

ValidationIssues.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of ValidationIssue objects in the collection. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Count

expression A variable that represents a ValidationIssues object.

Return Value

Long

Example

The following Visual Basic for Applications (VBA) example shows how to use the Count method to determine how many validation issues exist in the collection of validation issues in the active document.

VBA Copy code Copy code
Set vsoDocument = Visio.ActiveDocument
Set vsoIssues = vsoDocument.Validation.Issues
intIssueTotal = vsoIssues.Count


ValidationIssues.Document Property (Visio)

 Copy code hover
[image]

ValidationIssues.Document Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Document

expression A variable that represents a ValidationIssues object.

Return Value

Document


ValidationIssues.Item Property (Visio)

 Copy code hover
[image]

ValidationIssues.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ValidationIssue object that has the specified name or index position. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Item(Index)

expression A variable that represents a ValidationIssues object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the object in its collection.

Return Value

ValidationIssue

Remarks

When retrieving objects from a collection, you can omit Item from the expression, because it is the default property for all collections.


ValidationIssues.ItemFromID Property (Visio)

 Copy code hover
[image]

ValidationIssues.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ValidationIssue object that matches the specified ID. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ItemFromID(IssueID)

expression A variable that represents a ValidationIssues object.

Parameters

Name | Required/Optional | Data Type | Description
IssueID | Required | Long | The ID of the object to retrieve.

Return Value

ValidationIssue


ValidationIssues.ObjectType Property (Visio)

 Copy code hover
[image]

ValidationIssues.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeValidationIssues, the type of this object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression A variable that represents a ValidationIssues object.

Return Value

visObjTypeValidationIssues

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


ValidationIssues,Stat Property (Visio)

 Copy code hover
[image]

ValidationIssues,Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression A variable that represents a ValidationIssues object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


ValidationIssues Methods (Visio)

 Copy code hover
[image]

ValidationIssues Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Clear | Removes all ValidationIssue objects from the ValidationRules collection of the document.


ValidationIssues.Clear Method (Visio)

 Copy code hover
[image]

ValidationIssues.Clear Method (Visio)
Send feedback

Published: July 16, 2012

Removes all ValidationIssue objects from the ValidationRules collection of the document.

Version Information

Version Added: Visio 2010

Syntax

expression .Clear

expression A variable that represents a ValidationIssues object.

Return Value

Nothing

Remarks

Calling the Clear method also resets the Validation.LastValidatedDate property value to 0 (zero).

Example

The following sample code is based on code provided by: David Parker

The following Visual Basic for Applications (VBA) example shows how to use the Clear method to clear all validation issues from the active document.

VBA Copy code Copy code
Public Sub Clear_Example()

    ActiveDocument.Validation.Issues.Clear

End Sub


ValidationRule Object (Visio)

 Copy code hover
[image]

ValidationRule Object (Visio)
Send feedback

Published: July 16, 2012

Represents a single validation rule in a diagram validation rule set.

Version Information

Version Added: Visio 2010

Remarks

To get a particular ValidationRule object, you can use the Item or ItemFromID property of the ValidationRules collection of a Document object.

The default property of the ValidationRule object is NameU.


ValidationRule Members (Visio)

 Copy code hover
[image]

ValidationRule Members (Visio)
Send feedback

Published: July 16, 2012

Represents a single validation rule in a diagram validation rule set.

Methods

Name | Description
AddIssue | Creates a new validation issue that is based on the validation rule, and adds it to the document.
Delete | Deletes the ValidationRule object from the document.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Category | Represents the text displayed in the Category column of the Issues window. Read/write.
Description | Specifies the description of the ValidationRule object that appears in the user interface. Read/write.
Document | Returns the Document object that is associated with an object. Read-only.
FilterExpression | Gets or sets the logical expression that determines whether the validation rule should be applied to a target object. Read/write.
ID | Gets the unique identifier of the ValidationRule object. Read-only.
Ignored | Determines whether the validation rule is currently ignored. Read/write.
NameU | Specifies the universal name of the ValidationRule object. This is the default property of the object. Read/write.
ObjectType | Returns visObjTypeValidationRule, the type of this object. Read-only.
RuleSet | Returns the ValidationRuleSet object that contains the specified validation rule. Read-only.
Stat | Returns status information for an object. Read-only.
TargetType | Determines the type of object to which the validation rule applies. Read/write.
TestExpression | Gets or sets the logical expression that determines whether the target object satisfies the validation rule. Read/write.


ValidationRule Properties (Visio)

 Copy code hover
[image]

ValidationRule Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Category | Represents the text displayed in the Category column of the Issues window. Read/write.
Description | Specifies the description of the ValidationRule object that appears in the user interface. Read/write.
Document | Returns the Document object that is associated with an object. Read-only.
FilterExpression | Gets or sets the logical expression that determines whether the validation rule should be applied to a target object. Read/write.
ID | Gets the unique identifier of the ValidationRule object. Read-only.
Ignored | Determines whether the validation rule is currently ignored. Read/write.
NameU | Specifies the universal name of the ValidationRule object. This is the default property of the object. Read/write.
ObjectType | Returns visObjTypeValidationRule, the type of this object. Read-only.
RuleSet | Returns the ValidationRuleSet object that contains the specified validation rule. Read-only.
Stat | Returns status information for an object. Read-only.
TargetType | Determines the type of object to which the validation rule applies. Read/write.
TestExpression | Gets or sets the logical expression that determines whether the target object satisfies the validation rule. Read/write.


ValidationRule.Application Property (Visio)

 Copy code hover
[image]

ValidationRule.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Application

expression A variable that represents a ValidationRule object.

Return Value

Application


ValidationRule.Category Property (Visio)

 Copy code hover
[image]

ValidationRule.Category Property (Visio)
Send feedback

Published: July 16, 2012

Represents the text displayed in the Category column of the Issues window. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .Category

expression A variable that represents a ValidationRule object.

Return Value

String

Remarks

The length of the string assigned to the Category property cannot exceed 255 characters.

Example

The following Visual Basic for Applications (VBA) example shows how to use the Category property to set the text of the Category column of the Issues window for a validation rule named "Unglued2DShape".

VBA Copy code Copy code
Set vsoValidationRule = vsoValidationRuleSet.Rules.Add("Unglued2DShape")
vsoValidationRule.Category = "Shapes"


ValidationRule.Description Property (Visio)

 Copy code hover
[image]

ValidationRule.Description Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the description of the ValidationRule object that appears in the user interface. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .Description

expression A variable that represents a ValidationRule object.

Return Value

String

Remarks

You cannot set the Description property to a value that exceeds 255 characters.

Example

The following Visual Basic for Applications (VBA) example shows how to use the Description property to set the description that appears in the user interface for the validation rule named "Unglued2DShape".

VBA Copy code Copy code
Set vsoValidationRule = vsoValidationRuleSet.Rules.Add("Unglued2DShape")
vsoValidationRule.Description = "This 2-dimensional shape is not connected to any other shape."


ValidationRule.Document Property (Visio)

 Copy code hover
[image]

ValidationRule.Document Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Document

expression A variable that represents a ValidationRule object.

Return Value

Document


ValidationRule.FilterExpression Property (Visio)

 Copy code hover
[image]

ValidationRule.FilterExpression Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the logical expression that determines whether the validation rule should be applied to a target object. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .FilterExpression

expression A variable that represents a ValidationRule object.

Return Value

String

Remarks

When you validate a diagram by calling the Validate method or by clicking Check Diagram on the Process tab, Microsoft Visio uses the expression that you set as the FilterExpression property value to determine whether a target object must satisfy the validation rule. If the filter expression you set evaluates to True, Visio uses the TestExpression property value you set to determine whether to generate an issue for the target object. If the filter expression evaluates to False, Visio does not apply the validation rule to the target object during validation.

The syntax for the FilterExpression property value is the same as that for a ShapeSheet expression. When you set the FilterExpression property, Visio does not validate the syntax of the filter expression. If the expression is not syntactically correct, Visio does not apply the validation rule to the target object during validation

Example

The following Visual Basic for Applications (VBA) example shows how to use the FilterExpression property to determine whether a particular shape target must satisfy a validation rule.

VBA Copy code Copy code
' The validation function Is1D() returns a Boolean value that
' indicates whether the shape is 1D (True) or 2D (False).
vsoValidationRule.FilterExpression = "NOT(Is1D())"


ValidationRule.ID Property (Visio)

 Copy code hover
[image]

ValidationRule.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the unique identifier of the ValidationRule object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ID

expression A variable that represents a ValidationRule object.

Return Value

Long

Remarks

The ID of a validation rule is unique only within the scope of a validation rule set.


ValidationRule.Ignored Property (Visio)

 Copy code hover
[image]

ValidationRule.Ignored Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the validation rule is currently ignored. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .Ignored

expression A variable that represents a ValidationRule object.

Return Value

Boolean

Remarks

Issues that pertain to an ignored rule are still recorded but, by default, they are not displayed in the Issues window.

Example

The following Visual Basic for Applications (VBA) example shows how to use the Ignored property to specify that the validation rule named "Unglued2DShape" should not be ignored.

VBA Copy code Copy code
Set vsoValidationRule = vsoValidationRuleSet.Rules.Add("Unglued2DShape")
vsoValidationRule.Ignored = False


ValidationRule.NameU Property (Visio)

 Copy code hover
[image]

ValidationRule.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of the ValidationRule object. This is the default property of the object. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .NameU

expression A variable that represents a ValidationRule object.

Return Value

String

Remarks

You cannot assign the NameU property a name that already exists in the rule set. If you attempt to do so, Visio returns an "invalid parameter" error.

You cannot set the NameU property to a value that exceeds 255 characters or to an empty string.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to various Visio objects. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you do not want to change a name each time a solution is localized. Use the Name property to get or set an object's local name. Use the NameU property to get or set its universal name.


ValidationRule.ObjectType Property (Visio)

 Copy code hover
[image]

ValidationRule.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeValidationRule, the type of this object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression A variable that represents a ValidationRule object.

Return Value

visObjTypeValidationRule

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


ValidationRule.RuleSet Property (Visio)

 Copy code hover
[image]

ValidationRule.RuleSet Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ValidationRuleSet object that contains the specified validation rule. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .RuleSet

expression A variable that represents a ValidationRule object.

Return Value

ValidationRuleSet

Example

The following Visual Basic for Applications (VBA) example shows how to use the RuleSet property to selectively delete validation issues that belong to a particular rule set.

VBA Copy code Copy code
Set vsoDocument = Visio.ActiveDocument
Set vsoIssues = vsoDocument.Validation.Issues
intIssueTotal = vsoIssues.Count
intIssueNumber = 1

' Iterate through the validation issues.
 For intCurrentIssue = 1 To intIssueTotal
      Set vsoIssue = vsoDocument.Validation.Issues(intIssueNumber)

     ' Delete the issues that belong to the vsoValidationRuleSet rule set.
     If vsoIssue.Rule.RuleSet Is vsoValidationRuleSet Then
         vsoIssue.Delete
     Else
        intIssueNumber = intIssueNumber + 1
     End If

 Next intCurrentIssue


ValidationRule.Stat Property (Visio)

 Copy code hover
[image]

ValidationRule.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression A variable that represents a ValidationRule object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


ValidationRule.TargetType Property (Visio)

 Copy code hover
[image]

ValidationRule.TargetType Property (Visio)
Send feedback

Published: July 16, 2012

Determines the type of object to which the validation rule applies. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .TargetType

expression A variable that represents a ValidationRule object.

Return Value

VisRuleTargets

Remarks

Valid validation-rule targets include documents, pages, and shapes. The TargetType property value must be one of the following VisRuleTargets constants.

Constant | Value | Description
visRuleTargetShape | 0 | The rule applies to shapes in the document.
visRuleTargetPage | 1 | The rule applies to pages in the document.
visRuleTargetDocument | 2 | The rule applies to the document itself.

If you pass any other value to the TargetType property, Visio returns an invalid-parameter error.

Example

The following Visual Basic for Applications (VBA) example shows how to use the TargetType property to specify the type of object to which the validation rule named "Unglued2DShape" should apply.

VBA Copy code Copy code
Set vsoValidationRule = vsoValidationRuleSet.Rules.Add("Unglued2DShape")
vsoValidationRule.TargetType = Visio.VisRuleTargets.visRuleTargetShape


ValidationRule.TestExpression Property (Visio)

 Copy code hover
[image]

ValidationRule.TestExpression Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the logical expression that determines whether the target object satisfies the validation rule. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .TestExpression

expression A variable that represents a ValidationRule object.

Return Value

String

Remarks

When you validate a diagram by calling the Validate method or by clicking Check Diagram on the Process tab, Microsoft Visio uses the test expression that you set as the TestExpression property value to determine whether the target object satisfies the validation rule. If the test expression evaluates to False, Visio generates a validation issue. If the test expression evaluates to True, no validation issue is generated.

Visio evaluates the test expression for target objects only when the value of the FilterExpression property of the ValidationRule object evaluates to True.

The syntax for the TestExpression property value is the same as that for a ShapeSheet expression. When you set the TestExpression property value, Visio does not check the syntax of the test expression. If the test expression is not syntactically correct, the evaluation of the expression fails during validation and Visio generates a validation issue at that time.

Example

The following Visual Basic for Applications (VBA) example shows how to use the TestExpression property to determine whether a particular shape target satisfies a validation rule.

VBA Copy code Copy code
' Add a validation rule to the document.
Set vsoValidationRule = vsoValidationRuleSet.Rules.Add("Unglued2DShape")
vsoValidationRule.Category = "Shapes"
vsoValidationRule.Description = "This 2-dimensional shape is not connected to
any other shape."
vsoValidationRule.Ignored = False
vsoValidationRule.TargetType = Visio.VisRuleTargets.visRuleTargetShape

' The validation function Is1D() returns a Boolean value that indicates
' whether the shape is 1D (True) or 2D (False).
vsoValidationRule.FilterExpression = "NOT(Is1D())"

' The validation function GLUEDSHAPES returns a set of
' shapes glued to the shape.
' It takes as input one parameter that indicates the direction of the glue.
' The direction values are equivalent to members of VisGluedShapesFlags:
' 0 = visGluedShapesAll1D, and 3 = visGluedShapesAll2D
' It takes as input one parameter indicating the direction of the glue.

' The validation function AGGCOUNT takes a set of shapes as its input, and
' returns the number of shapes in the set.
vsoValidationRule.TestExpression = "AGGCOUNT(GLUEDSHAPES(0)) + AGGCOUNT(GLUEDSHAPES(3)) > 0"


ValidationRule Methods (Visio)

 Copy code hover
[image]

ValidationRule Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddIssue | Creates a new validation issue that is based on the validation rule, and adds it to the document.
Delete | Deletes the ValidationRule object from the document.


ValidationRule.AddIssue Method (Visio)

 Copy code hover
[image]

ValidationRule.AddIssue Method (Visio)
Send feedback

Published: July 16, 2012

Creates a new validation issue that is based on the validation rule, and adds it to the document.

Version Information

Version Added: Visio 2010

Syntax

expression .AddIssue([TargetPage], [TargetShape])

expression A variable that represents a ValidationRule object.

Parameters

Name | Required/Optional | Data Type | Description
TargetPage | Optional | Page | The page that has the issue. May be Nothing.
TargetShape | Optional | Shape | The shape that has the issue. May be Nothing.

Return Value

ValidationIssue

Remarks

TargetPage and TargetShape identify the specific object that is associated with the issue. If the object that you pass for either parameter is not a valid object, or if it is inconsistent with the rule's target type, Microsoft Visio returns an Invalid Parameter error.

If you do not pass a value for the optional TargetShape parameter, the validation issue target is the page.

If you do not pass values for either of the optional parameters, the validation issue target is the document.

Example

The following Visual Basic for Applications (VBA) example shows how to use the AddIssue method to add a custom validation issue to a validation rule and associate it with a particular shape on a particular page.

VBA Copy code Copy code
' Add a custom issue to the vsoValidationRule validation rule and
' associate it with shape vsoShape on page vsoPage.
Set vsoValidationIssue = vsoValidationRule.AddIssue(vsoPage, vsoShape)


ValidationRule.Delete Method (Visio)

 Copy code hover
[image]

ValidationRule.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes the ValidationRule object from the document.

Version Information

Version Added: Visio 2010

Syntax

expression .Delete

expression A variable that represents a ValidationRule object.

Return Value

Nothing

Remarks

Calling the Delete method also deletes all ValidationIssue objects that are associated with the validation rule.

Example

The following sample code is based on code provided by: David Parker

The following Visual Basic for Applications (VBA) example shows how to use the Delete method to delete a validation rule named "Unglued Connector" from the validation rule set named "Fault Tree Analysis" in the active document.

VBA Copy code Copy code
' Delete a named rule from a named rule set.
Public Sub Delete_Example()

    Dim strValidationRuleSetNameU As String
    Dim strValidationRuleNameU As String

    Dim vsoValidationRuleSet As Visio.ValidationRuleSet

    strValidationRuleSetNameU = "Fault Tree Analysis"
    strValidationRuleNameU = "UngluedConnector"
    Set vsoValidationRuleSet = ActiveDocument.Validation.RuleSets(strValidationRuleSetNameU)

    ' Delete the rule.
    vsoValidationRuleSet.Rules(strRuleNameU).Delete

End Sub


ValidationRules Object (Visio)

 Copy code hover
[image]

ValidationRules Object (Visio)
Send feedback

Published: July 16, 2012

Includes a ValidationRule object for each validation rule in the rule set.

Version Information

Version Added: Visio 2010

Remarks

To get a ValidationRules collection, use the Rules property of the ValidationRuleSet object.

The default property of the ValidationRules collection is Item.


ValidationRules Members (Visio)

 Copy code hover
[image]

ValidationRules Members (Visio)
Send feedback

Published: July 16, 2012

Includes a ValidationRule object for each validation rule in the rule set.

Methods

Name | Description
Add | Adds a new, empty ValidationRule object to the ValidationRules collection of the document.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of ValidationRule objects in the collection. Read-only.
Document | Returns the Document object that is associated with an object. Read-only.
Item | Returns the ValidationRule object that has the specified index position. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns the ValidationRule object that matches the specified ID. Read-only.
ObjectType | Returns visObjTypeValidationRules, the type of this object. Read-only.
Stat | Returns status information for an object. Read-only.


ValidationRules Properties (Visio)

 Copy code hover
[image]

ValidationRules Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of ValidationRule objects in the collection. Read-only.
Document | Returns the Document object that is associated with an object. Read-only.
Item | Returns the ValidationRule object that has the specified index position. The Item property is the default property for all collections. Read-only.
ItemFromID | Returns the ValidationRule object that matches the specified ID. Read-only.
ObjectType | Returns visObjTypeValidationRules, the type of this object. Read-only.
Stat | Returns status information for an object. Read-only.


ValidationRules.Application Property (Visio)

 Copy code hover
[image]

ValidationRules.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Application

expression A variable that represents a ValidationRules object.

Return Value

Application


ValidationRules.Count Property (Visio)

 Copy code hover
[image]

ValidationRules.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of ValidationRule objects in the collection. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Count

expression A variable that represents a ValidationRules object.

Return Value

Long


ValidationRules.Document Property (Visio)

 Copy code hover
[image]

ValidationRules.Document Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Document

expression A variable that represents a ValidationRules object.

Return Value

Document


ValidationRules.Item Property (Visio)

 Copy code hover
[image]

ValidationRules.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ValidationRule object that has the specified index position. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Item(NameUOrIndex)

expression A variable that represents a ValidationRules object.

Parameters

Name | Required/Optional | Data Type | Description
NameUOrIndex | Required | Variant | The index number of the object in its collection.

Return Value

ValidationRule

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


ValidationRules.ItemFromID Property (Visio)

 Copy code hover
[image]

ValidationRules.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ValidationRule object that matches the specified ID. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ItemFromID(RuleID)

expression A variable that represents a ValidationRules object.

Parameters

Name | Required/Optional | Data Type | Description
RuleID | Required | Long | The ID of the object to retrieve.

Return Value

ValidationRule


ValidationRules.ObjectType Property (Visio)

 Copy code hover
[image]

ValidationRules.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeValidationRules, the type of this object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression A variable that represents a ValidationRules object.

Return Value

visObjTypeValidationRules

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


ValidationRules.Stat Property (Visio)

 Copy code hover
[image]

ValidationRules.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression A variable that represents a ValidationRules object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


ValidationRules Methods (Visio)

 Copy code hover
[image]

ValidationRules Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new, empty ValidationRule object to the ValidationRules collection of the document.


ValidationRules.Add Method (Visio)

 Copy code hover
[image]

ValidationRules.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new, empty ValidationRule object to the ValidationRules collection of the document.

Version Information

Version Added: Visio 2010

Syntax

expression .Add(NameU)

expression A variable that represents a ValidationRules object.

Parameters

Name | Required/Optional | Data Type | Description
NameU | Required | String | The universal name to assign to the new validation rule.

Return Value

ValidationRule

Remarks

If the NameU parameter is not a valid string, Microsoft Visio returns an Invalid Parameter error.

The default property values of the new validation rule are as follows: Category = [empty]; Description = "Unknown"; FilterExpression = [empty]; Ignored = False; TargetType = visRuleTargetShape; TestExpression = [empty].

Example

The following sample code is based on code provided by: David Parker

The following Visual Basic for Applications (VBA) example shows how to use the Add method to add a new validation rule named "UngluedConnector" to an existing validation rule set named "Fault Tree Analysis" in the active document.

VBA Copy code Copy code
Public Sub Add_Example()

    Dim vsoValidationRule As Visio.ValidationRule
    Dim vsoValidationRuleSet As Visio.ValidationRuleSet
    Dim strValidationRuleSetNameU As String
    Dim strValidationRuleNameU As String

    strValidationRuleSetNameU = "Fault Tree Analysis"
    strValidationRuleNameU = "UngluedConnector"

    Set vsoValidationRuleSet = ActiveDocument.Validation.RuleSets(strValidationRuleSetNameU)
    Set vsoValidationRule = vsoValidationRuleSet.Rules.Add(strValidationRuleNameU)

End Sub


ValidationRuleSet Object (Visio)

 Copy code hover
[image]

ValidationRuleSet Object (Visio)
Send feedback

Published: July 16, 2012

Represents one set of diagram validation rules.

Version Information

Version Added: Visio 2010

Remarks

To get a particular ValidationRuleSet object, you can use the Item or the ItemFromID property of the ValidationRuleSets collection of a Document object.

The default property of the ValidationRuleSet object is Name.


ValidationRuleSet Members (Visio)

 Copy code hover
[image]

ValidationRuleSet Members (Visio)
Send feedback

Published: July 16, 2012

Represents one set of diagram validation rules.

Methods

Name | Description
Delete | Deletes the ValidationRuleSet object from the document.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Description | Specifies the description of the ValidationRuleSet object that appears in the user interface. Read/write.
Document | Returns the Document object that is associated with an object. Read-only.
Enabled | Determines whether the rules in the specified validation rule set are checked when validation is triggered for the current document. Read/write.
ID | Gets the unique identifier of the ValidationRuleSet object. Read-only.
Name | Specifies the name of the ValidationRuleSet object that appears in the user interface. The default property of the object. Read/write.
NameU | Specifies the universal name of the ValidationRuleSet object. This is the default property of the object. Read/write.
ObjectType | Returns visObjTypeValidationRuleSet, the type of this object. Read-only.
Rules | Returns the collection of validation rules in the validation rule set. Read-only.
RuleSetFlags | Gets or sets special rule-set properties. Read/write.
Stat | Returns status information for an object. Read-only.


ValidationRuleSet Properties (Visio)

 Copy code hover
[image]

ValidationRuleSet Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Description | Specifies the description of the ValidationRuleSet object that appears in the user interface. Read/write.
Document | Returns the Document object that is associated with an object. Read-only.
Enabled | Determines whether the rules in the specified validation rule set are checked when validation is triggered for the current document. Read/write.
ID | Gets the unique identifier of the ValidationRuleSet object. Read-only.
Name | Specifies the name of the ValidationRuleSet object that appears in the user interface. The default property of the object. Read/write.
NameU | Specifies the universal name of the ValidationRuleSet object. This is the default property of the object. Read/write.
ObjectType | Returns visObjTypeValidationRuleSet, the type of this object. Read-only.
Rules | Returns the collection of validation rules in the validation rule set. Read-only.
RuleSetFlags | Gets or sets special rule-set properties. Read/write.
Stat | Returns status information for an object. Read-only.


ValidationRuleSet.Application Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Application

expression A variable that represents a ValidationRuleSet object.

Return Value

Application


ValidationRuleSet.Description Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.Description Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the description of the ValidationRuleSet object that appears in the user interface. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .Description

expression A variable that represents a ValidationRuleSet object.

Return Value

String

Remarks

You cannot set the Description property to a value that exceeds 255 characters.

Example

The following Visual Basic for Applications (VBA) example shows how to use the Description property to set the description of a validation rule set named "Connectivity" in the active document.

VBA Copy code Copy code
Set vsoDocument = Visio.ActiveDocument
Set vsoValidationRuleSet = vsoDocument.Validation.RuleSets.Add("Connectivity")
vsoValidationRuleSet.Description = "Verify that shapes are correctly connected in the document."


ValidationRuleSet.Document Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.Document Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Document

expression A variable that represents a ValidationRuleSet object.

Return Value

Document


ValidationRuleSet.Enabled Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.Enabled Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the rules in the specified validation rule set are checked when validation is triggered for the current document. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .Enabled

expression A variable that represents a ValidationRuleSet object.

Return Value

Boolean

Remarks

If the value of the Enabled property is True, the rules in the validation rule set are checked when validation is triggered for the current document. Validation is triggered when the user clicks Check Diagram on the Process tab or when the Validate method is run on the current document.

Rule sets for which the value of Enabled is False are purged from the current document when the RemoveHiddenInformation method is run with the visRHIValidationRules flag set, or when the equivalent command is issued in the user interface.

Example

The following Visual Basic for Applications (VBA) example shows how to use the Enabled property to enable a validation rule set named "Connectivity" in the active document.

VBA Copy code Copy code
Set vsoDocument = Visio.ActiveDocument

Set vsoValidationRuleSet = vsoDocument.Validation.RuleSets.Add("Connectivity")

' Enable the rule set.
vsoValidationRuleSet.Enabled = True


ValidationRuleSet.ID Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the unique identifier of the ValidationRuleSet object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ID

expression A variable that represents a ValidationRuleSet object.

Return Value

Long

Remarks

The ID of a validation rule set is unique within the scope of the document.


ValidationRuleSet.Name Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.Name Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the name of the ValidationRuleSet object that appears in the user interface. The default property of the object. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .Name

expression A variable that represents a ValidationRuleSet object.

Return Value

String

Remarks

You cannot set the Name property to a value that exceeds 255 characters or to an empty string.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to various Visio objects. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you do not want to change a name each time a solution is localized. Use the Name property to get or set an object's local name. Use the NameU property to get or set its universal name.


ValidationRuleSet.NameU Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.NameU Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the universal name of the ValidationRuleSet object. This is the default property of the object. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .NameU

expression A variable that represents a ValidationRuleSet object.

Return Value

String

Remarks

You cannot assign the NameU property a name that already exists in the document. If you attempt to do so, Visio returns an "invalid parameter" error.

You cannot set the NameU property to a value that exceeds 255 characters or to an empty string.

Note Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to various Visio objects. When a user names a shape, for example, the user is specifying a local name. Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions, universal names were not visible in the user interface.)

As a developer, you can use universal names in a program when you do not want to change a name each time a solution is localized. Use the Name property to get or set an object's local name. Use the NameU property to get or set its universal name.


ValidationRuleSet.ObjectType Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeValidationRuleSet, the type of this object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression A variable that represents a ValidationRuleSet object.

Return Value

visObjTypeValidationRuleSet

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


ValidationRuleSet.Rules Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.Rules Property (Visio)
Send feedback

Published: July 16, 2012

Returns the collection of validation rules in the validation rule set. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Rules

expression A variable that represents a ValidationRuleSet object.

Return Value

ValidationRules

Example

The following sample code is based on code provided by: David Parker

The following Visual Basic for Applications (VBA) example shows how to use the Rules property to get the names of all the validation rules in an existing validation rule set named "Fault Tree Analysis" in the active document. The example then prints those names in the Immediate window.

VBA Copy code Copy code
Public Sub Rules_Example()

    Dim vsoDocument As Visio.Document
    Dim vsoValidationRule As Visio.ValidationRule
    Dim strValidationRuleSetNameU As String

    Set vsoDocument = Visio.ActiveDocument
    strValidationRuleSetNameU = "FaultTreeAnalysis"

    For Each vsoValidationRule In vsoDocument.Validation.RuleSets(strValidationRuleSetNameU).Rules

        Debug.Print vsoValidationRule.NameU

    Next

End Sub


ValidationRuleSet.RuleSetFlags Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.RuleSetFlags Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets special rule-set properties. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .RuleSetFlags

expression A variable that represents a ValidationRuleSet object.

Return Value

VisRuleSetFlags

Remarks

The RuleSetFlags property value must be one of the following VisRuleSetFlags constants.

Constant | Value | Description
visRuleSetDefault | 0 | The default set of rule-set properties. The rule set appears in the the Rules to Check list (click the Check Diagram arrow on the Process tab).
visRuleSetHidden | 1 | The rule set does not appear in the Rules to Check list.

Example

The following Visual Basic for Applications (VBA) example shows how to use the RuleSetFlags property to set the properties for a validation rule set named "Connectivity" in the active document.

VBA Copy code Copy code
Set vsoDocument = Visio.ActiveDocument
Set vsoValidationRuleSet = vsoDocument.Validation.RuleSets.Add("Connectivity")
vsoValidationRuleSet.RuleSetFlags = Visio.VisRuleSetFlags.visRuleSetDefault


ValidationRuleSet.Stat Property (Visio)

 Copy code hover
[image]

ValidationRuleSet.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression A variable that represents a ValidationRuleSet object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


ValidationRuleSet Methods (Visio)

 Copy code hover
[image]

ValidationRuleSet Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the ValidationRuleSet object from the document.


ValidationRuleSet.Delete Method (Visio)

 Copy code hover
[image]

ValidationRuleSet.Delete Method (Visio)
Send feedback

Published: July 16, 2012

Deletes the ValidationRuleSet object from the document.

Version Information

Version Added: Visio 2010

Syntax

expression .Delete

expression A variable that represents a ValidationRuleSet object.

Return Value

Nothing

Remarks

Calling the Delete method also deletes all ValidationRule objects that are associated with the validation rule set.

Example

The following sample code is based on code provided by: David Parker

The following Visual Basic for Applications (VBA) example shows how to use the Delete method to delete a validation rule set named "Fault Tree Analysis" from the active document.

VBA Copy code Copy code
' Delete a rule set from the active document.
Public Sub Delete_Example()

    Dim strValidationRuleSetNameU As String
    strValidationRuleSetNameU = "Fault Tree Analysis"

    ActiveDocument.Validation.RuleSets(strValidationRuleSetNameU).Delete

End Sub


ValidationRuleSets Object (Visio)

 Copy code hover
[image]

ValidationRuleSets Object (Visio)
Send feedback

Published: July 16, 2012

Includes a ValidationRuleSet object for each validation rule set in the document.

Version Information

Version Added: Visio 2010

Remarks

To get the ValidationRuleSets collection, use the RuleSets property of the Validation object.

The default property of the ValidationRuleSets collection is Item.


ValidationRuleSets Members (Visio)

 Copy code hover
[image]

ValidationRuleSets Members (Visio)
Send feedback

Published: July 16, 2012

Includes a ValidationRuleSet object for each validation rule set in the document.

Methods

Name | Description
Add | Adds a new, empty ValidationRuleSet object to the ValidationRuleSets collection of the document.
AddCopy | Adds a copy of an existing ValidationRuleSet object to the ValidationRuleSets collection of the document.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of ValidationRuleSet objects in the collection. Read-only.
Document | Returns the Document object that is associated with an object. Read-only.
Item | Returns the ValidationRuleSet object that has the specified universal name or index position. Read-only.
ItemFromID | Returns the ValidationRuleSet object that matches the specified ID. Read-only.
ObjectType | Returns visObjTypeValidationRuleSets, the type of this object. Read-only.
Stat | Returns status information for an object. Read-only.


ValidationRuleSets Properties (Visio)

 Copy code hover
[image]

ValidationRuleSets Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of ValidationRuleSet objects in the collection. Read-only.
Document | Returns the Document object that is associated with an object. Read-only.
Item | Returns the ValidationRuleSet object that has the specified universal name or index position. Read-only.
ItemFromID | Returns the ValidationRuleSet object that matches the specified ID. Read-only.
ObjectType | Returns visObjTypeValidationRuleSets, the type of this object. Read-only.
Stat | Returns status information for an object. Read-only.


ValidationRuleSets.Application Property (Visio)

 Copy code hover
[image]

ValidationRuleSets.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Application

expression A variable that represents a ValidationRuleSets object.

Return Value

Application


ValidationRuleSets.Count Property (Visio)

 Copy code hover
[image]

ValidationRuleSets.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of ValidationRuleSet objects in the collection. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Count

expression A variable that represents a ValidationRuleSets object.

Return Value

Long


ValidationRuleSets.Document Property (Visio)

 Copy code hover
[image]

ValidationRuleSets.Document Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Document

expression A variable that represents a ValidationRuleSets object.

Return Value

Document


ValidationRuleSets.Item Property (Visio)

 Copy code hover
[image]

ValidationRuleSets.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ValidationRuleSet object that has the specified universal name or index position. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Item(NameUOrIndex)

expression A variable that represents a ValidationRuleSets object.

Parameters

Name | Required/Optional | Data Type | Description
NameUOrIndex | Required | Variant | The universal name of the object, or the index number of the object in its collection.

Return Value

ValidationRuleSet

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections.


ValidationRuleSets.ItemFromID Property (Visio)

 Copy code hover
[image]

ValidationRuleSets.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns the ValidationRuleSet object that matches the specified ID. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ItemFromID(RuleID)

expression A variable that represents a ValidationRuleSets object.

Parameters

Name | Required/Optional | Data Type | Description
RuleID | Required | Long | The ID of the object to retrieve.

Return Value

ValidationRuleSet


ValidationRuleSets.ObjectType Property (Visio)

 Copy code hover
[image]

ValidationRuleSets.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns visObjTypeValidationRuleSets, the type of this object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .ObjectType

expression A variable that represents a ValidationRuleSets object.

Return Value

visObjTypeValidationRuleSets

Remarks

Constants that represent object types are prefixed with visObjType and are declared by the Visio type library in the VisObjectTypes enumeration.


ValidationRuleSets.Stat Property (Visio)

 Copy code hover
[image]

ValidationRuleSets.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .Stat

expression A variable that represents a ValidationRuleSets object.

Return Value

VisStatCodes

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.


ValidationRuleSets Methods (Visio)

 Copy code hover
[image]

ValidationRuleSets Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new, empty ValidationRuleSet object to the ValidationRuleSets collection of the document.
AddCopy | Adds a copy of an existing ValidationRuleSet object to the ValidationRuleSets collection of the document.


ValidationRuleSets.Add Method (Visio)

 Copy code hover
[image]

ValidationRuleSets.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new, empty ValidationRuleSet object to the ValidationRuleSets collection of the document.

Version Information

Version Added: Visio 2010

Syntax

expression .Add(NameU)

expression A variable that represents a ValidationRuleSet object.

Parameters

Name | Required/Optional | Data Type | Description
NameU | Required | String | The universal name to assign to the new validation rule set.

Return Value

ValidationRuleSet

Remarks

If the NameU parameter is not a valid string or if it matches the universal name of an existing rule set in the document, Microsoft Visio returns an Invalid Parameter error.

The default property values of the new validation rule set are as follows: Description = [empty]; Enabled = True; Name = NameU; RuleSetFlags = visRuleSetDefault.

Example

The following Visual Basic for Applications (VBA) example shows how to use the Add method to add a validation rule set named "Connectivity" to the active document.

VBA Copy code Copy code
Set vsoDocument = Visio.ActiveDocument

' Add a validation rule set to the document.
Set vsoValidationRuleSet =
vsoDocument.Validation.RuleSets.Add("Connectivity")


ValidationRuleSets.AddCopy Method (Visio)

 Copy code hover
[image]

ValidationRuleSets.AddCopy Method (Visio)
Send feedback

Published: July 16, 2012

Adds a copy of an existing ValidationRuleSet object to the ValidationRuleSets collection of the document.

Version Information

Version Added: Visio 2010

Syntax

expression .AddCopy(RuleSet, NameU)

expression A variable that represents a ValidationRuleSet object.

Parameters

Name | Required/Optional | Data Type | Description
RuleSet | Required | ValidationRuleSet | The existing rule set to copy and add to the collection of rule sets.
NameU | Optional | String | The universal name to assign to the new validation rule set.

Return Value

ValidationRuleSet

Remarks

If you pass a value for the optional NameU parameter, both the Name and NameU properties of the new rule set are assigned the value. If you do not pass a value, Microsoft Visio assigns the new rule set the local and universal name of the existing rule set. In that case, if you copy a rule set within a document, Visio overwrites the existing rule set. However, if you copy a rule set to another document, Visio adds a new rule set to the other document and leaves the existing rule set unchanged.

Similarly, if the value that you pass for the NameU matches the universal name of an existing rule set in the document, Visio overwrites the existing rule set.

If the NameU parameter is not a valid string, Visio returns an Invalid Parameter error.


Window Object (Visio)

 Copy code hover
[image]

Window Object (Visio)
Send feedback

Published: July 16, 2012

Represents an open window in a Microsoft Visio instance.

Remarks

The default property of a Window object is Application.

To retrieve

  • the active window in an instance of Visio, use the ActiveWindow property of an Application object.

  • a Page object that represents the page shown in the window, use the Page property of a Window object.

  • a Document object that represents the document displayed in that window, use the Document property.

  • a Selection object that represents the shapes selected in that window, use the Selection property.

Note Note

Beginning with Microsoft Visio 2002, the following methods of the Window object are obsolete: AddToGroup, Cut, Combine, Copy, Delete, Duplicate, Fragment, Group, Intersect, Join RemoveFromGroup, Subtract, Trim, and Union. Existing solutions that invoke these methods will continue to work properly; however, new or rebuilt solutions should use these methods with the Selection object.

In addition, the Window object's Paste method is now obsolete. Use the Paste or PasteSpecial method of the Page, Master, or Shape object. (Use the Shape object in the case of group shapes.)


Window Members (Visio)

 Copy code hover
[image]

Window Members (Visio)
Send feedback

Published: July 16, 2012

Represents an open window in a Microsoft Visio instance.

Events

Name | Description
BeforeWindowClosed | Occurs before a window is closed.
BeforeWindowPageTurn | Occurs before a window is about to show a different page.
BeforeWindowSelDelete | Occurs before the shapes in the selection of a window are deleted.
KeyDown | Occurs when a keyboard key is pressed.
KeyPress | Occurs when a keyboard key is pressed.
KeyUp | Occurs when a keyboard key is released.
MouseDown | Occurs when a mouse button is clicked.
MouseMove | Occurs when the mouse is moved.
MouseUp | Occurs when a mouse button is released.
OnKeystrokeMessageForAddon | Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.
QueryCancelWindowClose | Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.
SelectionChanged | Occurs after a set of shapes selected in a window changes.
ViewChanged | Occurs when the zoom level or scroll position of a drawing window changes.
WindowActivated | Occurs after the active window changes in a Microsoft Visio instance.
WindowChanged | Occurs when the size or position of a window changes.
WindowCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.
WindowTurnedToPage | Occurs after a window shows a different page.

Methods

Name | Description
Activate | Activates a window.
CenterViewOnShape | Pans the Microsoft Visio drawing window to place the specified shape in the center of the view.
Close | Closes a window.
DeselectAll | Deselects all shapes in a window or selection.
DockedStencils | Returns the names of all stencils docked in a Microsoft Visio drawing window.
GetViewRect | Returns the page coordinates of a window's borders.
GetWindowRect | Gets the size and position of the client area of a window.
NewWindow | Opens a new Microsoft Visio window.
Scroll | Scrolls the contents of a window vertically, horizontally, or both.
ScrollViewTo | Scrolls a window to a particular page coordinate.
Select | Selects or clears an object.
SelectAll | Selects all possible shapes in a window or selection.
SetViewRect | Sets the page coordinates of a window's borders by adjusting the zoom level and center scroll position.
SetWindowRect | Sets the size and position of the client area of a window.

Properties

Name | Description
AllowEditing | Determines whether the Edit Stencil command is enabled or disabled in a stencil window. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
BackgroundColor | Determines the background color of the active Microsoft Visio drawing window and its associated print preview and full-screen view windows. Read/write.
BackgroundColorGradient | Determines the background gradient color of the active Microsoft Visio drawing window and its associated print preview and full-screen view windows. Read/write.
Caption | Gets or sets the caption for a window. Read/write.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a Window object in the Windows collection. Read-only.
InPlace | Specifies whether a window is open in place, or whether a document is being viewed through a window that is open in place. Read-only.
IsEditingOLE | Determines whether a drawing window contains an ActiveX control that has focus or an embedded or linked object that is being edited. Read-only.
IsEditingText | Determines whether a text editing session is active in the drawing window. Read-only.
Master | Gets the master that is displayed in a window. Read-only.
MasterShortcut | Gets the master shortcut that is displayed in a window. Read-only.
MergeCaption | Gets or sets the abbreviated caption that appears on the page tab when the window is merged with other windows. Read/write.
MergeClass | Specifies a list of window classes that this anchored window can merge with. Read/write.
MergeID | Specifies the string version of a merged window's globally unique identifier (GUID). Read/write.
MergePosition | Specifies the left-to-right tab position of a merged anchored window. Read/write.
ObjectType | Returns an object's type. Read-only.
Page | Gets or sets the page that is displayed in a window. Read/write.
Parent | Determines the parent of an object. Read-only.
ParentWindow | Returns the Window object that is the parent of another Window object. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
ReviewerMarkupVisible | Determines whether reviewer markup, for a particular reviewer or all reviewers, is visible in a Microsoft Visio window that displays a drawing page. Read/write.
ScrollLock | Determines whether scrolling is disabled in a Microsoft Visio window. Read/write.
SelectedCell | Returns the selected cell in the ShapeSheet window. Read-only.
SelectedDataRecordset | Gets or sets the data recordset that is displayed on the active tab of the External Data Window in the Microsoft Visio user interface (UI). Read/write.
SelectedDataRowID | Gets or sets the ID of the data row that is selected (or that is the primary row selected, when multiple rows are selected) on the active tab of the External Data Window in the Microsoft Visio user interface (UI). Read/write.
SelectedMasters | Returns an array of the masters or master shortcuts selected in a Microsoft Visio stencil window. Read-only.
SelectedText | Returns the selected text in the Microsoft Visio drawing window as a Characters object. Read/write.
SelectedValidationIssue | Gets or sets the validation issue that is selected in the Issues window. Read/write.
Selection | Returns a Selection object that represents what is presently selected in the window, or assigns a selection created by the CreateSelection method to a Selection object. Read/write.
SelectionForDragCopy | Returns the Selection object that represents the collection of shapes that will participate in drag or copy operations, based on the current selection. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
ShowConnectPoints | Determines whether connection points are shown in a window. Read/write.
ShowGrid | Determines whether a grid is shown in a window. Read/write.
ShowGuides | Determines whether guides are shown in a window. Read/write.
ShowPageBreaks | Determines whether page breaks are shown in a window. Read/write.
ShowPageOutline | Determines whether the drawing page outline is displayed in the Microsoft Visio drawing window. Read/write.
ShowPageTabs | Determines whether page tab controls are shown in the drawing window. Read/write.
ShowRulers | Determines whether rulers are shown in the drawing window. Read/write.
ShowScrollBars | Determines whether scroll bars are shown in the drawing window. Read/write.
Stat | Returns status information for an object. Read-only.
SubType | Returns the subtype of a Window object that represents a drawing window. Read-only.
Type | Returns the type of the object. Read-only.
ViewFit | Determines which auto-fit mode a window is in, if any. Read/write.
Visible | Determines whether a window is visible. Read/write.
WindowHandle32 | Returns the 32-bit handle of a Microsoft Visio window. Read-only.
Windows | Returns the Windows collection for a Microsoft Visio instance or window. Read-only.
WindowState | Gets or sets the state of a window. Read/write.
Zoom | Gets or sets the current display size (magnification factor) for a page in a window. Read/write.
ZoomBehavior | Determines the zoom behavior for a Microsoft Visio document or window. Read/write.
ZoomLock | Determines whether zooming is disabled in a Microsoft Visio drawing window. Read/write.


Window Properties (Visio)

 Copy code hover
[image]

Window Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllowEditing | Determines whether the Edit Stencil command is enabled or disabled in a stencil window. Read/write.
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
BackgroundColor | Determines the background color of the active Microsoft Visio drawing window and its associated print preview and full-screen view windows. Read/write.
BackgroundColorGradient | Determines the background gradient color of the active Microsoft Visio drawing window and its associated print preview and full-screen view windows. Read/write.
Caption | Gets or sets the caption for a window. Read/write.
Document | Gets the Document object that is associated with an object. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
ID | Gets the ID of an object. Read-only.
Index | Gets the ordinal position of a Window object in the Windows collection. Read-only.
InPlace | Specifies whether a window is open in place, or whether a document is being viewed through a window that is open in place. Read-only.
IsEditingOLE | Determines whether a drawing window contains an ActiveX control that has focus or an embedded or linked object that is being edited. Read-only.
IsEditingText | Determines whether a text editing session is active in the drawing window. Read-only.
Master | Gets the master that is displayed in a window. Read-only.
MasterShortcut | Gets the master shortcut that is displayed in a window. Read-only.
MergeCaption | Gets or sets the abbreviated caption that appears on the page tab when the window is merged with other windows. Read/write.
MergeClass | Specifies a list of window classes that this anchored window can merge with. Read/write.
MergeID | Specifies the string version of a merged window's globally unique identifier (GUID). Read/write.
MergePosition | Specifies the left-to-right tab position of a merged anchored window. Read/write.
ObjectType | Returns an object's type. Read-only.
Page | Gets or sets the page that is displayed in a window. Read/write.
Parent | Determines the parent of an object. Read-only.
ParentWindow | Returns the Window object that is the parent of another Window object. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.
ReviewerMarkupVisible | Determines whether reviewer markup, for a particular reviewer or all reviewers, is visible in a Microsoft Visio window that displays a drawing page. Read/write.
ScrollLock | Determines whether scrolling is disabled in a Microsoft Visio window. Read/write.
SelectedCell | Returns the selected cell in the ShapeSheet window. Read-only.
SelectedDataRecordset | Gets or sets the data recordset that is displayed on the active tab of the External Data Window in the Microsoft Visio user interface (UI). Read/write.
SelectedDataRowID | Gets or sets the ID of the data row that is selected (or that is the primary row selected, when multiple rows are selected) on the active tab of the External Data Window in the Microsoft Visio user interface (UI). Read/write.
SelectedMasters | Returns an array of the masters or master shortcuts selected in a Microsoft Visio stencil window. Read-only.
SelectedText | Returns the selected text in the Microsoft Visio drawing window as a Characters object. Read/write.
SelectedValidationIssue | Gets or sets the validation issue that is selected in the Issues window. Read/write.
Selection | Returns a Selection object that represents what is presently selected in the window, or assigns a selection created by the CreateSelection method to a Selection object. Read/write.
SelectionForDragCopy | Returns the Selection object that represents the collection of shapes that will participate in drag or copy operations, based on the current selection. Read-only.
Shape | Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.
ShowConnectPoints | Determines whether connection points are shown in a window. Read/write.
ShowGrid | Determines whether a grid is shown in a window. Read/write.
ShowGuides | Determines whether guides are shown in a window. Read/write.
ShowPageBreaks | Determines whether page breaks are shown in a window. Read/write.
ShowPageOutline | Determines whether the drawing page outline is displayed in the Microsoft Visio drawing window. Read/write.
ShowPageTabs | Determines whether page tab controls are shown in the drawing window. Read/write.
ShowRulers | Determines whether rulers are shown in the drawing window. Read/write.
ShowScrollBars | Determines whether scroll bars are shown in the drawing window. Read/write.
Stat | Returns status information for an object. Read-only.
SubType | Returns the subtype of a Window object that represents a drawing window. Read-only.
Type | Returns the type of the object. Read-only.
ViewFit | Determines which auto-fit mode a window is in, if any. Read/write.
Visible | Determines whether a window is visible. Read/write.
WindowHandle32 | Returns the 32-bit handle of a Microsoft Visio window. Read-only.
Windows | Returns the Windows collection for a Microsoft Visio instance or window. Read-only.
WindowState | Gets or sets the state of a window. Read/write.
Zoom | Gets or sets the current display size (magnification factor) for a page in a window. Read/write.
ZoomBehavior | Determines the zoom behavior for a Microsoft Visio document or window. Read/write.
ZoomLock | Determines whether zooming is disabled in a Microsoft Visio drawing window. Read/write.


Window.AllowEditing Property (Visio)

 Copy code hover
[image]

Window.AllowEditing Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the Edit Stencil command is enabled or disabled in a stencil window. Read/write.

Version Information

Version Added: Word 2002

Syntax

expression .AllowEditing

expression A variable that represents a Window object.

Return Value

Boolean

Remarks

Use the AllowEditing property to prevent unintentional editing in stencils. Setting the value of this property for stencils that are already open for editing has no effect. This property has no effect on Visio stencils (stencils that are shipped on the Microsoft Visio CD) or on other stencils that have been published to Visio by using an .msi file.

Note Note

Only user-created stencils are editable. By default, Visio stencils are not editable.


Window.Application Property (Visio)

 Copy code hover
[image]

Window.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Window object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Window.BackgroundColor Property (Visio)

 Copy code hover
[image]

Window.BackgroundColor Property (Visio)
Send feedback

Published: July 16, 2012

Determines the background color of the active Microsoft Visio drawing window and its associated print preview and full-screen view windows. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .BackgroundColor

expression A variable that represents a Window object.

Return Value

OLE_COLOR

Remarks

Valid values for an OLE_COLOR property within Visio can be one of the following:

  • &H00bbggrr, where bb is the blue value between 0 and 0xFF (255), gg the green value, and rr the red value.

  • &H800000xx, where xx is a valid GetSysColor index.

For details about the GetSysColor function, search for "GetSysColor" in the Microsoft Platform SDK on MSDN.

The OLE_COLOR data type is used for properties that return colors. When a property is declared as OLE_COLOR, the Properties window in the Visual Basic Editor displays a color-picker dialog box that allows the user to select the color for the property visually, rather than having to remember the numeric equivalent.

In addition, you can use the following Microsoft Visual Basic for Applications (VBA) color constants for OLE_COLOR.

Constant | Value | Description
vbBlack | 0x0 | Black
vbRed | 0xFF | Red
vbGreen | 0xFF00 | Green
vbYellow | 0xFFFF | Yellow
vbBlue | 0xFF0000 | Blue
vbMagenta | 0xFF00FF | Magenta
vbCyan | 0xFFFF00 | Cyan
vbWhite | 0xFFFFFF | White

For a drawing window, print preview window, or full-screen view window, setting the BackgroundColor property of the window to a value other than the default (-1) overrides the ApplicationSettings.DrawingBackgroundColor, ApplicationSettings.PrintPreviewBackgroundColor, and ApplicationSettings.FullScreenBackgroundColor settings for that set of windows. To be able to reset these properties for the same set of windows, you must reset BackgroundColor to its default value, -1. If multiple drawings are open, setting BackgroundColor for one set of windows has no effect on the setting for other open window sets.

However, for a ShapeSheet window, setting the BackgroundColor property of the window to a value other than the default changes the background color of the ShapeSheet window, but has no effect on any of the other window settings.

Example

The following VBA macro shows how to use the BackgroundColor property to get and set the current drawing window background color. It also shows how to get an ApplicationSettings object from the Visio Application object, and it demonstrates the relationship between the BackgroundColor property and the ApplicationSettings.DrawingBackgroundColor property. This example assumes there is an active drawing window open in Visio and that initially all background color properties are set to their default values.

VBA Copy code Copy code
Public Sub BackgroundColor_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Set vsoApplicationSettings = Visio.Application.Settings

 'Get the current application background color.
 Debug.Print vsoApplicationSettings.DrawingBackgroundColor

 'Get the active window background color.
 Debug.Print ActiveWindow.BackgroundColor

 'Change the application background color.
 'This also changes the active window color as
 'well as the setting in the Color Settings dialog box.
 vsoApplicationSettings.DrawingBackgroundColor = vbRed

 'Change the active window background color.
 ActiveWindow.BackgroundColor = vbMagenta

 'Change the application background color again.
 'This time, there is no change in the current
 'window color, but the dialog box setting changes.
 vsoApplicationSettings.DrawingBackgroundColor = vbYellow

 'Reset Window.BackgroundColor to its default value.
 ActiveWindow.BackgroundColor = -1

 'Change the application background color again.
 'Now both the active window color
 'and the dialog box setting change.
 vsoApplicationSettings.DrawingBackgroundColor = vbBlue

End Sub


Window.BackgroundColorGradient Property (Visio)

 Copy code hover
[image]

Window.BackgroundColorGradient Property (Visio)
Send feedback

Published: July 16, 2012

Determines the background gradient color of the active Microsoft Visio drawing window and its associated print preview and full-screen view windows. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .BackgroundColorGradient

expression A variable that represents a Window object.

Return Value

OLE_COLOR

Remarks

Valid values for an OLE_COLOR property within Visio can be one of the following:

  • &H00bbggrr, where bb is the blue value between 0 and 0xFF (255), gg the green value, and rr the red value.

  • &H800000xx, where xx is a valid GetSysColor index.

For details about the GetSysColor function, search for "GetSysColor" in the Microsoft Platform SDK on MSDN.

The OLE_COLOR data type is used for properties that return colors. When a property is declared as OLE_COLOR, the Properties window in the Visual Basic Editor editor displays a color-picker dialog box that allows the user to select the color for the property visually, rather than having to remember the numeric equivalent.

In addition, you can use the following Microsoft Visual Basic for Applications (VBA) color constants for OLE_COLOR.

Constant | Value | Description
vbBlack | 0x0 | Black
vbRed | 0xFF | Red
vbGreen | 0xFF00 | Green
vbYellow | 0xFFFF | Yellow
vbBlue | 0xFF0000 | Blue
vbMagenta | 0xFF00FF | Magenta
vbCyan | 0xFFFF00 | Cyan
vbWhite | 0xFFFFFF | White

For a drawing window, print preview window, or full-screen view window, setting the BackgroundColorGradient property of the window to a value other than the default (-1) overrides the ApplicationSettings.DrawingBackgroundColorGradient setting for that set of windows. To be able to reset this property for the same set of windows, you must reset BackgroundColorGradient to its default value, -1. If multiple drawings are open, setting BackgroundColorGradient for one set of windows has no effect on the setting for other open window sets.

However, for a ShapeSheet window, setting the BackgroundColorGradient property of the window to a value other than the default has no effect, either on the background color of the ShapeSheet window, or on any of the other window settings.

Example

The following VBA macro shows how to use the BackgroundColorGradient property to get and set the active window background gradient color. It also shows how to get an ApplicationSettings object from the Visio Application object, and it demonstrates the relationship between the BackgroundColorGradient property and the ApplicationSettings.DrawingBackgroundColorGradient property. This example assumes there is an active drawing window open in Visio and that initially all background gradient color properties are set to their default values.

VBA Copy code Copy code
Public Sub BackgroundColorGradient_Example()

 Dim vsoApplicationSettings As Visio.ApplicationSettings
 Set vsoApplicationSettings = Visio.Application.Settings

 'Get the current application background gradient color.
 Debug.Print vsoApplicationSettings.DrawingBackgroundColorGradient

 'Get the current window background color gradient.
 Debug.Print ActiveWindow.BackgroundColorGradient

 'Change the application background gradient color.
 'This also changes the current window color as
 'well as the setting in the Color Settings dialog box.
 vsoApplicationSettings.DrawingBackgroundColor = vbRed

 'Change the active window background gradient color.
 ActiveWindow.BackgroundColorGradient = vbMagenta

 'Change the application background gradient color again.
 'This time, there is no change in the current
 'window color, but the dialog box setting changes.
 vsoApplicationSettings.DrawingBackgroundColorGradient = vbYellow

 'Reset Window.BackgroundColorGradient to its default value.
 ActiveWindow.BackgroundColorGradient = -1

 'Change the application background gradient color again.
 'Now both the active window color
 'and the dialog box setting change.
 vsoApplicationSettings.DrawingBackgroundColorGradient = vbBlue

End Sub


Window.Caption Property (Visio)

 Copy code hover
[image]

Window.Caption Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the caption for a window. Read/write.

Version Information

Version Added: Visio 4.0

Syntax

expression .Caption

expression A variable that represents a Window object.

Return Value

String


Window.Document Property (Visio)

 Copy code hover
[image]

Window.Document Property (Visio)
Send feedback

Published: July 16, 2012

Gets the Document object that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Document

expression A variable that represents a Window object.

Return Value

Document

Remarks

The Document property of a docked stencil window returns a Document object for the stencil that is currently at the top of the window. If another stencil replaces the first in the top position, the first stencil's document is closed so the reference to it becomes invalid. For best results, assume that document references to docked stencils are not persistent.

If a Window object shows no documents are open, no document is returned and no exception is raised. Your solution should check for Nothing returned after retrieving the Document property of a Window object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Document property of various objects to retrieve data about those objects, and does the following:

  • It adds a Document object to the Documents collection and sets several of the Document object's properties.

  • It gets the active window and active page, draws a rectangle on the page, and drops a master on the Document object to provide various objects to work on.

  • It uses the Document property to get the Document object associated with each of these other objects.

VBA Copy code Copy code

Public Sub Document_Example()

 Dim vsoDocument As Visio.Document
 Dim vsoTempDocument As Visio.Document
 Dim vsoPage As Visio.Page
 Dim vsoShape As Visio.Shape
 Dim vsoWindow As Visio.Window
 Dim vsoMaster As Visio.Master

 'Add a document to the Documents collection.
 Set vsoDocument = Documents.Add("")

 'Set the title of the document.
 vsoDocument.Title = "My Document"

 'Get the active window and active page.
 Set vsoWindow = ActiveWindow
 Set vsoPage = ActivePage

 'Draw a rectangle on the page.
 Set vsoShape = vsoPage.DrawRectangle(2, 2, 5, 5)

 'Add a master.
 Set vsoMaster = vsoDocument.Masters.Add

 'Get the Document object associated with various other objects.'Get the Document object associated with the Window object.
 Set vsoTempDocument = vsoWindow.Document

 'Get the Title property of the Document object'to verify that this is the same document we added earlier.
 Debug.Print vsoTempDocument.Title

 'Get the Document object associated with the Page object.
 Set vsoTempDocument = vsoPage.Document
 Debug.Print vsoTempDocument.Title

 'Get the Document object associated with the Shape object.
 Set vsoTempDocument = vsoShape.Document
 Debug.Print vsoTempDocument.Title

 'Get the Document object associated with the Master object.
 Set vsoTempDocument = vsoMaster.Document
 Debug.Print vsoTempDocument.Title

End Sub


Window.EventList Property (Visio)

 Copy code hover
[image]

Window.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Window object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Window.ID Property (Visio)

 Copy code hover
[image]

Window.ID Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ID of an object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ID

expression A variable that represents a Window object.

Return Value

Long

Remarks

For Window objects, the ID property can be used with the ItemFromID property of a Windows collection to retrieve a Window object from the collection without iterating through the collection. A Window object whose Type property is set to visAnchorBarBuiltIn returns an ID of visWinIDCustProp, visWinIDDrawingExplorer, visWinIDFormulaTracing, visWinIDMasterExplorer, visWinIDPanZoom, visWinIDSizePos, or visWinIDStencilExplorer. A Window object whose Type property is set to visAnchorBarAddon returns an ID that is unique within its Windows collection for the lifetime of that collection. If a Window object has an ID of visInvalWinID, you cannot use the ItemFromID property to retrieve the Window object from its collection.


Window.Index Property (Visio)

 Copy code hover
[image]

Window.Index Property (Visio)
Send feedback

Published: July 16, 2012

Gets the ordinal position of a Window object in the Windows collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Index

expression A variable that represents a Window object.

Return Value

Integer

Remarks

Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.


Window.InPlace Property (Visio)

 Copy code hover
[image]

Window.InPlace Property (Visio)
Send feedback

Published: July 16, 2012

Specifies whether a window is open in place, or whether a document is being viewed through a window that is open in place. Read-only.

Version Information

Version Added: Visio 2002

Syntax

expression .InPlace

expression A variable that represents a Window object.

Return Value

Boolean

Remarks

When the value of the InPlace property is True for a Window object, it means that the window is an in-place active window. It contains a document that is being edited in an OLE container application.


Window.IsEditingOLE Property (Visio)

 Copy code hover
[image]

Window.IsEditingOLE Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a drawing window contains an ActiveX control that has focus or an embedded or linked object that is being edited. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .IsEditingOLE

expression A variable that represents a Window object.

Return Value

Boolean


Window.IsEditingText Property (Visio)

 Copy code hover
[image]

Window.IsEditingText Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a text editing session is active in the drawing window. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .IsEditingText

expression A variable that represents a Window object.

Return Value

Boolean


Window.Master Property (Visio)

 Copy code hover
[image]

Window.Master Property (Visio)
Send feedback

Published: July 16, 2012

Gets the master that is displayed in a window. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Master

expression A variable that represents a Window object.

Return Value

Variant

Remarks

You can use the SubType property of the Window object to determine whether the Window object shows a master. If the Window object does not show a master, the Master property raises an exception.

If the Window object shows a master that is open for editing, the master returned is the temporary master being edited, not the original master that was opened for editing.


Window.MasterShortcut Property (Visio)

 Copy code hover
[image]

Window.MasterShortcut Property (Visio)
Send feedback

Published: July 16, 2012

Gets the master shortcut that is displayed in a window. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .MasterShortcut

expression A variable that represents a Window object.

Return Value

MasterShortcut


Window.MergeCaption Property (Visio)

 Copy code hover
[image]

Window.MergeCaption Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the abbreviated caption that appears on the page tab when the window is merged with other windows. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .MergeCaption

expression A variable that represents a Window object.

Return Value

String

Remarks

The MergeCaption property applies only to anchored windows. If the Window object is an MDI frame window, Microsoft Visio raises an exception.

Use the Type property to determine window type.


Window.MergeClass Property (Visio)

 Copy code hover
[image]

Window.MergeClass Property (Visio)
Send feedback

Published: July 16, 2012

Specifies a list of window classes that this anchored window can merge with. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .MergeClass

expression A variable that represents a Window object.

Return Value

String

Remarks

Use semicolons to separate individual items in the list. For example, if the MergeClass property returns a string that contains "123;789", it can merge with any windows that also contain "123" or "789" in its merge class list. Windows that have a merge class list that contains a zero-length string ("") can merge with other windows that contain a zero-length string ("") in their merge class list.

The MergeClass property applies only to anchored windows. If the Window object is an MDI frame window, Microsoft Visio raises an exception.

At present, windows of type visDocked can be merged only with other windows of type visDocked, and windows of type visAnchorBar can be merged only with other windows of type visAnchorBar.

Use the Type property to determine window type.


Window.MergeID Property (Visio)

 Copy code hover
[image]

Window.MergeID Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the string version of a merged window's globally unique identifier (GUID). Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .MergeID

expression A variable that represents a Window object.

Return Value

String

Remarks

If this Window object is not merged, the GUID will contain all zeros (GUID_NULL).

The MergeID property applies only to anchored windows. If the Window object is an MDI frame window, Microsoft Visio raises an exception.

Use the Type property to determine window type.


Window.MergePosition Property (Visio)

 Copy code hover
[image]

Window.MergePosition Property (Visio)
Send feedback

Published: July 16, 2012

Specifies the left-to-right tab position of a merged anchored window. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .MergePosition

expression A variable that represents a Window object.

Return Value

Long

Remarks

If there are n tabs, the leftmost position is 1 and the rightmost position is n. If the windows are merged in a docked stencil fashion, 1 is the topmost and n is the bottommost. A value of zero (0) means that the window is not merged.

The MergePosition property applies only to anchored windows. If the Window object is an MDI frame window, Microsoft Visio raises an exception.

Use the Type property to determine window type.


Window.ObjectType Property (Visio)

 Copy code hover
[image]

Window.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Window object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Window.Page Property (Visio)

 Copy code hover
[image]

Window.Page Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the page that is displayed in a window. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Page

expression A variable that represents a Window object.

Return Value

Variant

Remarks

You can set the Page property to a locale-independent page name (a universal name), a locale-specific page name (a local name), or a Page object.

If a window is not showing a page (perhaps because it is showing a master), the Page property returns Nothing. You can use the Type property of the Window object to determine whether the Window object is showing a page. Otherwise, the returned Variant refers to the Page object that the window is showing.

Beginning with Visio 5.0b, the Page property no longer returns an exception if a window is not showing a page; it returns Nothing. You can use the following code to handle both return values:

VBA Copy code Copy code
'Close Window(intCounter) if it is showing a page.
Set vsoWindow = Windows(intCounter)
On Error Resume Next
Set vsoPage = vsoWindow.Page

On Error GoTo 0

If Not vsoPage Is Nothing Then
 vsoWindow.Close
End If
Note Note

In versions of Visio through version 4.1, the Page property of a Window object returned an Object (as opposed to a Variant of type Object) and the Page property of a Window object accepted a String (as opposed to a Variant of type String). Because of changes in Automation support tools, the property was changed to accept and return a Variant. For backward compatibility, the PageAsObj and PageFromName properties were added. The PageAsObj and PageFromName properties have the same signatures and occupy the same vtable slots as did the prior version of the Page property.


Window.PageTabWidth Property (Visio)

 Copy code hover
[image]

Window.PageTabWidth Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the width of the page tab control in a drawing window. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .PageTabWidth

expression A variable that represents a Window object.

Return Value

Double

Remarks

The value of the PageTabWidth property is a percentage of the drawing window width, from 0 to 100. To use the default page tab control width, set the PageTabWidth property to -1.


Window.Parent Property (Visio)

 Copy code hover
[image]

Window.Parent Property (Visio)
Send feedback

Published: July 16, 2012

Determines the parent of an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Parent

expression A variable that represents a Window object.

Return Value

Windows

Remarks

In general, an object's parent is the object that contains it. For example, the parent of a Window object is the Windows collection that contains the Window object.


Window.ParentWindow Property (Visio)

 Copy code hover
[image]

Window.ParentWindow Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Window object that is the parent of another Window object. Read-only.

Version Information

Version Added: Visio 2000

Syntax

expression .ParentWindow

expression A variable that represents a Window object.

Return Value

Window

Remarks

ParentWindow returns nothing and raises no exception if the window is a top-level window. A top-level window is a member of the Windows collection of an Application object.

Use the Parent property of a Window object to get the Windows collection to which a Window object belongs.


Window.PersistsEvents Property (Visio)

 Copy code hover
[image]

Window.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Window object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Window.ReviewerMarkupVisible Property (Visio)

 Copy code hover
[image]

Window.ReviewerMarkupVisible Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether reviewer markup, for a particular reviewer or all reviewers, is visible in a Microsoft Visio window that displays a drawing page. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .ReviewerMarkupVisible(ReviewerID)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
ReviewerID | Optional | Long | The ID of a particular reviewer. If you do not pass a reviewer ID, the ReviewerMarkupVisible property value specifies visibility for all reviewers.

Return Value

Boolean

Remarks

Use the ReviewerMarkupVisible property to get and set the current status (visible or not) of reviewer markup, either for one or all reviewers, in a window that can display markup overlays. Setting the ReviewerMarkupVisible property corresponds to setting reviewer visibility status in the Show Markup Overlays section of the Reviewing task pane in the user interface. For example, setting ReviewerMarkupVisible to True without passing a value for ReviewerID is equivalent to clicking Show All in the Reviewing task pane. And setting ReviewerMarkupVisible to False while passing the ID of a particular reviewer is equivalent to clearing the box for that reviewer in the taskpane.

The ReviewerMarkupVisible property is enabled only when the parent window displays a Visio drawing page, and not another type of Visio window, such as a stencil or ShapeSheet window, for example.

When viewing markup is disabled in the user interface, setting the ReviewerMarkupVisible property is also disabled. If you attempt to set ReviewerMarkupVisible when viewing markup is disabled, Visio will display an error message. To be able to set ReviewerMarkupVisible, you must enable viewing markup by clicking Show Markup on the Review tab. Alternatively, you can enable viewing markup on existing markup overlays by changing the value of the ViewMarkup cell in the Document Properties section of the document's ShapeSheet. Use the following code:

VBA Copy code Copy code
ActiveDocument.DocumentSheet.CellsSRC(visSectionObject, visRowDoc, visDocViewMarkup).FormulaU = True

Example

This Microsoft Visual Basic for Applications (VBA) macro uses the ReviewerMarkupVisible property to get the current visibility status of reviewer markup for all reviewers in the active Visio drawing window. Then it switches the status to the opposite value. This example assumes that the active window contains markup overlays.

VBA Copy code Copy code
Public Sub ReviewerMarkupVisible_Example()

 ActiveWindow.Document.DocumentSheet.CellsSRC(visSectionObject, visRowDoc, visDocViewMarkup).FormulaU = True

 Debug.Print ActiveWindow.ReviewerMarkupVisible
 ActiveWindow.ReviewerMarkupVisible = Not ActiveWindow.ReviewerMarkupVisible
 Debug.Print ActiveWindow.ReviewerMarkupVisible

End Sub


Window.ScrollLock Property (Visio)

 Copy code hover
[image]

Window.ScrollLock Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether scrolling is disabled in a Microsoft Visio window. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .ScrollLock

expression A variable that represents a Window object.

Return Value

Boolean

Remarks

Scrolling (False) is the default Visio behavior. You can set the ScrollLock property to True to prevent scrolling in any Visio window, including docked stencil windows, but not including anchored windows.

The ScrollLock property setting is valid only for a given window at run time, and is not persisted (saved) in either the Visio document or the registry.


Window.SelectedCell Property (Visio)

 Copy code hover
[image]

Window.SelectedCell Property (Visio)
Send feedback

Published: July 16, 2012

Returns the selected cell in the ShapeSheet window. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .SelectedCell

expression A variable that represents a Window object.

Return Value

Cell

Remarks

The SelectedCell property applies only to ShapeSheet windows. If you try to access the SelectedCell property for any other type of window, Microsoft Visio returns the error message "Invalid window type for this action."

If a ShapeSheet row is selected (instead of a cell), SelectedCell returns Nothing. See the following example.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the SelectedCell property to print the name, section, row, column, and formula of the selected ShapeSheet cell in the Immediate window.

VBA Copy code Copy code
Public Sub SelectedCell_Example()

 Dim vsoCell As Visio.Cell

 Set vsoCell = Application.ActiveWindow.SelectedCell

 'If vsoCell is Nothing, a row is probably selected.
 If (Not vsoCell Is Nothing) Then
 Debug.Print "Cell Name: " & vsoCell.Name
 Debug.Print "Section: " & vsoCell.Section
 Debug.Print "Row: " & vsoCell.Row
 Debug.Print "Column: " & vsoCell.Column
 Debug.Print "Formula: " & vsoCell.Formula
 Else
 Debug.Print "vsoCell is Nothing--a row is probably selected."

 End If

End Sub


Window.SelectedDataRecordset Property (Visio)

 Copy code hover
[image]

Window.SelectedDataRecordset Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the data recordset that is displayed on the active tab of the External Data Window in the Microsoft Visio user interface (UI). Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .SelectedDataRecordset

expression An expression that returns a Window object.

Return Value

DataRecordset

Remarks

The SelectedDataRecordset property works only when the Window object represents the External Data Window. Calling the property on any other window type results in an error. The External Data Window must already be displayed in the Visio UI before you call SelectedDataRecordset.

When you set the SelectedDataRecordset property, the DataRecordset object you pass must not have been added with the visDataRecordsetNoExternalDataUI flag set.


Window.SelectedDataRowID Property (Visio)

 Copy code hover
[image]

Window.SelectedDataRowID Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the ID of the data row that is selected (or that is the primary row selected, when multiple rows are selected) on the active tab of the External Data Window in the Microsoft Visio user interface (UI). Read/write.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Version Information

Version Added: Visio 2007

Syntax

expression .SelectedDataRowID

expression An expression that returns a Window object.

Return Value

Long

Remarks

The SelectedDataRowID property works only when the Window object represents the External Data Window. Calling the property on any other window type results in an error. The External Data Window must already be displayed in the Visio UI before you call SelectedDataRowID.

Setting SelectedDataRowID clears the current selection and sets the selection to the row you specify.

If multiple rows are selected when you get SelectedDataRowID, the property returns the ID of the row that has the focus.


Window.SelectedMasters Property (Visio)

 Copy code hover
[image]

Window.SelectedMasters Property (Visio)
Send feedback

Published: July 16, 2012

Returns an array of the masters or master shortcuts selected in a Microsoft Visio stencil window. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .SelectedMasters

expression A variable that represents a Window object.

Return Value

Object()

Remarks

The SelectedMasters property applies only to stencil windows. If you try to access the SelectedMasters property for other types of window, Visio might return an error.

Example

This Microsoft Visual Basic for Applications (VBA) macro uses the SelectedMasters property to get the number of masters and master shortcuts selected in a stencil window and then prints the name of the stencil and the selected masters and master shortcuts in the Immediate window.

Before running this macro, make sure that at least one master or master shortcut is selected in a docked stencil in the active Visio window.

VBA Copy code Copy code
Sub SelectedMasters_Example()

 Dim vsoWindow As Visio.Window
 Dim aobjSelectedMasters() As Object
 Dim intNumberMasters As Integer
 Dim intNumberMasterShortCuts As Integer
 Dim vsoMaster As Visio.Master
 Dim vsoMasterShortcut As Visio.MasterShortcut
 intNumberMaster = 0
 intNumberMasterShortCuts = 0

 For Each vsoWindow In ActiveWindow.Windows

 If (vsoWindow.Type = visDockedStencilBuiltIn) Then
 aobjSelectedMasters = vsoWindow.SelectedMasters

 For intCounter = LBound(aobjSelectedMasters) To UBound(aobjSelectedMasters)
 On Error Resume Next
 Set vsoMaster = Nothing
 Set vsoMasterShortcut = Nothing
 Set vsoMaster = aobjSelectedMasters(intCounter)

 If Not vsoMaster Is Nothing Then
 intNumberMasters = intNumberMasters + 1
 Else
 Set vsoMasterShortcut = aobjSelectedMasters(intCounter)

 If Not vsoMasterShortcut Is Nothing Then
 intNumberMasterShortCuts = intNumberMasterShortCuts + 1
 End If

 End If

 Next

 If (intNumberMasters > 0 Or intNumberMasterShortCuts > 0) Then
 Debug.Print "The stencil " & vsoWindow.Document.Name
 Debug.Print "has" & Str(intNumberMasters) & " masters selected and "
 Debug.Print Str(intNumberMasterShortCuts) & " master shortcuts selected."
 Exit For
 End If

 End If

 Next

End Sub


Window.SelectedText Property (Visio)

 Copy code hover
[image]

Window.SelectedText Property (Visio)
Send feedback

Published: July 16, 2012

Returns the selected text in the Microsoft Visio drawing window as a Characters object. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .SelectedText

expression A variable that represents a Window object.

Return Value

Characters

Remarks

The SelectedText property applies only to drawing windows. If you try to access the SelectedText property for other types of window, Visio may return an error.


Window.SelectedValidationIssue Property (Visio)

 Copy code hover
[image]

Window.SelectedValidationIssue Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the validation issue that is selected in the Issues window. Read/write.

Version Information

Version Added: Visio 2010

Syntax

expression .SelectedValidationIssue

expression A variable that represents a Window object.

Return Value

ValidationIssue

Remarks

Attempting to get or set the SelectedValidationIssue property on a window other than the Issues window, or when the Issues window is closed, returns an error.

If multiple issues are selected in the Issues window, Visio returns the issue that has the focus.

If no issue is selected, Visio returns Nothing. By default, issues that you have specified to be ignored are not displayed. If you set the property to Nothing, Visio clears the selection in the Issues window.

Example

The following Visual Basic for Applications (VBA) example shows how to use the SelectedValidationIssue property to get the validation issue that is currently selected in the Issues window. If no issue is selected, the code displays a message box prompting the user to select an issue.

VBA Copy code Copy code
Set vsoIssuesWindow = Application.ActiveWindow.Windows.ItemFromID(Visio.VisWinTypes.visWinIDValidationIssues)

' If the Issues window is visible, find the selected validation issue.
    If vsoIssuesWindow.Visible Then
       Set vsoValidationIssue = vsoIssuesWindow.SelectedValidationIssue
    End If

' Respond to the case when no validation issue is selected.
    If vsoValidationIssue Is Nothing Then
        MsgBox "Please select an issue."
    End If


Window.Selection Property (Visio)

 Copy code hover
[image]

Window.Selection Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Selection object that represents what is presently selected in the window, or assigns a selection created by the CreateSelection method to a Selection object. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Selection

expression A variable that represents a Window object.

Return Value

Selection

Remarks

The Selection object is independent of the selection in the window, which can subsequently change as a result of user actions.

A Selection object is a set of shapes in a common context on which you can perform actions. A Selection object is analogous to more than selected shapes in a drawing window. Once you set or retrieve a Selection object, you can change the set of shapes the object represents by using the Select method.

After you use the CreateSelection method to create a selection, you can then use the Selection property to actually display the newly created selection in the Microsoft Visio drawing window. See the second example that follows.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Selection property to get all the selected shapes in the window.

VBA Copy code Copy code
Public Sub Selection_Example()

 Const MAX_SHAPES = 6
 Dim vsoShapes(1 To MAX_SHAPES) As Visio.Shape
 Dim vsoSelection As Visio.Selection
 Dim intCounter As Integer

 'Draw six rectangles.
 For intCounter = 1 To MAX_SHAPES
 Set vsoShapes(intCounter) = ActivePage.DrawRectangle(intCounter, intCounter + 1, intCounter + 1, intCounter)
 Next intCounter

 'Deselect all the shapes in the active window.
 ActiveWindow.DeselectAll

 'Select all the shapes in the active window.
 ActiveWindow.SelectAll

 'Get the selected shapes and assign them to a Selection object.
 Set vsoSelection = ActiveWindow.Selection

End Sub

This VBA macro shows how to use the CreateSelection method to select all shapes on a particular layer. Then it uses the Selection property to display the selection in the Visio drawing window.

Before running this macro, create two layers in your drawing, one named "a" and one named "b", and then add shapes to both layers.

VBA Copy code Copy code
Public Sub Selection_Example_2()

 Dim vsoLayer As Layer
 Dim vsoSelection As Visio.Selection

 Set vsoLayer = ActivePage.Layers.ItemU("a")
 Set vsoSelection = ActivePage.CreateSelection(visSelTypeByLayer, visSelModeSkipSuper, VsoLayer)

 Application.ActiveWindow.Selection = vsoSelection

End Sub


Window.SelectionForDragCopy Property (Visio)

 Copy code hover
[image]

Window.SelectionForDragCopy Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Selection object that represents the collection of shapes that will participate in drag or copy operations, based on the current selection. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .SelectionForDragCopy

expression A variable that represents a Window object.

Return Value

Selection

Remarks

The Selection object that SelectionForDragCopy returns includes any unselected members of selected containers and lists, and unselected callouts associated with selected target shapes; all of these will also participate in the drag or copy operation.


Window.Shape Property (Visio)

 Copy code hover
[image]

Window.Shape Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Shape object that owns a Cell, Characters, Row, or Section object or that is associated with a Hyperlink or OLEObject object or with the Hyperlinks collection. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Shape

expression A variable that represents a Window object.

Return Value

Shape

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Shape property to get the Shape objects that own a Cell and a Characters object.

VBA Copy code Copy code

Public Sub Shape_Example()

 Dim vsoRectangle As Visio.Shape
 Dim vsoOval As Visio.Shape
 Dim vsoShapeFromCell As Visio.Shape
 Dim vsoShapeFromCharacters As Visio.Shape
 Dim vsoCell As Visio.Cell
 Dim vsoCharacters As Visio.Characters

 'Create 2 different shapes and add different text to each shape.
 Set vsoRectangle = ActivePage.DrawRectangle(2, 3, 5, 4)
 Set vsoOval = ActivePage.DrawOval(2, 5, 5, 7)
 vsoRectangle.Text = "Rectangle Shape"
 vsoOval.Text = "Oval Shape"

 'Get a Cell object from the first shape.
 Set vsoCell = vsoRectangle.Cells("Width")

 'Get a Characters object from the second shape.
 Set vsoCharacters = vsoOval.Characters

 'Use the Shape property to get the Shape object.
 Set vsoShapeFromCell = vsoCell.Shape
 Set vsoShapeFromCharacters = vsoCharacters.Shape

 'Use each shape's text to verify the proper Shape
 'object was returned.
 Debug.Print vsoShapeFromCell.Text
 Debug.Print vsoShapeFromCharacters.Text

End Sub


Window.ShowConnectPoints Property (Visio)

 Copy code hover
[image]

Window.ShowConnectPoints Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether connection points are shown in a window. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .ShowConnectPoints

expression A variable that represents a Window object.

Return Value

Integer

Remarks

Setting the ShowConnectPoints property is equivalent to selecting Connection Points in the Visual Aids group on the View tab.


Window.ShowGrid Property (Visio)

 Copy code hover
[image]

Window.ShowGrid Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a grid is shown in a window. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .ShowGrid

expression A variable that represents a Window object.

Return Value

Integer

Remarks

Setting the ShowGrid property is equivalent to selecting Grid in the Show/Hide group on the View tab.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ShowGrid property to hide the grid. To restore the grid after running this macro, set the ShowGrid property to True.

VBA Copy code Copy code

Public Sub ShowGrid_Example()

 'Check whether active window is a drawing window.
 If ActiveWindow.Type = visDrawing Then

 'Hide the grid.
 ActiveWindow.ShowGrid = False

 Else

 'Tell the user why you are not hiding the grid.
 MsgBox "Active window is not a drawing window.", vbOKOnly, "Show Grid"

 End If

End Sub


Window.ShowGuides Property (Visio)

 Copy code hover
[image]

Window.ShowGuides Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether guides are shown in a window. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .ShowGuides

expression A variable that represents a Window object.

Return Value

Integer

Remarks

Setting the ShowGuides property is equivalent to selecting Guides in the Show/Hide group on the View tab.


Window.ShowPageBreaks Property (Visio)

 Copy code hover
[image]

Window.ShowPageBreaks Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether page breaks are shown in a window. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .ShowPageBreaks

expression A variable that represents a Window object.

Return Value

Integer

Remarks

Setting the ShowPageBreaks property is equivalent to selecting Page Breaks in the Show/Hide group on the View tab.


Window.ShowPageOutline Property (Visio)

 Copy code hover
[image]

Window.ShowPageOutline Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether the drawing page outline is displayed in the Microsoft Visio drawing window. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .ShowPageOutline

expression A variable that represents a Window object.

Return Value

Boolean

Remarks

The default value is True (the page outline is displayed), which is also the default Visio behavior. You can use the ShowPageOutline property to prevent display of the page outline in any Visio drawing window, including page, master, and group windows. Attempting to set ShowPageOutline for other windows, including stencil windows, ShapeSheet windows, and icon windows, will throw an exception.

Setting ShowPageOutline to False does not hide the page grid. To hide the grid, use the Window.ShowGrid property.

The ShowPageOutline property setting is valid only for a given window at run time, and is not persisted (saved) in either the Visio document or the Windows registry.


Window.ShowPageTabs Property (Visio)

 Copy code hover
[image]

Window.ShowPageTabs Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether page tab controls are shown in the drawing window. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .ShowPageTabs

expression A variable that represents a Window object.

Return Value

Boolean


Window.ShowRulers Property (Visio)

 Copy code hover
[image]

Window.ShowRulers Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether rulers are shown in the drawing window. Read/write.

Version Information

Version Added: Visio 4.5

Syntax

expression .ShowRulers

expression A variable that represents a Window object.

Return Value

Integer

Remarks

Setting the ShowRulers property is the same as selecting Ruler in the Show/Hide group on the View tab.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ShowRulers property to switch display of the rulers on and off.

VBA Copy code Copy code

Public Sub ShowRulers_Example()

 'Check whether the active window is a drawing window.
 If ActiveWindow.Type = visDrawing Then

 'Switch the rulers on or off.
 ActiveWindow.ShowRulers = Not ActiveWindow.ShowRulers

 Else

 'Tell the user why you are not switching the rulers.
 MsgBox "Active window is not a drawing window.", _
 vbOKOnly, "Show/Hide Rulers"

 End If

End Sub


Window.ShowScrollBars Property (Visio)

 Copy code hover
[image]

Window.ShowScrollBars Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether scroll bars are shown in the drawing window. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .ShowScrollBars

expression A variable that represents a Window object.

Return Value

Integer

Remarks

The ShowScrollBars property value can be any combination of the following VisScrollbarStates constants, which are declared in the Visio type library. The default value is visScrollBarBoth, which shows both horizontal and vertical scroll bars.

Constant | Value
visScrollBarNeither | &H0
visScrollBarHoriz | &H1
visScrollBarVert | &H4
visScrollBarBoth | &H5


Window.Stat Property (Visio)

 Copy code hover
[image]

Window.Stat Property (Visio)
Send feedback

Published: July 16, 2012

Returns status information for an object. Read-only.

Version Information

Version Added: Visio 3.0

Syntax

expression .Stat

expression A variable that represents a Window object.

Return Value

Integer

Remarks

If an object is a reference to an entity in a document, and if that document closes, the Stat property returns a value in which the visStatClosed bit is set.

If an object is a reference to an entity that has been deleted, the Stat property returns a value in which the visStatDeleted bit is set.

A Component Object Model (COM) object, such as a Microsoft Visio Document object, lives as long as it is held (pointed to) by a client, even if the object is logically in a deleted or closed state.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Stat property to check the status of a Document object. Executing the macro prints 0 (visStatNormal) and then 8 (visStatClosed) in the Immediate window.

VBA Copy code Copy code

Public Sub Stat_Example()

 Dim vsoDocument As Visio.Document
 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.Stat
 vsoDocument.Close
 Debug.Print vsoDocument.Stat

End Sub


Window.SubType Property (Visio)

 Copy code hover
[image]

Window.SubType Property (Visio)
Send feedback

Published: July 16, 2012

Returns the subtype of a Window object that represents a drawing window. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .SubType

expression A variable that represents a Window object.

Return Value

Integer

Remarks

If the Type property of a Window object returns any value other than visDrawing, the SubType property returns the same value as the Type property. If the Type property of a Window object returns visDrawing, the SubType property returns one of the following values.

Constant | Value | Description
visPageWin | 128 | A drawing window showing a page.
visPageGroupWin | 160 | A group editing window of a group on a page.
visMasterWin | 64 | A master drawing page window.
visMasterGroupWin | 96 | A group editing window of a group in a master.


Window.Type Property (Visio)

 Copy code hover
[image]

Window.Type Property (Visio)
Send feedback

Published: July 16, 2012

Returns the type of the object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Type

expression A variable that represents a Window object.

Return Value

Integer

Remarks

Type value constants for Window objects (the possible values that the Type property of a Window object returns) are declared by the Visio type library in VisWinTypes.

If a Window object is type visDrawing, use the SubType property to determine the type of drawing window represented by the object.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Type property to determine the type of a window.

VBA Copy code Copy code

Public Sub Type_Example()

 Dim vsoMaster As Visio.Master
 Dim vsoShape As Visio.Shape
 Dim vsoIconWindow As Visio.Window
 Dim vsoShapeSheetWindow As Visio.Window
 Dim vsoStencilWindow As Visio.Window

 'Draw a shape.
 Set vsoShape = ActivePage.DrawRectangle(1, 1, 2, 3)

 'Open the document stencil window.
 Set vsoStencilWindow = ThisDocument.OpenStencilWindow

 'Open the ShapeSheet window of vsoShape.
 Set vsoShapeSheetWindow = vsoShape.OpenSheetWindow

 'Add a master to the document stencil and open its icon editing window.
 Set vsoMaster = ThisDocument.Masters.Add
 Set vsoIconWindow = vsoMaster.OpenIconWindow

 'Use the Type property to verify each window's type.
 'This will print 7, 3, and 4 in the Immediate window to indicate
 'a docked, built-in stencil window; a ShapeSheet window; and an
 'icon editing window, respectively.
 Debug.Print vsoStencilWindow.Type
 Debug.Print vsoShapeSheetWindow.Type
 Debug.Print vsoIconWindow.Type

End Sub


Window.ViewFit Property (Visio)

 Copy code hover
[image]

Window.ViewFit Property (Visio)
Send feedback

Published: July 16, 2012

Determines which auto-fit mode a window is in, if any. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .ViewFit

expression A variable that represents a Window object.

Return Value

Long

Remarks

The ViewFit property applies to drawing windows only, and can have the following values.

Constant | Value
visFitNone | 0
visFitPage | 1
visFitWidth | 2

If the value of the window's Type property is not visDrawing, the ViewFit property returns visFitNone. Attempting to set the ViewFit property of this type of window raises an exception.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindow.ViewFit


Window.Visible Property (Visio)

 Copy code hover
[image]

Window.Visible Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether a window is visible. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .Visible

expression A variable that represents a Window object.

Return Value

Boolean

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindow.Visible


Window.WindowHandle32 Property (Visio)

 Copy code hover
[image]

Window.WindowHandle32 Property (Visio)
Send feedback

Published: July 16, 2012

Returns the 32-bit handle of a Microsoft Visio window. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .WindowHandle32

expression A variable that represents a Window object.

Return Value

Long

Remarks

The WindowHandle32 property of an Application object returns one of the following:

  • The HWND for the main Visio (frame) window (most common).

  • The HWND for the container application's main frame window if Visio is running in-place and active.

  • The HWND for the window returned by the GetActiveWindow() function if either frame window is disabled (for example, if a modal dialog box is running). For details about the GetActiveWindow function, see the Microsoft Platform SDK on the Microsoft Developer Network (MSDN) Web site.

Use the WindowHandle32 property of the Window object to obtain the HWND for a window in the Windows collection of a Visio instance.

You can use the obtained HWND in Windows API calls.

Note Note

Calls to the WindowHandle property (now hidden) are directed to the WindowHandle32 property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to get the 32-bit handle of a window.

VBA Copy code Copy code

Public Sub WindowHandle32_Example()

 Dim vsoWindow As Visio.Window
 Dim lngWindowHandle32 As Long

 'Get the active window.
 Set vsoWindow = ActiveWindow

 'Get the 32-bit handle of the active window.
 lngWindowHandle32 = vsoWindow.WindowHandle32

 'Verify that you got the handle.
 Debug.Print "The active window handle is"; lngWindowHandle32

End Sub


Window.Windows Property (Visio)

 Copy code hover
[image]

Window.Windows Property (Visio)
Send feedback

Published: July 16, 2012

Returns the Windows collection for a Microsoft Visio instance or window. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Windows

expression A variable that represents a Window object.

Return Value

Windows

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindow.Windows

Example

This Microsoft Visual Basic macro gets the Windows collection of the Application object and prints the ID of each window in the collection in the Immediate window.

VBA Copy code Copy code
Public Sub Windows_Example()

    Dim vsoApplication As Visio.Application
    Dim vsoWindows As Visio.Windows
    Dim intCounter As Integer

    'Get the Windows collection.
    Set vsoApplication = Application
    Set vsoWindows = vsoApplication.Windows

    For intCounter = 1 To vsoWindows.Count
        Debug.Print vsoWindows.Item(intCounter).ID
    Next intCounter

End Sub


Window.WindowState Property (Visio)

 Copy code hover
[image]

Window.WindowState Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the state of a window. Read/write.

Version Information

Version Added: Visio 2000

Syntax

expression .WindowState

expression A variable that represents a Window object.

Return Value

Long

Remarks

The WindowState property value can be a combination of the constants declared in the Visio type library in VisWindowStates.

Note Note

The nFlags parameter to the Add method for the Windows collection can be composed of the various bits of VisWindowStates.

If you specify conflicting bits, only one bit is used. For example, if you specify both visWSMaximized and visWSMinimized, the window is maximized.

The visWSVisible flag is ignored when setting the state of a window with the WindowState property. It is used in calls to the Add method for the Windows collection. Use the Visible property of the window to show or hide it. The visWSVisible flag is available only when this property is read.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindow.WindowState

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to minimize the active drawing window.

VBA Copy code Copy code
Public Sub WindowState_Example()

    Dim vsoWindow As Visio.Window

    'Get the active window.
    Set vsoWindow = ActiveWindow

    'Minimize the active window.
    vsoWindow.WindowState = visWSMinimized

End Sub


Window.Zoom Property (Visio)

 Copy code hover
[image]

Window.Zoom Property (Visio)
Send feedback

Published: July 16, 2012

Gets or sets the current display size (magnification factor) for a page in a window. Read/write.

Version Information

Version Added: Visio 2.0

Syntax

expression .Zoom

expression A variable that represents a Window object.

Return Value

Double

Remarks

Valid values range from 0.05 to 9.99 (5% to 999%). The value -1 fits the page into the window. The default value is .67, which is equivalent to the Whole Page setting in the Zoom dialog box (on the View tab, in the Zoom group, click Zoom).


Window.ZoomBehavior Property (Visio)

 Copy code hover
[image]

Window.ZoomBehavior Property (Visio)
Send feedback

Published: July 16, 2012

Determines the zoom behavior for a Microsoft Visio document or window. Read/write.

Version Information

Version Added: Visio 2002

Syntax

expression .ZoomBehavior

expression A variable that represents a Window object.

Return Value

VisZoomBehavior

Remarks

To set the zoom behavior for all new documents and windows, use the DefaultZoomBehavior property.

The following constants declared by the Visio type library in VisZoomBehavior are valid values forZoomBehavior.

Constant | Value | Description
visZoomNone | 0 | Undefined zoom behavior; use the zoom behavior of the document or application. This is the default.
visZoomInPlaceContainer | 1 | The container performs the zoom.
visZoomVisio | 2 | Visio performs the zoom.
visZoomVisioExact | 4 | Visio zooms when open in place; Visio does not adjust the zoom level

If ZoomBehavior is set to visZoomVisio, Visio adjusts the zoom level to certain discrete values, for example 50% or 100%, to optimize the appearance of the page rulers and grid, and of snap behavior.

If ZoomBehavior is set to visZoomInPlaceContainer, Visio uses the container's IOleCommandTarget interface to perform the zoom and forces a fit-to-window zoom within the in-place window. If the container does not support IOleCommandTarget, no zooming occurs.

If ZoomBehavior is set to visZoomVisioExact, you can set the zoom to any value, either by using the Window.Zoom property or by using the Zoom slider in the Visio user interface.

Note Note

The default behavior (visZoomNone) is different from the behavior used in versions earlier than Visio 2002. (In Visio 2002, the default was visZoomVisio.) To replicate the behavior seen in earlier versions, set this value to visZoomInPlaceContainer.

Example

The following procedure shows how to set the Document.ZoomBehavior property to the value that replicates Visio 2000 behavior.

VBA Copy code Copy code
Sub ZoomBehavior_Example()

 ActiveDocument.ZoomBehavior = visZoomInPlaceContainer

End Sub


Window.ZoomLock Property (Visio)

 Copy code hover
[image]

Window.ZoomLock Property (Visio)
Send feedback

Published: July 16, 2012

Determines whether zooming is disabled in a Microsoft Visio drawing window. Read/write.

Version Information

Version Added: Visio 2003

Syntax

expression .ZoomLock

expression A variable that represents a Window object.

Return Value

Boolean

Remarks

Zooming (False) is the default Visio behavior. You can use the ZoomLock property to prevent zooming in any Visio drawing window, including page, master, and group windows. Attempting to set the ZoomLock for other windows, including stencil windows, ShapeSheet windows, and icon windows, will throw an exception.

The ZoomLock property setting is valid only for a given window at run time, and is not persisted (saved) in either the Visio document or the registry.


Window Methods (Visio)

 Copy code hover
[image]

Window Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates a window.
CenterViewOnShape | Pans the Microsoft Visio drawing window to place the specified shape in the center of the view.
Close | Closes a window.
DeselectAll | Deselects all shapes in a window or selection.
DockedStencils | Returns the names of all stencils docked in a Microsoft Visio drawing window.
GetViewRect | Returns the page coordinates of a window's borders.
GetWindowRect | Gets the size and position of the client area of a window.
NewWindow | Opens a new Microsoft Visio window.
Scroll | Scrolls the contents of a window vertically, horizontally, or both.
ScrollViewTo | Scrolls a window to a particular page coordinate.
Select | Selects or clears an object.
SelectAll | Selects all possible shapes in a window or selection.
SetViewRect | Sets the page coordinates of a window's borders by adjusting the zoom level and center scroll position.
SetWindowRect | Sets the size and position of the client area of a window.


Window.Activate Method (Visio)

 Copy code hover
[image]

Window.Activate Method (Visio)
Send feedback

Published: July 16, 2012

Activates a window.

Version Information

Version Added: Visio 2.0

Syntax

expression .Activate

expression An expression that returns a Window object.

Return Value

Nothing

Remarks

Microsoft Visio can have more than one window open at a time; however, only one window is active. Activating a window can change the objects returned by the ActiveWindow, ActivePage, and ActiveDocument properties.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindow.Activate()

Example

The following macro creates two windows and then shows how to activate one of the windows.

VBA Copy code Copy code
Public Sub Activate_Example()

    Dim vsoDocument As Visio.Document
    Dim vsoWindow As Visio.Window

    'Create two new windows by adding documents.
    Set vsoDocument = Documents.Add("")
    Set vsoWindow = ActiveWindow
    Set vsoDocument = Documents.Add("")

    'Use the Activate method to make the first
    'window created the active window.
    vsoWindow.Activate

End Sub


Window.CenterViewOnShape Method (Visio)

 Copy code hover
[image]

Window.CenterViewOnShape Method (Visio)
Send feedback

Published: July 16, 2012

Pans the Microsoft Visio drawing window to place the specified shape in the center of the view.

Version Information

Version Added: Visio 2010

Syntax

expression .CenterViewOnShape(SheetObject, Flags)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
SheetObject | Required | Shape | The shape to center in the view.
Flags | Required | VisCenterViewFlags | The centering behavior to apply.

Return Value

Nothing

Remarks

The Flags parameter value must be combination of one of more of the following VisCenterViewFlags constants.

Constant | Value | Description
visCenterViewDefault | 0 | Display the page that contains the specified shape and center the view on the shape.
visCenterViewIfOffScreen | 1 | Center the view only if the shape is currently off screen.
visCenterViewSelectShape | 2 | Also select the shape.

If the specified shape is not valid, Microsoft Visio returns an Invalid Parameter error.


Window.Close Method (Visio)

 Copy code hover
[image]

Window.Close Method (Visio)
Send feedback

Published: July 16, 2012

Closes a window.

Version Information

Version Added: Visio 2.0

Syntax

expression .Close

expression A variable that represents a Window object.

Return Value

Nothing

Remarks

If the indicated window is the only window open for a document and the document contains unsaved changes, an alert appears asking if you want to save the document. You can use the AlertResponse property to prevent the alert from appearing.

If you close a docked stencil window, only that window is closed. However, if you close a drawing window that contains docked stencils, the docked stencil window is also closed.

Example

This example shows how to close all open ShapeSheet windows. It assumes at least one ShapeSheet window is open in Microsoft Visio.

VBA Copy code Copy code

Public Sub Close_Example()
 Dim intCounter As Integer
 intCounter = Windows.Count

 'Close all ShapeSheet windows that are open.
 While intCounter <> 0
 If Windows(intCounter).Type = visSheet Then
 Windows(intCounter).Close
 intCounter = Windows.Count
 Else
 intCounter = intCounter - 1
 End If
 Wend
End Sub


Window.DeselectAll Method (Visio)

 Copy code hover
[image]

Window.DeselectAll Method (Visio)
Send feedback

Published: July 16, 2012

Deselects all shapes in a window or selection.

Version Information

Version Added: Visio 2.0

Syntax

expression .DeselectAll

expression A variable that represents a Window object.

Return Value

Nothing

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindow.DeselectAll()


Window.DockedStencils Method (Visio)

 Copy code hover
[image]

Window.DockedStencils Method (Visio)
Send feedback

Published: July 16, 2012

Returns the names of all stencils docked in a Microsoft Visio drawing window.

Version Information

Version Added: Visio 4.5

Syntax

expression .DockedStencils(NameArray())

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
NameArray() | Required | String | Out parameter. An array that receives the names of stencils docked in a window.

Return Value

Nothing

Remarks

The DockedStencils method returns an array of strings—the names of the stencils shown in the docked stencil panes of a window. When the window is a drawing window, the number of docked stencil panes (n) is equal to or greater than zero, and n is zero when the window isn't a drawing window.

If the DockedStencils method succeeds, NameArray() returns a one-dimensional array of n strings indexed from zero (0) to n - 1. The NameArray() paramter is an out parameter that is allocated by the DockedStencils method, ownership of which is passed back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. The DockedStencils method fails if NameArray() is null. (Microsoft Visual Basic and Visual Basic for Applications take care of destroying the array for you.)

If strStencilName is the string returned by NameArray(StencilName), Documents.Item(strStencilName) succeeds and returns a Document object representing the stencil.

Example

The following Microsoft Visual Basic for Applications macro shows how to use the DockedStencils method to get the document names of all the stencils docked in the active window. It also prints, in the Immediate window, the name of the active document and the lower and upper bounds of the array that holds the stencil names, and then it lists the stencil names and paths, also in the Immediate window.

VBA Copy code Copy code

Public Sub DockedStencils_Example()

 Dim astrStencilNames() As String
 ActiveWindow.DockedStencils astrStencilNames

 Dim intLowerBound As Integer
 Dim intUpperBound As Integer
 Dim intIndex As Integer

 intLowerBound = LBound(astrStencilNames)
 intUpperBound = UBound(astrStencilNames)
 Debug.Print "Active document: " ActiveWindow.Document; " Lower bound:"; intLowerBound; " Upper Bound:"; intUpperBound

 intIndex = intLowerBound
 While intIndex <= intUpperBound
 Debug.Print astrStencilNames(intIndex)
 intIndex = intIndex + 1
 Wend

End Sub


Window.GetViewRect Method (Visio)

 Copy code hover
[image]

Window.GetViewRect Method (Visio)
Send feedback

Published: July 16, 2012

Returns the page coordinates of a window's borders.

Version Information

Version Added: Visio 5.0

Syntax

expression .GetViewRect(pdLeft, pdTop, pdWidth, pdHeight)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
pdLeft | Required | Double | The coordinate in page units of the left side of the window.
pdTop | Required | Double | The coordinate in page units of the top of the window.
pdWidth | Required | Double | The distance in page units from the left side to the right side of the window.
pdHeight | Required | Double | The distance in page units from the top to the bottom of the window.

Return Value

Nothing

Remarks

The values that the GetViewRect method returns are affected by whether page tabs and rulers are displayed on the Microsoft Visio drawing page.

If the Window object is not a visDrawing type, the GetViewRect method raises an exception.


Window.GetWindowRect Method (Visio)

 Copy code hover
[image]

Window.GetWindowRect Method (Visio)
Send feedback

Published: July 16, 2012

Gets the size and position of the client area of a window.

Version Information

Version Added: Visio 2000

Syntax

expression .GetWindowRect(pnLeft, pnTop, pnWidth, pnHeight)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
pnLeft | Required | Long | The coordinate of the left side of the window.
pnTop | Required | Long | The coordinate of the top of the window.
pnWidth | Required | Long | The distance in pixels from the left side to the right side of the window.
pnHeight | Required | Long | The distance in pixels from the top to the bottom of the window.

Return Value

Nothing

Remarks

The GetWindowRect method gets the size and position of the client area of the window with respect to the window that owns the Windows collection to which it belongs. For the Windows collection of an Application object, the "with respect to" window is the MDICLIENT window of the Microsoft Visio main window. For the Windows collection of a Window object, the "with respect to" window is the client area of the drawing window.

Example

The following example shows how to use the GetWindowRect method to get the size and position of a Window object. It opens the Pan & Zoom window and prints the window's coordinates, width, and height in the Immediate window.

VBA Copy code Copy code
Public Sub GetWindowRect_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoPZWindow As Visio.Window
 Dim pinLeft As Long, pinTop As Long, pinWidth As Long, pinHeight As Long

 Set vsoApplication = Visio.Application

 'Display the Pan & Zoom window
 Set vsoPZWindow = vsoApplication.ActiveWindow.Windows.ItemFromID(visWinIDPanZoom)
 vsoPZWindow.Visible = True

 'Get the existing window size and position
 vsoPZWindow.GetWindowRect pinLeft, pinTop, pinWidth, pinHeight
 Debug.Print pinLeft, pinTop, pinWidth, pinHeight

 'Change the window height and get the new values
 vsoPZWindow.SetWindowRect pinLeft, pinTop, pinWidth, pinHeight + 50
 vsoPZWindow.GetWindowRect pinLeft, pinTop, pinWidth, pinHeight
 Debug.Print pinLeft, pinTop, pinWidth, pinHeight

End Sub


Window.Group Method (Visio)

 Copy code hover
[image]

Window.Group Method (Visio)
Send feedback

Published: July 16, 2012

This object, member, or enumeration is deprecated and is not intended to be used in your code. Groups the objects that are selected in a selection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Group

expression A variable that represents a Window object.

Remarks

The Window object's Group method is now obsolete. Use the Group method of the Selection or Shape object.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindow.Group()


Window.NewWindow Method (Visio)

 Copy code hover
[image]

Window.NewWindow Method (Visio)
Send feedback

Published: July 16, 2012

Opens a new Microsoft Visio window.

Version Information

Version Added: Visio 2003

Syntax

expression .NewWindow

expression A variable that represents a Window object.

Return Value

Window

Remarks

Calling the NewWindow method is the equivalent of clicking New Window in the Window group on the View tab in the user interface. The NewWindow method works only on top-level mutliple-document interface (MDI) windows. The properties and caption of the new window are all determined by Visio, so the caller cannot specify any arguments to the NewWindow call. The new window's caption is the same as that of the existing one from which it was opened, but it is distinguished by a colon and a sequential number. For example, if the existing window is a drawing window that is captioned Drawing1, the new window is captioned Drawing1:2. In addition, the existing window's caption is changed to Drawing1:1.

The NewWindow method opens a new window of the same type as the instance of the parent object. In other words, if the parent object is a drawing window, calling NewWindow opens another drawing window, while if is a ShapeSheet window, calling NewWindow opens another ShapeSheet window.

Note Note

The NewWindow method is not available for the Microsoft Visio Drawing Control.


Window.Paste Method (Visio)

 Copy code hover
[image]

Window.Paste Method (Visio)
Send feedback

Published: July 16, 2012

This object, member, or enumeration is deprecated and is not intended to be used in your code. Pastes the contents of the Clipboard into an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Paste

expression A variable that represents a Window object.

Remarks

The Window object's Paste method is now obsolete. Use the Paste or PasteSpecial method of the Page, Master, or Shape object. (Use the Shape object in the case of group shapes.)

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindow.Paste()


Window.Scroll Method (Visio)

 Copy code hover
[image]

Window.Scroll Method (Visio)
Send feedback

Published: July 16, 2012

Scrolls the contents of a window vertically, horizontally, or both.

Version Information

Version Added: Visio 2000

Syntax

expression .Scroll(nxFlags, nyFlags)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
nxFlags | Required | Long | Indicates how to scroll horizontally.
nyFlags | Required | Long | Indicates how to scroll vertically.

Return Value

Nothing

Remarks

If the Window object is not a built-in MDI or built-in docked stencil type, the Scroll method raises an exception.

Constants representing ways to scroll horizontally are declared by the Visio type library in VisWindowScrollX, and constants representing ways to scroll vertically are declared in VisWindowScrollY.


Window.ScrollViewTo Method (Visio)

 Copy code hover
[image]

Window.ScrollViewTo Method (Visio)
Send feedback

Published: July 16, 2012

Scrolls a window to a particular page coordinate.

Version Information

Version Added: Visio 2000

Syntax

expression .ScrollViewTo(x, y)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Double | The x-coordinate to which to scroll.
y | Required | Double | The y-coordinate to which to scroll.

Return Value

Nothing

Remarks

The ScrollViewTo method scrolls to the x and y coordinates.

If the value of the Window object's Type property is not visDrawing, the method raises an exception.


Window.Select Method (Visio)

 Copy code hover
[image]

Window.Select Method (Visio)
Send feedback

Published: July 16, 2012

Selects or clears an object.

Version Information

Version Added: Visio 2.0

Syntax

expression .Select(SheetObject, SelectAction)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
SheetObject | Required | [IVSHAPE] | An expression that returns a Shape object to select or clear.
SelectAction | Required | Integer | The type of selection action to take.

Return Value

Nothing

Remarks

When used with the Window object, the Select method will affect the selection in the Microsoft Visio window. The Selection object, however, is independent of the selection in the window. Therefore, using the Select method with a Selection object only affects the state of the object in memory; the Visio window is unaffected.

The following constants declared by the Visio type library in VisSelectArgs show valid values for selection types.

Constant | Value | Description
visDeselect | 1 | Cancels the selection of a shape but leaves the rest of the selection unchanged.
visSelect | 2 | Selects a shape but leaves the rest of the selection unchanged.
visSubSelect | 3 | Selects a shape whose parent is already selected.
visSelectAll | 4 | Selects a shape and all its peers.
visDeselectAll | 256 | Cancels the selection of a shape and all its peers.

If SelectAction is visSubSelect, the parent shape of SheetObject must already be selected.

You can combine visDeselectAll with visSelect and visSubSelect to clear all shapes prior to selecting or subselecting other shapes.

If the object being operated on is a Selection object, and if the Select method selects a Shape object whose ContainingShape property is different from the ContainingShape property of the Selection object, the Select method clears everything, even if the selection type value does not specify canceling the selection.

If the object being operated on is a Window object, and if SelectAction is not visSubSelect, the parent shape of SheetObject must be the same shape as that returned by the ContainingShape property of the Window.Selection object.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this method maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindow.Select(Microsoft.Office.Interop.Visio.Shape, short)

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to select, clear, and subselect shapes.

VBA Copy code Copy code

Public Sub Select_Example()

    Const MAX_SHAPES = 6
    Dim vsoShapes(1 To MAX_SHAPES) As Visio.Shape
    Dim intCounter As Integer

    'Draw six rectangles.
    For intCounter = 1 To MAX_SHAPES
        Set vsoShapes(intCounter) = ActivePage.DrawRectangle(intCounter, intCounter + 1, intCounter + 1, intCounter)
    Next intCounter

    'Cancel the selection of all the shapes on the page.
    ActiveWindow.DeselectAll

     'Create a Selection object.
    Dim vsoSelection As Visio.Selection
    Set vsoSelection = ActiveWindow.Selection

    'Select the first three shapes on the page.
    For intCounter = 1 To 3
        vsoSelection.Select vsoShapes(intCounter), visSelect
    Next intCounter

    'Group the selected shapes.
    'Although the first three shapes are now grouped, the
    'array vsoShapes() still contains them.
    Dim vsoGroup As Visio.Shape
    Set vsoGroup = vsoSelection.Group

    'There are now four shapes on the page—a group that contains three
    'subshapes, and three ungrouped shapes. Subselection is
    'accomplished by selecting the parent shape first or one of the
    'group's shapes already subselected.

    'Select parent (group) shape.
    ActiveWindow.Select vsoGroup, visDeselectAll + visSelect

    'Subselect two of the shapes in the group.
    ActiveWindow.Select vsoShapes(1), visSubSelect
    ActiveWindow.Select vsoShapes(3), visSubSelect

     'At this point two shapes are subselected, but we want to
    'start a new selection that includes the last two shapes
    'added to the page and the group.

    'Note that the subselections that were made in the group
    'are canceled by selecting another shape that is
    'at the same level as the parent of the subselected shapes.

    'Select just one shape.
     ActiveWindow.Select vsoShapes(MAX_SHAPES), _
        visDeselectAll + visSelect

    'Select another shape.
    ActiveWindow.Select vsoShapes(MAX_SHAPES - 1), visSelect

    'Select the group.
    ActiveWindow.Select vsoGroup, visSelect

    'Select all but one shape on the page.
    ActiveWindow.SelectAll
    ActiveWindow.Select vsoShapes(MAX_SHAPES - 1), visDeselect

End Sub


Window.SelectAll Method (Visio)

 Copy code hover
[image]

Window.SelectAll Method (Visio)
Send feedback

Published: July 16, 2012

Selects all possible shapes in a window or selection.

Version Information

Version Added: Visio 2.0

Syntax

expression .SelectAll

expression A variable that represents a Window object.

Return Value

Nothing

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to select all the shapes on the page.

VBA Copy code Copy code

Public Sub SelectAll_Example()

 Const MAX_SHAPES = 6
 Dim vsoShapes(1 To MAX_SHAPES) As Visio.Shape
 Dim intCounter As Integer

 'Draw six rectangles.
 For intCounter = 1 To MAX_SHAPES
 Set vsoShapes(intCounter) = ActivePage.DrawRectangle(intCounter, intCounter + 1, intCounter + 1, intCounter)
 Next intCounter

 'Deselect all the shapes on the page.
 ActiveWindow.DeselectAll

 'Select all the shapes on the page.
 ActiveWindow.SelectAll

End Sub


Window.SetViewRect Method (Visio)

 Copy code hover
[image]

Window.SetViewRect Method (Visio)
Send feedback

Published: July 16, 2012

Sets the page coordinates of a window's borders by adjusting the zoom level and center scroll position.

Version Information

Version Added: Visio 2002

Syntax

expression .SetViewRect(dLeft, dTop, dWidth, dHeight)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
dLeft | Required | Double | The page coordinate of the left side of the window.
dTop | Required | Double | The page coordinate of the top of the window.
dWidth | Required | Double | The distance in page units from the left side to the right side of the window.
dHeight | Required | Double | The distance in page units from the top to the bottom of the window.

Return Value

Nothing

Remarks

If the Window object is not a visDrawing type, the SetViewRect method raises an exception.


Window.SetWindowRect Method (Visio)

 Copy code hover
[image]

Window.SetWindowRect Method (Visio)
Send feedback

Published: July 16, 2012

Sets the size and position of the client area of a window.

Version Information

Version Added: Visio 2000

Syntax

expression .SetWindowRect(nLeft, nTop, nWidth, nHeight)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
nLeft | Required | Long | The coordinate of the left side of the window.
nTop | Required | Long | The coordinate of the top of the window.
nWidth | Required | Long | The distance in pixels from the left side to the right side of the window.
nHeight | Required | Long | The distance in pixels from the top to the bottom of the window.

Return Value

Nothing

Remarks

The SetWindowRect method sets the size and position of the client area of the window with respect to the window that owns the Windows collection to which it belongs. For the Windows collection of an Application object, the "with respect to" window is the MDICLIENT window of the Visio main window. For the Windows collection of a Window object, the "with respect to" window is the client area of the drawing window.

SetWindowRect has no effect when the window is docked.

Example

The following example shows how to use the SetWindowRect method to set the size and position of a Window object. It opens the Pan & Zoom window and prints the window's coordinates, width, and height in the Immediate window. Then it uses SetWindowRect to change the height of the window, and prints the new values.

VBA Copy code Copy code
Public Sub SetWindowRect_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoPZWindow As Visio.Window
 Dim pinLeft As Long, pinTop As Long, pinWidth As Long, pinHeight As Long

 Set vsoApplication = Visio.Application

 'Display the Pan & Zoom window
 Set vsoPZWindow = vsoApplication.ActiveWindow.Windows.ItemFromID(visWinIDPanZoom)
 vsoPZWindow.Visible = True

 'Get the existing window size and position
 vsoPZWindow.GetWindowRect pinLeft, pinTop, pinWidth, pinHeight
 Debug.Print pinLeft, pinTop, pinWidth, pinHeight

 'Change the window height and get the new values
 vsoPZWindow.SetWindowRect pinLeft, pinTop, pinWidth, pinHeight + 50
 vsoPZWindow.GetWindowRect pinLeft, pinTop, pinWidth, pinHeight
 Debug.Print pinLeft, pinTop, pinWidth, pinHeight

End Sub


Window Events (Visio)

 Copy code hover
[image]

Window Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
BeforeWindowClosed | Occurs before a window is closed.
BeforeWindowPageTurn | Occurs before a window is about to show a different page.
BeforeWindowSelDelete | Occurs before the shapes in the selection of a window are deleted.
KeyDown | Occurs when a keyboard key is pressed.
KeyPress | Occurs when a keyboard key is pressed.
KeyUp | Occurs when a keyboard key is released.
MouseDown | Occurs when a mouse button is clicked.
MouseMove | Occurs when the mouse is moved.
MouseUp | Occurs when a mouse button is released.
OnKeystrokeMessageForAddon | Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.
QueryCancelWindowClose | Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.
SelectionChanged | Occurs after a set of shapes selected in a window changes.
ViewChanged | Occurs when the zoom level or scroll position of a drawing window changes.
WindowActivated | Occurs after the active window changes in a Microsoft Visio instance.
WindowChanged | Occurs when the size or position of a window changes.
WindowCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.
WindowTurnedToPage | Occurs after a window shows a different page.


Window.BeforeWindowClosed Event (Visio)

 Copy code hover
[image]

Window.BeforeWindowClosed Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a window is closed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeWindowClosed(ByVal Window As [IVWINDOW])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Window.BeforeWindowPageTurn Event (Visio)

 Copy code hover
[image]

Window.BeforeWindowPageTurn Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a window is about to show a different page.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeWindowPageTurn(ByVal Window As [IVWINDOW])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to show a different page.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Window.BeforeWindowSelDelete Event (Visio)

 Copy code hover
[image]

Window.BeforeWindowSelDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the shapes in the selection of a window are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeWindowSelDelete(ByVal Window As [IVWINDOW])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that contains the selection that is going to be deleted.

Remarks

The BeforeWindowSelDelete event fires if user interactions cause shapes in a window to be deleted. It doesn't fire if a program deletes shapes in a window by using the Cut method, for example.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Window.KeyDown Event (Visio)

 Copy code hover
[image]

Window.KeyDown Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is pressed.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, ByVal CancelDefault As Boolean)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | The key that was pressed. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the SHIFT and CTRL keys for the event. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 12, it indicates that the user held down both SHIFT and CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio does not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyDown does not have the prefix "Query," but it is still a query event. That is, you can cancel processing the message sent by KeyDown, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

Note Note

Pressing an accelererator key combination, for example, CTRL + C, does not fire the KeyDown event.

If you are using VBA, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyDown event. In the Immediate window, the handler prints the code of the key that was pressed to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


Window.KeyPress Event (Visio)

 Copy code hover
[image]

Window.KeyPress Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is pressed.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyPress(ByVal KeyAscii As Long, ByVal CancelDefault As Boolean)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
KeyAscii | Required | Long | The ASCII value of the key that was pressed. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyAscii are the ASCII codes. To see a list of these codes, search for "ASCII character codes" on MSDN.

If you set CancelDefault to True, Visio does not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyPress does not have the prefix "Query," but it is still a query event. That is, you can cancel processing the message sent by KeyPress, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

Note Note

Pressing an accelererator key combination, for example, CTRL + C, does not fire the KeyPress event.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyPress event. In the Immediate window, the handler prints the ASCII code of the key that was pressed to fire the event.


Window.KeyUp Event (Visio)

 Copy code hover
[image]

Window.KeyUp Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is released.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, ByVal CancelDefault As Boolean)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | The key that was released. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the SHIFT and CTRL keys for the event. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 12, it indicates that the user held down both SHIFT and CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyUp does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by KeyUp, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

If you are using Microsoft Visual Basic or VBA, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, press any key, and then release it to fire a KeyUp event. In the Immediate window, the handler prints the code of the key that was released to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


Window.MouseDown Event (Visio)

 Copy code hover
[image]

Window.MouseDown Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a mouse button is clicked.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was pressed. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseDown does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseDown, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseDown event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event.


Window.MouseMove Event (Visio)

 Copy code hover
[image]

Window.MouseMove Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the mouse is moved.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was clicked. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseMove does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseMove, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then move the mouse briefly in the active window to fire a series of MouseMove events. In the Immediate window, the handler prints a list of x- and y-position value pairs, each of which corresponds to the mouse position when a MouseMove event fired.


Window.MouseUp Event (Visio)

 Copy code hover
[image]

Window.MouseUp Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a mouse button is released.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was released. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseUp does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseUp, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseUp event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event.


Window.OnKeystrokeMessageForAddon Event (Visio)

 Copy code hover
[image]

Window.OnKeystrokeMessageForAddon Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.

Version Information

Version Added: Visio 2002

Syntax

Private Sub expression _OnKeystrokeMessageForAddon(ByVal MSG As [IVMSGWRAP])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
MSG | Required | [IVMSGWRAP] | The message that Visio receives.

Remarks

Returns True to indicate that the message was handled by the add-on. Otherwise, returns False.

The OnKeystrokeMessageForAddon event enables add-ons to intercept and process accelerator and keystroke messages directed at their own add-on windows and child windows of their add-on windows. Only add-on windows created using the Add method will source this event.

For this event to fire, the add-on window or one of its child windows must have keystroke focus and the Visio message loop must receive the keystroke message. This event does not fire if the message loop associated with an add-on is handling messages instead of Visio.

Visio fires the OnKeystrokeMessageForAddon event when it receives messages in the following range:

WM_KEYDOWN | 0x0100
WM_KEYUP | 0x0101
WM_CHAR | 0x0102
WM_DEADCHAR | 0x0103
WM_SYSKEYDOWN | 0x0104
WM_SYSKEYUP | 0x0105
WM_SYSCHAR | 0x0106
WM_SYSDEADCHAR | 0x0107

The MSGWrap object, passed to the event handler when the OnKeystrokeMessageForAddon event fires, wraps the Microsoft Windows MSG structure, which contains message data. See the MSGWrap object for more information, or refer to your Windows documentation.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Window.QueryCancelWindowClose Event (Visio)

 Copy code hover
[image]

Window.QueryCancelWindowClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelWindowClose(ByVal Window As [IVWINDOW])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to be closed.

Remarks

A Microsoft Visio instance fires QueryCancelWindowClose after the user has directed the instance to close a window.

  • If any event handler returns True (cancel), the instance fires WindowCloseCanceled and does not close the window.

  • If all handlers return False (don't cancel), the instance fires BeforeWindowClosed and then closes the window.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but it refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Window.SelectionChanged Event (Visio)

 Copy code hover
[image]

Window.SelectionChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a set of shapes selected in a window changes.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionChanged(ByVal Window As [IVWINDOW])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window in which the selection changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Window.ViewChanged Event (Visio)

 Copy code hover
[image]

Window.ViewChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the zoom level or scroll position of a drawing window changes.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ViewChanged(ByVal Window As [IVWINDOW])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window whose zoom level or scroll position changed.

Remarks

This event fires whenever the zoom level or scroll position of a Window object of the type visDrawing changes.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Window.WindowActivated Event (Visio)

 Copy code hover
[image]

Window.WindowActivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the active window changes in a Microsoft Visio instance.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _WindowActivated(ByVal Window As [IVWINDOW])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that was activated.

Remarks

The WindowActivated event indicates that the active window has changed in a Visio instance. This event implies that the ActiveDocument and ActivePage properties of the Application object may also have changed; in contrast, any time the ActiveDocument or ActivePage property changes, a WindowActivated event is always generated.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Window.WindowChanged Event (Visio)

 Copy code hover
[image]

Window.WindowChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the size or position of a window changes.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _WindowChanged(ByVal Window As [IVWINDOW])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window whose size or position has changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Window.WindowCloseCanceled Event (Visio)

 Copy code hover
[image]

Window.WindowCloseCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _WindowCloseCanceled(ByVal Window As [IVWINDOW])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that was going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Window.WindowTurnedToPage Event (Visio)

 Copy code hover
[image]

Window.WindowTurnedToPage Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a window shows a different page.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _WindowTurnedToPage(ByVal Window As [IVWINDOW])

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that shows a different page.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows Object (Visio)

 Copy code hover
[image]

Windows Object (Visio)
Send feedback

Published: July 16, 2012

Includes a Window object for a window that is open in the application.

Remarks

To retrieve a Windows collection, use the Windows property of an Application object or a Window object.

The default property of a Windows collection is Item.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this collection maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindows.GetEnumerator() (to enumerate the Window objects.)

  • Microsoft.Office.Interop.Visio.IVWindows


Windows Members (Visio)

 Copy code hover
[image]

Windows Members (Visio)
Send feedback

Published: July 16, 2012

Includes a Window object for a window that is open in the application.

Events

Name | Description
BeforeWindowClosed | Occurs before a window is closed.
BeforeWindowPageTurn | Occurs before a window is about to show a different page.
BeforeWindowSelDelete | Occurs before the shapes in the selection of a window are deleted.
KeyDown | Occurs when a keyboard key is pressed.
KeyPress | Occurs when a keyboard key is pressed.
KeyUp | Occurs when a keyboard key is released.
MouseDown | Occurs when a mouse button is clicked.
MouseMove | Occurs when the mouse is moved.
MouseUp | Occurs when a mouse button is released.
OnKeystrokeMessageForAddon | Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.
QueryCancelWindowClose | Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.
SelectionChanged | Occurs after a set of shapes selected in a window changes.
ViewChanged | Occurs when the zoom level or scroll position of a drawing window changes.
WindowActivated | Occurs after the active window changes in a Microsoft Visio instance.
WindowChanged | Occurs when the size or position of a window changes.
WindowCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.
WindowOpened | Occurs after a window is opened.
WindowTurnedToPage | Occurs after a window shows a different page.

Methods

Name | Description
Add | Adds a new Window object to the Windows collection.
Arrange | Arranges the windows in a Windows collection.

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemEx | Returns a Window object from a collection. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.


Windows Properties (Visio)

 Copy code hover
[image]

Windows Properties (Visio)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns the instance of Microsoft Visio that is associated with an object. Read-only.
Count | Returns the number of objects in a collection. Read-only.
EventList | Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.
Item | Returns an item from a collection. The Item property is the default property for all collections. Read-only.
ItemEx | Returns a Window object from a collection. Read-only.
ItemFromID | Returns an item of a collection using the ID of the item. Read-only.
ObjectType | Returns an object's type. Read-only.
PersistsEvents | Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.


Windows.Application Property (Visio)

 Copy code hover
[image]

Windows.Application Property (Visio)
Send feedback

Published: July 16, 2012

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Application

expression A variable that represents a Windows object.

Return Value

Application

Example

The following Microsoft Visual Basic for Applications (VBA) macro gets the Application object associated with the active document and prints its process ID number in the Immediate window.

VBA Copy code Copy code

Public Sub Application_Example()

 Dim vsoApplication As Visio.Application
 Dim vsoDocument As Visio.Document

 Set vsoDocument = ActiveDocument

 'Get the instance of Visio associated with the Document object.
 Set vsoApplication = vsoDocument.Application
 Debug.Print "The process ID of the Application object associated with the active document is: " & vsoApplication.ProcessID

End Sub


Windows.Count Property (Visio)

 Copy code hover
[image]

Windows.Count Property (Visio)
Send feedback

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Count

expression A variable that represents a Windows object.

Return Value

Integer

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Visio documents in the Immediate window.

VBA Copy code Copy code

Public Sub Count_Example()

 Dim intCounter As Integer
 Dim vsoDocument As Visio.Document

 For intCounter = 1 To Documents.Count
 'Get the next open document.
 Set vsoDocument = Documents.Item(intCounter)

 'Print its name in the Immediate window.
 Debug.Print vsoDocument.Name
 Next intCounter

End Sub


Windows.EventList Property (Visio)

 Copy code hover
[image]

Windows.EventList Property (Visio)
Send feedback

Published: July 16, 2012

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .EventList

expression A variable that represents a Windows object.

Return Value

EventList

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the EventList property to add an Event object to the EventList collection of a Document object. When the Event object is triggered by adding a shape to the document, the VSL add-on you specify runs.

Before running this macro, replace references to fullpath\filename and filename with a valid path and name for a Microsoft Visio VSL or executable (EXE) add-on.

VBA Copy code Copy code

Public Sub EventList_Example()

 Dim vsoEventList As Visio.EventList
 Dim vsoEvent As Visio.Event
 Dim vsoAddons As Visio.Addons
 Dim vsoAddon As Visio.Addon

 'Prevent overflow error.
 Const visEvtAdd% = &H8000

 'Add the specified add-on to the Addons collection.
 Set vsoAddons = Visio.Addons
 Set vsoAddon = vsoAddons.Add ("fullpath\filename")

 'Add a ShapeAdded event to the EventList collection
 'of the document. The event will start the specifed add-on, which
 'should take no arguments.
 Set vsoEventList = ThisDocument.EventList
 Set vsoEvent = vsoEventList.Add(visEvtAdd + visEvtShape, visActCodeRunAddon, _
 "filename", "")

End Sub


Windows.Item Property (Visio)

 Copy code hover
[image]

Windows.Item Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item from a collection. The Item property is the default property for all collections. Read-only.

Version Information

Version Added: Visio 2.0

Syntax

expression .Item(Index)

expression A variable that represents a Windows collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Integer | The index number of the object in its collection.

Return Value

Window

Remarks

When retrieving objects from a collection, you can omit Item from the expression because it is the default property for all collections. The following statement is equivalent to the syntax example given above:

VBA Copy code Copy code
objRet = object(index)


Windows.ItemEx Property (Visio)

 Copy code hover
[image]

Windows.ItemEx Property (Visio)
Send feedback

Published: July 16, 2012

Returns a Window object from a collection. Read-only.

Version Information

Version Added: Visio 2003

Syntax

expression .ItemEx(CaptionOrIndex)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
CaptionOrIndex | Required | Variant | Contains the caption or index of the window to retrieve. See Remarks for details.

Return Value

Window

Remarks

The ItemEx property is similar to the Item property as it applies to the Windows collection, except that the first argument can be either the window caption or the index. Beginning with Microsoft Office Visio 2003, all built-in Multiple Document Interface (MDI) windows have unique captions, although there is no guarantee that subwindows have unique captions. If there are multiple subwindows that have the same caption, ItemEx returns the one that has the lowest index.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the ItemEx property to make a window active in Visio. It adds a document to the Documents collection, thereby creating a new window. Then it gets the index number of the new window (which is equal to the count of window items), uses that index number to get the new window's caption, and then passes the caption to the ItemEx property to activate the new window.

VBA Copy code Copy code
Sub ItemEx_Example()

 Dim intWindowCount As Integer
 Dim strWindowCaption As String

 'Add a document not based on a template to the collection
 Application.Documents.Add ("")

 'Get the index number in the Windows collection of the new window
 intWindowCount = Application.Windows.Count

 'Get the new window's caption
 strWindowCaption = Application.Windows(intWindowCount)

 'Activate the new window
 Application.Windows.ItemEx(strWindowCaption).Activate

End Sub


Windows.ItemFromID Property (Visio)

 Copy code hover
[image]

Windows.ItemFromID Property (Visio)
Send feedback

Published: July 16, 2012

Returns an item of a collection using the ID of the item. Read-only.

Version Information

Version Added: Visio 4.0

Syntax

expression .ItemFromID(nID)

expression A variable that represents a Windows collection.

Parameters

Name | Required/Optional | Data Type | Description
nID | Required | Long | The ID of the object to retrieve.

Return Value

Window

Remarks

The ID of a Shape object uniquely identifies the shape within its page or master.

The ID of a Style object uniquely identifies the style within its document.

The ID of a Font object corresponds to the number stored in the Font cell of a row in a shape's Character Properties section. The ID associated with a particular font varies between systems or as fonts are installed on and removed from a given system.

The ID of an Event object uniquely identifies an event in its EventList collection for the life of the collection.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVWindows.get_ItemFromID(int)


Windows.ObjectType Property (Visio)

 Copy code hover
[image]

Windows.ObjectType Property (Visio)
Send feedback

Published: July 16, 2012

Returns an object's type. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .ObjectType

expression A variable that represents a Windows object.

Return Value

Integer

Remarks

Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.

Example

This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

VBA Copy code Copy code
Public Sub ObjectType_Example()

 Dim vsoShape As Visio.Shape
 Dim vsoShapes As Visio.Shapes
 Dim vsoPage As Visio.Page

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25

 Application.ActiveWindow.SelectAll

 ActiveWindow.DeselectAll
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
 ActiveWindow.Selection.Group

 Set vsoPage = ActivePage
 Set vsoShapes = vsoPage.Shapes
 Set vsoShape = vsoShapes.Item(2)

 Call GetTopShape(vsoShape)

End Sub

Function GetTopShape(vsoShape As Visio.Shape) As String

 Dim vsoShapeParent As Object
 Dim vsoShapeParentParent As Object

 Set vsoShapeParent = vsoShape.Parent

 If vsoShapeParent.ObjectType = visObjTypeShape Then

 Set vsoShapeParentParent = vsoShapeParent.Parent

 'If vsoShapeParent's parent isn't a page, keep going up.
 If vsoShapeParentParent.ObjectType = visObjTypePage Then
 GetTopShape = vsoShapeParent.Name
 Else
 GetTopShape = GetTopShape(vsoShapeParent)
 End If

 End If

 Debug.Print vsoShapeParent.Name

End Function


Windows.PersistsEvents Property (Visio)

 Copy code hover
[image]

Windows.PersistsEvents Property (Visio)
Send feedback

Published: July 16, 2012

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

Version Information

Version Added: Visio 4.1

Syntax

expression .PersistsEvents

expression A variable that represents a Windows object.

Return Value

Integer

Remarks

Every object that has an EventList property also has a PersistsEvents property. To be persistable, an event's action code must be visActCodeRunAddon, but it must also be in the EventList collection of an object whose PersistsEvents property is True. The only objects that currently persist events are Document, Master, and Page objects.

Whether a persistable event actually does persist depends on the value of its Persistent property.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the PersistsEvents property to determine if an object is capable of containing persistent events. Executing the macro prints 1 (True), 1 (True), and 0 (False) in the Immediate window for the Document, Page, and Window objects, respectively.

VBA Copy code Copy code

Public Sub PersistsEvents_Example()

 Dim vsoDocument As Visio.Document

 Set vsoDocument = Documents.Add("")
 Debug.Print vsoDocument.PersistsEvents
 Debug.Print ActivePage.PersistsEvents
 Debug.Print ActiveWindow.PersistsEvents

End Sub


Windows Methods (Visio)

 Copy code hover
[image]

Windows Methods (Visio)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new Window object to the Windows collection.
Arrange | Arranges the windows in a Windows collection.


Windows.Add Method (Visio)

 Copy code hover
[image]

Windows.Add Method (Visio)
Send feedback

Published: July 16, 2012

Adds a new Window object to the Windows collection.

Version Information

Version Added: Visio 2000

Syntax

expression .Add(bstrCaption, nFlags, nType, nLeft, nTop, nWidth, nHeight, bstrMergeID, bstrMergeClass, nMergePosition)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
bstrCaption | Optional | Variant | The title of window; default is "Untitled".
nFlags | Optional | Variant | Initial window state. Can contain any combination of VisWindowStates constants declared in the Visio type library; default varies based on the nType.
nType | Optional | Variant | Type of new window. Can be any one of the VisWinTypes constants declared in the Visio type library. Defaults to visStencilAddon for Application.Windows; defaults to visAnchorBarAddon for Window.Windows
nLeft | Optional | Variant | Position of the left side of the window.
nTop | Optional | Variant | Position of the top of the window.
nWidth | Optional | Variant | Width of the client area of the window.
nHeight | Optional | Variant | Height of the client area of the window.
bstrMergeID | Optional | Variant | Merge ID of the window.
bstrMergeClass | Optional | Variant | Merge class of the window.
nMergePosition | Optional | Variant | Merge position of the window.

Return Value

Window

Remarks

Use this method to get an empty parent frame window within the Visio window space that you can populate with child windows. You must be in the Visio process space (for example, in a DLL or VSL-based add-on) to use the Window object returned by this method as a parent to your windows.

Use the value returned by the WindowHandle32 property as an HWND for use as a parent to your own windows.

Example

The following macro shows how to use the Add method to add a Window object to the Windows collection. It creates a new, empty parent frame window, docked to the bottom of the drawing window. Then it populates the new parent frame window with a child window, in this case a form, so that the new window does not appear empty.

Add a form to your Microsoft Visual Basic (VBA) project called frmMain, and then add a TextBox control named txtForm to the form.

The SetParent, FindWindow, and SetWindowLongLib functions are from the Windows API, and are necessary to add the form to the new window.

Add the following code to the form module to resize the text box when the form is resized:

VBA Copy code Copy code
Private Sub UserForm_Resize()
 txtForm.Width = txtForm.Parent.Width - 10
 txtForm.Height = txtForm.Parent.Height - 10
End Sub

Then add the following code to the document project:

VBA Copy code Copy code
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Const GWL_STYLE = (-16)
Private Const WS_CHILD = &H40000000
Private Const WS_VISIBLE = &H10000000

Public Sub AddWindow_Example()

 Dim vsoWindow As Visio.Window
 Dim frmNewWindow As UserForm
 Dim lngFormHandle As Long

 'Add a new Anchor Bar window docked to the bottom of the Visio drawing window
 Set vsoWindow = ActiveWindow.Windows.Add("My New Window", visWSVisible + visWSDockedBottom, visAnchorBarAddon, , , 300, 210)

 'Create a new windows form
 Set frmNewWindow = New frmMain

 'Get the 32-bit handle of the new window.
 lngFormHandle = FindWindow(vbNullString, "My New Window")

 SetWindowLong lngFormHandle, GWL_STYLE, WS_CHILD Or WS_VISIBLE
 SetParent lngFormHandle, vsoWindow.WindowHandle32

End Sub


Windows.Arrange Method (Visio)

 Copy code hover
[image]

Windows.Arrange Method (Visio)
Send feedback

Published: July 16, 2012

Arranges the windows in a Windows collection.

Version Information

Version Added: Visio 2.0

Syntax

expression .Arrange(nArrangeFlags)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
nArrangeFlags | Optional | Variant | A flag that specifies how to arrange the windows; by default, the windows are arranged vertically.

Return Value

Nothing

Remarks

Using the Arrange method is equivalent to clicking Arrange All in the Window group on the View tab. The active window remains active.

Visio considers windows from top to bottom and then from left to right. You can influence which windows will end up topmost when tiling horizontally (or leftmost when tiling vertically) by prearranging windows.

The following constants declared by the Visio type library are valid values for nArrangeFlags. These constants are also declared by the Visio type library in VisWindowArrange .

Constant | Value
VisArrangeTileVertical | 1
VisArrangeTileHorizontal | 2
VisArrangeCascade | 3

Example

The following macro shows how to activate and arrange windows.

VBA Copy code Copy code

Public Sub Arrange_Example()

 Dim vsoDocument As Visio.Document
 Dim vsoWindow As Visio.Window
 Dim vsoWindow2 As Visio.Window

 'Create two new windows by adding documents.
 Set vsoDocument = Documents.Add("")
 Set vsoWindow = ActiveWindow
 Set vsoDocument = Documents.Add("")

 'Use the Arrange method to tile the windows
 '(currently the last opened window is active).
 Windows.Arrange

 'Use the Activate method to make the other
 'window the active window.
 vsoWindow.Activate

End Sub


Windows Events (Visio)

 Copy code hover
[image]

Windows Events (Visio)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
BeforeWindowClosed | Occurs before a window is closed.
BeforeWindowPageTurn | Occurs before a window is about to show a different page.
BeforeWindowSelDelete | Occurs before the shapes in the selection of a window are deleted.
KeyDown | Occurs when a keyboard key is pressed.
KeyPress | Occurs when a keyboard key is pressed.
KeyUp | Occurs when a keyboard key is released.
MouseDown | Occurs when a mouse button is clicked.
MouseMove | Occurs when the mouse is moved.
MouseUp | Occurs when a mouse button is released.
OnKeystrokeMessageForAddon | Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.
QueryCancelWindowClose | Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.
SelectionChanged | Occurs after a set of shapes selected in a window changes.
ViewChanged | Occurs when the zoom level or scroll position of a drawing window changes.
WindowActivated | Occurs after the active window changes in a Microsoft Visio instance.
WindowChanged | Occurs when the size or position of a window changes.
WindowCloseCanceled | Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.
WindowOpened | Occurs after a window is opened.
WindowTurnedToPage | Occurs after a window shows a different page.


Windows.BeforeWindowClosed Event (Visio)

 Copy code hover
[image]

Windows.BeforeWindowClosed Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a window is closed.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeWindowClosed(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.BeforeWindowPageTurn Event (Visio)

 Copy code hover
[image]

Windows.BeforeWindowPageTurn Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before a window is about to show a different page.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _BeforeWindowPageTurn(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to show a different page.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.BeforeWindowSelDelete Event (Visio)

 Copy code hover
[image]

Windows.BeforeWindowSelDelete Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the shapes in the selection of a window are deleted.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _BeforeWindowSelDelete(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that contains the selection that is going to be deleted.

Remarks

The BeforeWindowSelDelete event fires if user interactions cause shapes in a window to be deleted. It doesn't fire if a program deletes shapes in a window by using the Cut method, for example.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.KeyDown Event (Visio)

 Copy code hover
[image]

Windows.KeyDown Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is pressed.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, ByVal CancelDefault As Boolean)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | The key that was pressed. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the SHIFT and CTRL keys for the event. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 12, it indicates that the user held down both SHIFT and CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyDown does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by KeyDown, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

Note Note

Pressing an accelererator key combination, for example, CTRL + C, does not fire the KeyDown event.

If you are using VBA, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyDown event. In the Immediate window, the handler prints the code of the key that was pressed to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


Windows.KeyPress Event (Visio)

 Copy code hover
[image]

Windows.KeyPress Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is pressed.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyPress(ByVal KeyAscii As Long, ByVal CancelDefault As Boolean)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
KeyAscii | Required | Long | The ASCII value of the key that was pressed. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyAscii are the ASCII codes. To see a list of these codes, search for "ASCII character codes" on MSDN.

If you set CancelDefault to True, Visio does not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyPress does not have the prefix "Query," but it is still a query event. That is, you can cancel processing the message sent by KeyPress, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

Note Note

Pressing an accelererator key combination, for example, CTRL + C, does not fire the KeyPress event.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, and then press any key to fire a KeyPress event. In the Immediate window, the handler prints the ASCII code of the key that was pressed to fire the event.


Windows.KeyUp Event (Visio)

 Copy code hover
[image]

Windows.KeyUp Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a keyboard key is released.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, ByVal CancelDefault As Boolean)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | The key that was released. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the SHIFT and CTRL keys for the event. See Remarks for possible values.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for KeyCode are declared in KeyCodeConstants in the Microsoft Visual Basic for Applications (VBA) library.

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 12, it indicates that the user held down both SHIFT and CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, KeyUp does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by KeyUp, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

If you are using Microsoft Visual Basic or VBA, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called KeyboardListener that listens for events fired by keyboard actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the KeyDown, KeyPress, and KeyUp events.

To run this example, insert a new class module in your VBA project, name it KeyboardListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Private Sub vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

 Debug.Print "KeyAscii value is "; KeyAscii

End Sub

Private Sub vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState As Long, CancelDefault As Boolean)

 Debug.Print "KeyCode is "; KeyCode
 Debug.Print "KeyButtonState is" ; KeyButtonState

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myKeyboardListener As KeyboardListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myKeyboardListener = New KeyboardListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myKeyboardListener = Nothing

End Sub

Save the document to initialize the class, press any key, and then release it to fire a KeyUp event. In the Immediate window, the handler prints the code of the key that was released to fire the event and the state of the SHIFT and CTRL keys at the time the event fired.


Windows.MouseDown Event (Visio)

 Copy code hover
[image]

Windows.MouseDown Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a mouse button is clicked.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was pressed. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseDown does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseDown, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseDown event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event.


Windows.MouseMove Event (Visio)

 Copy code hover
[image]

Windows.MouseMove Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the mouse is moved.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was clicked. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseMove does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseMove, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this Automation Reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then move the mouse briefly in the active window to fire a series of MouseMove events. In the Immediate window, the handler prints a list of x- and y-position value pairs, each of which corresponds to the mouse position when a MouseMove event fired.


Windows.MouseUp Event (Visio)

 Copy code hover
[image]

Windows.MouseUp Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when a mouse button is released.

Version Information

Version Added: Visio 2003

Syntax

Private Sub expression _MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, ByVal CancelDefault As Boolean)

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Button | Required | Long | The mouse button that was released. See Remarks for possible values.
KeyButtonState | Required | Long | The state of the mouse buttons and the SHIFT and CTRL keys for the event. See Remarks for possible values.
x | Required | Double | The x-coordinate of the mouse pointer.
y | Required | Double | The y-coordinate of the mouse pointer.
CancelDefault | Required | Boolean | False if Microsoft Visio should process the message it receives from this event; otherwise, True.

Remarks

Possible values for Button are shown in the following table, and are declared in VisKeyButtonFlags in the Visio type library.

Constant | Value
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

Possible values for KeyButtonState can be a combination of the values shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library. For example, if KeyButtonState returns 9, it indicates that the user clicked the left mouse button while pressing CTRL.

Constant | Value
visKeyControl | 8
visKeyShift | 4
visMouseLeft | 1
visMouseMiddle | 16
visMouseRight | 2

If you set CancelDefault to True, Visio will not process the message received when the mouse button is clicked.

Unlike some other Visio events, MouseUp does not have the prefix "Query," but it is nevertheless a query event. That is, you can cancel processing the message sent by MouseUp, either by setting CancelDefault to True, or, if you are using theVisEventProc method to handle the event, by returning True. For more information, see the topics for the VisEventProc method and for any of the query events (for example, the QueryCancelSuspend event) in this reference.

If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

Example

This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.

To run this example, insert a new class module in your VBA project, name it MouseListener, and insert the following code in the module.

VBA Copy code Copy code
Dim WithEvents vsoWindow As Visio.Window

Private Sub Class_Initialize()

 Set vsoWindow = ActiveWindow

End Sub

Private Sub Class_Terminate()

 Set vsoWindow = Nothing

End Sub

Private Sub vsoWindow_MouseDown(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button clicked"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button clicked"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button clicked"

 End If

End Sub

Private Sub vsoWindow_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 Debug.Print "x-position is "; x
 Debug.Print "y-position is "; y

End Sub

Private Sub vsoWindow_MouseUp(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)

 If Button = 1 Then

 Debug.Print "Left mouse button released"

 ElseIf Button = 2 Then

 Debug.Print "Right mouse button released"

 ElseIf Button = 16 Then

 Debug.Print "Center mouse button released"

 End If

End Sub

Then, insert the following code in the ThisDocument project.

VBA Copy code Copy code
Dim myMouseListener As MouseListener

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)

 Set myMouseListener = New MouseListener

End Sub

Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)

 Set myMouseListener = Nothing

End Sub

Save the document to initialize the class, and then click anywhere in the active window to fire a MouseUp event. In the Immediate window, the handler prints the name of the mouse button that was clicked to fire the event.


Windows.OnKeystrokeMessageForAddon Event (Visio)

 Copy code hover
[image]

Windows.OnKeystrokeMessageForAddon Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when Microsoft Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.

Version Information

Version Added: Visio 2002

Syntax

Private Sub expression _OnKeystrokeMessageForAddon(ByVal MSG As [IVMSGWRAP])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
MSG | Required | [IVMSGWRAP] | The message that Visio receives.

Remarks

Returns True to indicate that the message was handled by the add-on. Otherwise, returns False.

The OnKeystrokeMessageForAddon event enables add-ons to intercept and process accelerator and keystroke messages directed at their own add-on windows and child windows of their add-on windows. Only add-on windows created using the Add method will source this event.

For this event to fire, the add-on window or one of its child windows must have keystroke focus and the Visio message loop must receive the keystroke message. This event does not fire if the message loop associated with an add-on is handling messages instead of Visio.

Visio fires the OnKeystrokeMessageForAddon event when it receives messages in the following range:

WM_KEYDOWN | 0x0100
WM_KEYUP | 0x0101
WM_CHAR | 0x0102
WM_DEADCHAR | 0x0103
WM_SYSKEYDOWN | 0x0104
WM_SYSKEYUP | 0x0105
WM_SYSCHAR | 0x0106
WM_SYSDEADCHAR | 0x0107

The MSGWrap object, passed to the event handler when the OnKeystrokeMessageForAddon event fires, wraps the Microsoft Windows MSG structure, which contains message data. See the MSGWrap object for more information, or refer to your Windows documentation.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.QueryCancelWindowClose Event (Visio)

 Copy code hover
[image]

Windows.QueryCancelWindowClose Event (Visio)
Send feedback

Published: July 16, 2012

Occurs before the application closes a window in response to a user action in the interface. If any event handler returns True, the operation is canceled.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _QueryCancelWindowClose(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that is going to be closed.

Remarks

A Microsoft Visio instance fires QueryCancelWindowClose after the user has directed the instance to close a window.

  • If any event handler returns True (cancel), the instance fires WindowCloseCanceled and does not close the window.

  • If all handlers return False (don't cancel), the instance fires BeforeWindowClosed and then closes the window.

While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but it refuses to perform operations. Client code can show forms or message boxes while responding to a query or cancel event.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.SelectionChanged Event (Visio)

 Copy code hover
[image]

Windows.SelectionChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a set of shapes selected in a window changes.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _SelectionChanged(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window in which the selection changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.ViewChanged Event (Visio)

 Copy code hover
[image]

Windows.ViewChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the zoom level or scroll position of a drawing window changes.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _ViewChanged(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window whose zoom level or scroll position changed.

Remarks

This event fires whenever the zoom level or scroll position of a Window object of the type visDrawing changes.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.WindowActivated Event (Visio)

 Copy code hover
[image]

Windows.WindowActivated Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after the active window changes in a Microsoft Visio instance.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _WindowActivated(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that was activated.

Remarks

The WindowActivated event indicates that the active window has changed in a Visio instance. This event implies that the ActiveDocument and ActivePage properties of the Application object may also have changed; in contrast, any time the ActiveDocument or ActivePage property changes, a WindowActivated event is always generated.

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.WindowChanged Event (Visio)

 Copy code hover
[image]

Windows.WindowChanged Event (Visio)
Send feedback

Published: July 16, 2012

Occurs when the size or position of a window changes.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _WindowChanged(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window whose size or position has changed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.WindowCloseCanceled Event (Visio)

 Copy code hover
[image]

Windows.WindowCloseCanceled Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after an event handler has returned True (cancel) to a QueryCancelWindowClose event.

Version Information

Version Added: Visio 2000

Syntax

Private Sub expression _WindowCloseCanceled(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that was going to be closed.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.WindowOpened Event (Visio)

 Copy code hover
[image]

Windows.WindowOpened Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a window is opened.

Version Information

Version Added: Visio 4.1

Syntax

Private Sub expression _WindowOpened(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that opened.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Windows.WindowTurnedToPage Event (Visio)

 Copy code hover
[image]

Windows.WindowTurnedToPage Event (Visio)
Send feedback

Published: July 16, 2012

Occurs after a window shows a different page.

Version Information

Version Added: Visio 4.5

Syntax

Private Sub expression _WindowTurnedToPage(ByVal Window As [IVWINDOW])

expression A variable that represents a Windows object.

Parameters

Name | Required/Optional | Data Type | Description
Window | Required | [IVWINDOW] | The window that shows a different page.

Remarks

If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.


Enumerations (Visio)

 Copy code hover
[image]

Enumerations (Visio)
Send feedback

Published: July 16, 2012

This section contains documentation for the enumerations in the Visio object model.


VisArcSweepFlags Enumeration (Visio)

 Copy code hover
[image]

VisArcSweepFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Sweep flag constants used in conjunction with the DrawQuarterArc method.

Constant | Value | Description
visArcSweepFlagConcave | 0 | Concave arc
visArcSweepFlagConvex | 1 | Convex arc


VisAutoConnectDir Enumeration (Visio)

 Copy code hover
[image]

VisAutoConnectDir Enumeration (Visio)
Send feedback

Published: July 16, 2012

Auto-connect direction constants passed to the Shape.AutoConnect method.

Name | Value | Description
visAutoConnectDirDown | 2 | Place shape below.
visAutoConnectDirLeft | 3 | Place shape to the left.
visAutoConnectDirNone | 0 | Do not place shape.
visAutoConnectDirRight | 4 | Place shape to the right.
visAutoConnectDirUp | 1 | Place shape above.


VisAutoLinkBehaviors Enumeration (Visio)

 Copy code hover
[image]

VisAutoLinkBehaviors Enumeration (Visio)
Send feedback

Published: July 16, 2012

Linking behavior constants passed to the Selection.AutomaticLink method.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visAutoLinkDontReplaceExistingLinks | 16 | Do not replace existing links.
visAutoLinkGenericProgressBar | 2 | Show generic progress bar instead of more detailed one.
visAutoLinkIncludeHiddenProps | 64 | Include hidden properties.
visAutoLinkNoApplyDataGraphic | 4 | Do not apply the default data graphic to linked shapes.
visAutolinkNullMatchesNoFormula | 32 | Allow null database values to map to "No Formula" in the Microsoft Office Visio ShapeSheet spreadsheet.
visAutoLinkReplaceExistingLinks | 8 | Replace existing links.
visAutoLinkSelectedShapesOnly | 1 | Link selected shapes only, not sub-shapes of selected shapes.


VisAutoLinkFieldTypes Enumeration (Visio)

 Copy code hover
[image]

VisAutoLinkFieldTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants passed to the Selection.AutomaticLink method, specifying the shape data (custom property) field to which to link shapes.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visAutoLinkCustPropsLabel | 2 | Field is label for shape data (custom property); field name is label and is required.
visAutoLinkGeometryAngle | 4 | Field is angle in shape geometry.
visAutoLinkGeometryHeight | 6 | Field is height of shape.
visAutoLinkGeometryWidth | 5 | Field is width of shape.
visAutoLinkMasterName | 8 | Field is local name of the master for the shape.
visAutoLinkMasterNameU | 16 | Field is universal name of the master for the shape.
visAutoLinkObjectData1 | 11 | Field is Data1 property of Shape object.
visAutoLinkObjectData2 | 12 | Field is Data2 property of Shape object.
visAutoLinkObjectData3 | 13 | Field is Data3 property of Shape object.
visAutoLinkObjectID | 7 | Field is ID of the shape .
visAutoLinkObjectName | 9 | Field is local name of the shape.
visAutoLinkObjectNameU | 17 | Field is universal name of the shape.
visAutoLinkObjectType | 10 | Field is type of shape object.
visAutoLinkPropRowNameU | 14 | Field is universal property-row name; field name is Cell.RowNameU and is required.
visAutoLinkShapeText | 1 | Field is shape text.
visAutoLinkUserRowName | 3 | Field is user-defined cell local row name; field name is Cell.RowName and is required.
visAutoLinkUserRowNameU | 15 | Field is universal user-defined cell row name; field name is Cell.RowNameU and is required.


VisBoundingBoxArgs Enumeration (Visio)

 Copy code hover
[image]

VisBoundingBoxArgs Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to be passed to the BoundingBox method of various objects.

Constant

Value

Description

visBBoxDrawingCoords

&H2000

Return numbers in the drawing coordinate system of the page or master whose shapes are being considered. By default, the returned numbers are drawing units in the local coordinate system of the parent of the considered shapes.

visBBoxExtents

&H4

Return a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the paths stroked by the shape's geometry.

This rectangle may be larger or smaller than the shape's upright width-height box. The extents box determined for a shape of type visTypeForeignObject equals that shape's upright width-height box.

visBBoxIgnoreVisible

&H20

Ignore visible geometry.

visBBoxIncludeDataGraphics

&H10000

Include data-graphic callout shapes (and their sub-shapes) that are applied to the shape, or the shapes in a master, page, or selection. Off by default.

visBBoxIncludeGuides

&H1000

Include extents for shapes of type visTypeguide. By default, the extents of shapes of type visTypeGuide are ignored.

If you request guide extents, only the positions of vertical guides and the positions of horizontal guides contribute to the rectangle that is returned. If any vertical guides are reported on, an infinite extent is returned. If any horizontal guides are reported on, an infinite extent is returned. If any rotated guides are reported on, infinite and extents are returned.

visBBoxIncludeHidden

&H10

Include hidden geometry.

visBBoxNoNonPrint

&H4000

Ignore the extents of shapes that are non-printing. A shape is non-printing if the value of its NonPrinting cell is non-zero or it belongs only to non-printing layers.

visBBoxUprightText

&H2

Return a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the shape's text.

visBBoxUprightWH

&H1

Return a rectangle that is the smallest rectangle parallel to the local coordinate system of the shape's parent that encloses the shape's width-height box.

If the shape is not rotated, its upright width-height box and its width-height box are the same. Paths in the shape's geometry need not and often do not lie entirely within the shape's width-height box.


VisBuiltInStencilTypes Enumeration (Visio)

 Copy code hover
[image]

VisBuiltInStencilTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that identify the available stencils; passed to the GetBuiltInStencilFile and GetCustomStencilFile methods.

Version Information

Version Added: Visio 2010

Name | Value | Description
visBuiltInStencilBackgrounds | 0 | The hidden stencil that contains the shapes displayed in the Backgrounds gallery (Design tab).
visBuiltInStencilBorders | 1 | The hidden stencil that contains the shapes displayed in the Borders and Titles gallery (Design tab).
visBuiltInStencilContainers | 2 | The hidden stencil that contains the shapes displayed in the Container gallery (Insert tab).
visBuiltInStencilCallouts | 3 | The hidden stencil that contains the shapes displayed in the Callout gallery (Insert tab).
visBuiltInStencilLegends | 4 | The hidden stencil that contains the shapes displayed in the Insert Legend gallery (Data tab).


VisCellError Enumeration (Visio)

 Copy code hover
[image]

VisCellError Enumeration (Visio)
Send feedback

Published: July 16, 2012

Error codes generated by the last evaluation of a cell's formula and returned by the Cell.Error property.

Constant | Value | Description
visErrorDivideByZero | 39 | Division by zero.
visErrorName | 61 | Invalid name in cell formula.
visErrorNotAvailable | 74 | Unknown error.
visErrorNumber | 68 | Invalid number in cell formula.
visErrorReference | 55 | Invalid reference in cell formula.
visErrorSuccess | 0 | No error.
visErrorValue | 47 | Invalid value in cell formula.


VisCellIndices Enumeration (Visio)

 Copy code hover
[image]

VisCellIndices Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies logical indices of cells in ShapeSheet rows of Shape or Style objects.

Constant | Value | Description
vis1DBeginX | 0 | BeginX Cell (1-D Endpoints Section)
vis1DBeginY | 1 | BeginY Cell (1-D Endpoints Section)
vis1DEndX | 2 | EndX Cell (1-D Endpoints Section)
vis1DEndY | 3 | EndY Cell (1-D Endpoints Section)
visActionAction | 3 | Action Cell (Actions Section)
visActionBeginGroup | 8 | BeginGroup Cell (Actions Section)
visActionButtonFace | 15 | ButtonFace Cell (Actions Section)
visActionChecked | 4 | Checked Cell (Actions Section)
visActionDisabled | 5 | Disabled Cell (Actions Section)
visActionInvisible | 7 | Invisible Cell (Actions Section)
visActionMenu | 0 | Menu Cell (Actions Section)
visActionReadOnly | 6 | ReadOnly Cell (Actions Section)
visActionSortKey | 16 | SortKey Cell (Actions Section)
visActionTagName | 14 | TagName Cell (Actions Section)
visAlignBottom | 5 | AlignBottom Cell (Alignment Section)
visAlignCenter | 1 | AlignCenter Cell (Alignment Section)
visAlignLeft | 0 | AlignLeft Cell (Alignment Section)
visAlignMiddle | 4 | AlignMiddle Cell (Alignment Section)
visAlignRight | 2 | AlignRight Cell (Alignment Section)
visAlignTop | 3 | AlignTop Cell (Alignment Section)
visAnnotationComment | 5 | Comment Cell (Annotation Section)
visAnnotationDate | 4 | Date Cell (Annotation Section)
visAnnotationLangID | 6 | LangID Cell (Annotation Section)
visAnnotationMarkerIndex | 3 | In previous versions of Visio, represented the MarkerIndex Cell (Annotation Section), which is now deprecated.
visAnnotationReviewerID | 2 | ReviewerID Cell (Annotation Section)
visAnnotationX | 0 | X Cell (Annotation Section)
visAnnotationY | 1 | Y Cell (Annotation Section)
visAspectRatio | 5 | D Cell (Geometry Section)
visBegTrigger | 11 | BegTrigger Cell (Glue Info Section)
visBevelBottomHeight | 5 | BevelBottomHeight Cell (Bevel Properties Section)
visBevelBottomType | 3 | BevelBottomType Cell (Bevel Properties Section)
visBevelBottomWidth | 4 | BevelBottomWidth Cell (Bevel Properties Section)
visBevelContourColor | 8 | BevelContourColor Cell (Bevel Properties Section)
visBevelContourSize | 9 | BevelContourSize Cell (Bevel Properties Section)
visBevelDepthColor | 6 | BevelDepthColor Cell (Bevel Properties Section)
visBevelDepthSize | 7 | BevelDepthSize Cell (Bevel Properties Section)
visBevelLightingAngle | 12 | BevelLightingAngle Cell (Bevel Properties Section)
visBevelLightingType | 11 | BevelLightingType Cell (Bevel Properties Section)
visBevelMaterialType | 10 | BevelMaterialType Cell (Bevel Properties Section)
visBevelTopHeight | 2 | BevelTopHeight Cell (Bevel Properties Section)
visBevelTopType | 0 | BevelTopType Cell (Bevel Properties Section)
visBevelTopWidth | 1 | BevelTopWidth Cell (Bevel Properties Section)
visBow | 2 | A Cell (Geometry Section)
visBulletFontSize | 11 | BulletSize Cell (Paragraph Section)
visBulletFont | 9 | BulletFont Cell (Paragraph Section)
visBulletIndex | 7 | Bullet Cell (Paragraph Section)
visBulletString | 8 | BulletString Cell (Paragraph Section)
visCellFirst | 0 | Cell logically at or before every other cell in a row.
visCellInval | 255 | An index no cell will ever have.
visCellNone | 255 | Unspecified cell.
visCharacterAsianFont | 51 | AsianFont Cell (Character Section)
visCharacterCase | 3 | Case Cell (Character Section)
visCharacterColorTrans | 17 | Transparency Cell (Character Section)
visCharacterColor | 1 | Color Cell (Character Section)
visCharacterComplexScriptFont | 52 | ComplexScriptFont Cell (Character Section)
visCharacterComplexScriptSize | 54 | ComplexScriptSize Cell (Character Section)
visCharacterDblUnderline | 8 | DoubleULine Cell (Character Section)
visCharacterDoubleStrikethrough | 13 | DoubleStrikethrough Cell (Character Section)
visCharacterFont | 0 | Font Cell (Character Section)
visCharacterFontScale | 5 | Scale Cell (Character Section)
visCharacterLangID | 57 | LangID Cell (Character Section)
visCharacterLetterspace | 16 | Spacing Cell (Character Section)
visCharacterOverline | 9 | Overline Cell (Character Section)
visCharacterPos | 4 | Pos Cell (Character Section)
visCharacterSize | 7 | Size Cell (Character Section)
visCharacterStrikethru | 10 | Strikethru Cell (Character Section)
visCharacterStyle | 2 | Style Cell (Character Section)
visColorSchemeIndex | 0 | ColorSchemeIndex Cell (Theme Properties Section)
visCompoundType | 10 | Compound Type Cell (Line Format Section)
visConnectorSchemeIndex | 2 | ConnectorSchemeIndex Cell (Theme Properties Section)
visCnnctAutoGen | 5 | AutoGen Cell (Connection Points Section)
visCnnctA | 2 | DirX / A Cell (Connection Points Section)
visCnnctB | 3 | DirY / B Cell (Connection Points Section)
visCnnctC | 4 | Type / C Cell (Connection Points Section)
visCnnctDirX | 2 | DirX / A Cell (Connection Points Section)
visCnnctDirY | 3 | DirY / B Cell (Connection Points Section)
visCnnctD | 5 | D Cell (Connection Points Section)
visCnnctType | 4 | Type / C Cell (Connection Points Section)
visCnnctX | 0 | X Cell (Connection Points Section)
visCnnctY | 1 | Y Cell (Connection Points Section)
visComment | 16 | Comment Cell (Miscellaneous Section)
visCompNoFill | 0 | NoFill Cell (Geometry Section)
visCompNoLine | 1 | NoLine Cell (Geometry Section)
visCompNoQuickDrag | 5 | NoQuickDrag Cell (Geometry Section)
visCompNoShow | 2 | NoShow Cell (Geometry Section)
visCompNoSnap | 3 | NoSnap Cell (Geometry Section)
visCompPath | 4 | Path Cell (Geometry Section)
visControl1X | 2 | A Cell (Geometry Section)
visControl1Y | 3 | B Cell (Geometry Section)
visControl2X | 4 | C Cell (Geometry Section)
visControl2Y | 5 | D Cell (Geometry Section)
visControlX | 2 | A Cell (Geometry Section)
visControlY | 3 | B Cell (Geometry Section)
visCopyright | 1 | Copyright Cell (Miscellaneous Section)
visCtlGlue | 6 | Can Glue Cell (Controls Section)
visCtlTip | 8 | Tip Cell (Controls Section)
visCtlXCon | 4 | X Behavior Cell (Controls Section)
visCtlXDyn | 2 | X Dynamics Cell (Controls Section)
visCtlX | 0 | X Cell (Controls Section)
visCtlYCon | 5 | Y Behavior Cell (Controls Section)
visCtlYDyn | 3 | Y Dynamics Cell (Controls Section)
visCtlY | 1 | Y Cell (Controls Section)
visCustPropsAsk | 7 | Ask Cell (Shape Data Section)
visCustPropsCalendar | 15 | Calendar Cell (Shape Data Section)
visCustPropsDataLinked | 8 | DataLinked Cell (Shape Data Section)
visCustPropsFormat | 3 | Format Cell (Shape Data Section)
visCustPropsInvis | 6 | Invisible Cell (Shape Data Section)
visCustPropsLabel | 2 | Label Cell (Shape Data Section)
visCustPropsLangID | 14 | LangID Cell (Shape Data Section)
visCustPropsPrompt | 1 | Prompt Cell (Shape Data Section)
visCustPropsSortKey | 4 | SortKey Cell (Shape Data Section)
visCustPropsType | 5 | Type Cell (Shape Data Section)
visCustPropsValue | 0 | Value Cell (Shape Data Section)
visDocAddMarkup | 3 | AddMarkup Cell (Document Properties Section)
visDocLangID | 19 | DocLangID Cell (Document Properties Section)
visDocLockDuplicate | 7 | LockDuplicate Cell (Document Properties Section)
visDocLockPreview | 1 | LockPreview Cell (Document Properties Section)
visDocLockReplace | 5 | LockReplace Cell (Document Properties Section)
visDocNoCoauth | 6 | NoCoauth Cell (Document Properties Section)
visDocOutputFormat | 0 | OutputFormat Cell (Document Properties Section)
visDocPreviewQuality | 9 | PreviewQuality Cell (Document Properties Section)
visDocPreviewScope | 10 | PreviewScope Cell (Document Properties Section)
visDocViewMarkup | 4 | ViewMarkup Cell (Document Properties Section)
visDropSource | 17 | IsDropSource Cell (Miscellaneous Section)
visDynFeedback | 8 | DynFeedback Cell (Miscellaneous Section)
visEccentricityAngle | 4 | C Cell (Geometry Section)
visEffectSchemeIndex | 1 | EffectSchemeIndex Cell (Theme Properties Section)
visEllipseCenterX | 0 | X Cell (Geometry Section)
visEllipseCenterY | 1 | Y Cell (Geometry Section)
visEllipseMajorX | 2 | A Cell (Geometry Section)
visEllipseMajorY | 3 | B Cell (Geometry Section)
visEllipseMinorX | 4 | C Cell (Geometry Section)
visEllipseMinorY | 5 | D Cell (Geometry Section)
visEmbellishmentIndex | 7 | EmbellishmentIndex Cell (Theme Properties Section)
visEndTrigger | 12 | EndTrigger Cell (Glue Info Section)
visEvtCellDblClick | 2 | EventDblClick Cell (Events Section)
visEvtCellDrop | 4 | EventDrop Cell (Events Section)
visEvtCellMultiDrop | 22 | EventMultiDrop Cell (Events Section)
visEvtCellTheText | 1 | TheText Cell (Events Section)
visEvtCellXFMod | 3 | EventXFMod Cell (Events Section)
visFieldCalendar | 7 | Calendar Cell (Text Fields Section)
visFieldCell | 0 | Value Cell (Text Fields Section)
visFieldFormat | 2 | Format Cell (Text Fields Section)
visFieldObjectKind | 10 | ObjectKind Cell (Text Fields Section)
visFieldType | 3 | Type Cell (Text Fields Section)
visFieldUICategory | 4 | UICategory Cell (Text Fields Section)
visFieldUICode | 5 | UICode Cell (Text Fields Section)
visFieldUIFormat | 6 | UIFormat Cell (Text Fields Section)
visFillBkgndTrans | 7 | FillBkgndTrans Cell (Fill Format Section)
visFillBkgnd | 1 | FillBkgnd Cell (Fill Format Section)
visFillForegndTrans | 6 | FillForegndTrans Cell (Fill Format Section)
visFillForegnd | 0 | FillForegnd Cell (Fill Format Section)
visFillGradientAngle | 3 | FillGradientAngle Cell (Gradient Properties Section)
visFillGradientDir | 2 | FillGradientDir Cell (Gradient Properties Section)
visFillGradientEnabled | 5 | FillGradientEnabled Cell (Gradient Properties Section)
visFillPattern | 2 | FillPattern Cell (Fill Format Section)
visFillShdwBkgndTrans | 9 | In previous versions of Visio, represented the ShdwBkgndTrans Cell (Fill Format Section), which is now deprecated.
visFillShdwBkgnd | 4 | In previous versions of Visio, represented the ShdwBkgnd Cell (Fill Format Section), which is now deprecated.
visFillShdwBlur | 15 | ShapeShdwBlur Cell (Fill Format Section)
visFillShdwForegndTrans | 8 | ShdwForegndTrans Cell (Fill Format Section)
visFillShdwForegnd | 3 | ShdwForegnd Cell (Fill Format Section)
visFillShdwObliqueAngle | 13 | ShapeShdwObliqueAngle Cell (Fill Format Section)
visFillShdwOffsetX | 11 | ShapeShdwOffsetX Cell (Fill Format Section)
visFillShdwOffsetY | 12 | ShapeShdwOffsetY Cell (Fill Format Section)
visFillShdwPattern | 5 | ShdwPattern Cell (Fill Format Section)
visFillShdwScaleFactor | 14 | ShapeShdwScaleFactor Cell (Fill Format Section)
visFillShdwShow | 16 | ShapeShdwShow Cell (Fill Format Section)
visFillShdwType | 10 | ShdwType Cell (Page Properties Section)
visFlags | 13 | Flags Cell (Paragraph Section)
visFontSchemeIndex | 3 | FontSchemeIndex Cell (Theme Properties Section)
visFrgnImgClippingPath | 4 | ClippingPath Cell (Foreign Image Info Section)
visFrgnImgHeight | 3 | ImgHeight Cell (Foreign Image Info Section)
visFrgnImgOffsetX | 0 | ImgOffsetX Cell (Foreign Image Info Section)
visFrgnImgOffsetY | 1 | ImgOffsetY Cell (Foreign Image Info Section)
visFrgnImgWidth | 2 | ImgWidth Cell (Foreign Image Info Section)
visGlowColor | 4 | GlowColor Cell (Additional Effect Properties Section)
visGlowColorTrans | 5 | GlowColorTrans Cell (Additional Effect Properties Section)
visGlowSize | 6 | GlowSize Cell (Additional Effect Properties Section)
visGlueType | 9 | GlueType Cell (Glue Info Section)
visGradientStopColor | 0 | Color Cell (Fill Gradient Stops Section)
visGradientStopColorTrans | 1 | Trans Cell (Fill Gradient Stops Section)
visGradientStopPosition | 2 | Position (Fill Gradient Stops Section)
visGroupDisplayMode | 1 | DisplayMode Cell (Group Properties Section)
visGroupDontMoveChildren | 5 | DontMoveChildren Cell (Group Properties Section)
visGroupIsDropTarget | 2 | IsDropTarget Cell (Group Properties Section)
visGroupIsSnapTarget | 3 | IsSnapTarget Cell (Group Properties Section)
visGroupIsTextEditTarget | 4 | IsTextEditTarget Cell (Group Properties Section)
visGroupSelectMode | 0 | SelectMode Cell (Group Properties Section)
visHideText | 5 | HideText Cell (Miscellaneous Section)
visHLinkAddress | 1 | Address Cell (Hyperlinks Section)
visHLinkDefault | 7 | Default Cell (Hyperlinks Section)
visHLinkDescription | 0 | Description Cell (Hyperlinks Section)
visHLinkExtraInfo | 3 | ExtraInfo Cell (Hyperlinks Section)
visHLinkFrame | 4 | Frame Cell (Hyperlinks Section)
visHLinkInvisible | 8 | Invisible Cell (Hyperlinks Section)
visHLinkNewWin | 5 | NewWindow Cell (Hyperlinks Section)
visHLinkSortKey | 15 | SortKey Cell (Hyperlinks Section)
visHLinkSubAddress | 2 | SubAddress Cell (Hyperlinks Section)
visHorzAlign | 6 | HAlign Cell (Paragraph Section)
visImageBlur | 4 | Blur Cell (Image Properties Section)
visImageBrightness | 2 | Brightness Cell (Image Properties Section)
visImageContrast | 1 | Contrast Cell (Image Properties Section)
visImageDenoise | 5 | Denoise Cell (Image Properties Section)
visImageGamma | 0 | Gamma Cell (Image Properties Section)
visImageSharpen | 3 | Sharpen Cell (Image Properties Section)
visImageTransparency | 6 | Transparency Cell (Image Properties Section)
visIndentFirst | 0 | IndFirst Cell (Paragraph Section)
visIndentLeft | 1 | IndLeft Cell (Paragraph Section)
visIndentRight | 2 | IndRight Cell (Paragraph Section)
visInfiniteLineX1 | 0 | X Cell (Geometry Section)
visInfiniteLineX2 | 2 | A Cell (Geometry Section)
visInfiniteLineY1 | 1 | Y Cell (Geometry Section)
visInfiniteLineY2 | 3 | B Cell (Geometry Section)
visLayerActive | 6 | Active Cell (Layers Section)
visLayerColorTrans | 11 | Transparency Cell (Layers Section)
visLayerColor | 2 | Color Cell (Layers Section)
visLayerGlue | 9 | Glue Cell (Layers Section)
visLayerLock | 7 | Lock Cell (Layers Section)
visLayerMember | 0 | Layer Membership Cell (Layer Membership Section)
visLayerNameUniv | 10 | Universal Name Cell (Layers Section)
visLayerName | 0 | Name Cell (Layers Section)
visLayerPrint | 5 | Print Cell (Layers Section)
visLayerSnap | 8 | Snap Cell (Layers Section)
visLayerStatus | 3 | Status Cell (Layers Section)
visLayerVisible | 4 | Visible Cell (Layers Section)
visLineBeginArrowSize | 8 | BeginArrowSize Cell (Line Format Section)
visLineBeginArrow | 5 | BeginArrow Cell (Line Format Section)
visLineColorTrans | 9 | LineColorTrans Cell (Line Format Section)
visLineColor | 1 | LineColor Cell (Line Format Section)
visLineEndArrowSize | 4 | EndArrowSize Cell (Line Format Section)
visLineEndArrow | 6 | EndArrow Cell (Line Format Section)
visLineEndCap | 7 | LineCap Cell (Line Format Section)
visLineGradientAngle | 1 | LineGradientAngle Cell (Gradient Properties Section)
visLineGradientDir | 0 | LineGradientDir Cell (Gradient Properties Section)
visLineGradientEnabled | 4 | LineGradientEnabled Cell (Gradient Properties Section)
visLinePattern | 2 | LinePattern Cell (Line Format Section)
visLineRounding | 3 | Rounding Cell (Line Format Section)
visLineWeight | 0 | LineWeight Cell (Line Format Section)
visLockAspect | 4 | LockAspect Cell (Protection Section)
visLockBegin | 6 | LockBegin Cell (Protection Section)
visLockCalcWH | 14 | LockCalcWH Cell (Protection Section)
visLockCrop | 9 | LockCrop Cell (Protection Section)
visLockCustProp | 16 | LockCustProp Cell (Protection Section)
visLockDelete | 5 | LockDelete Cell (Protection Section)
visLockEnd | 7 | LockEnd Cell (Protection Section)
visLockFormat | 12 | LockFormat Cell (Protection Section)
visLockFromGroupFormat | 17 | LockFromGroupFormat Cell (Protection Section)
visLockGroup | 13 | LockGroup Cell (Protection Section)
visLockHeight | 1 | LockHeight Cell (Protection Section)
visLockMoveX | 2 | LockMoveX Cell (Protection Section)
visLockMoveY | 3 | LockMoveY Cell (Protection Section)
visLockReplace | 23 | LockReplace Cell (Protection Cell)
visLockRotate | 8 | LockRotate Cell (Protection Section)
visLockSelect | 15 | LockSelect Cell (Protection Section)
visLockTextEdit | 11 | LockTextEdit Cell (Protection Section)
visLockThemeColors | 18 | LockThemeColors Cell (Protection Section)
visLockThemeConnectors | 20 | LockThemeConnectors Cell (Protection Section)
visLockThemeEffects | 19 | LockThemeEffects Cell (Protection Section)
visLockThemeFonts | 21 | LockThemeFonts Cell (Protection Section)
visLockThemeIndex | 22 | LockThemeIndex Cell (Protection Section)
visLockVariation | 24 | LockVariation Cell (Protection Section)
visLockVtxEdit | 10 | LockVtxEdit Cell (Protection Section)
visLockWidth | 0 | LockWidth Cell (Protection Section)
visLOFlags | 13 | ObjType Cell (Miscellaneous Section)
visNoAlignBox | 3 | NoAlignBox Cell (Miscellaneous Section)
visNoCtlHandles | 2 | NoCtlHandles Cell (Miscellaneous Section)
visNoLiveDynamics | 18 | NoLiveDynamics Cell (Miscellaneous Section)
visNonPrinting | 1 | NonPrinting Cell (Miscellaneous Section)
visNoObjHandles | 0 | NoObjHandles Cell (Miscellaneous Section)
visNURBSData | 6 | E Cell (Geometry Section)
visNURBSKnotPrev | 4 | C Cell (Geometry Section)
visNURBSKnot | 2 | A Cell (Geometry Section)
visNURBSWeightPrev | 5 | D Cell (Geometry Section)
visNURBSWeight | 3 | B Cell (Geometry Section)
visObjCalendar | 25 | Calendar Cell (Miscellaneous Section)
visObjDropOnPageScale | 28 | DropOnPageScale Cell (Miscellaneous Section)
visObjHelp | 0 | HelpTopic Cell (Miscellaneous Section)
visObjKeywords | 27 | ShapeKeywords cell (Miscellaneous Section)
visObjLangID | 26 | LangID Cell (Miscellaneous Section)
visObjLocalizeMerge | 19 | LocalizeMerge Cell (Miscellaneous Section)
visObjNoProofing | 20 | NoProofing Cell (Miscellaneous Section)
visObjTheme | 29 | Reserved for internal use only.
visObjThemeModern | 30 | Reserved for internal use only.
visPageDrawingScale | 5 | DrawingScale Cell (Page Properties Section)
visPageDrawScaleType | 7 | DrawingScaleType Cell (Page Properties Section)
visPageDrawSizeType | 6 | DrawingSizeType Cell (Page Properties Section)
visPageHeight | 1 | PageHeight Cell (Page Properties Section)
visPageInhibitSnap | 26 | InhibitSnap Cell (Page Properties Section)
visPageLockDuplicate | 30 | PageLockDuplicate Cell (Page Properties Section)
visPageLockReplace | 28 | PageLockReplace Cell (Page Properties Section)
visPageScale | 4 | InhibitSnap Cell (Page Properties Section)
visPageShdwObliqueAngle | 36 | ShdwObliqueAngle Cell (Page Properties Section)
visPageShdwOffsetX | 2 | ShdwOffsetX Cell (Page Properties Section)
visPageShdwOffsetY | 3 | ShdwOffsetY Cell (Page Properties Section)
visPageShdwScaleFactor | 37 | ShdwScaleFactor Cell (Page Properties Section)
visPageShdwType | 35 | ShdwType Cell (Page Properties Section)
visPageUIVisibility | 34 | UIVisibility Cell (Page Properties Section)
visPageWidth | 0 | PageWidth Cell (Page Properties Section)
visPageZOrderChanged | 39 | Reserved for internal use only.
visPLOAvenueSizeX | 20 | AvenueSizeX Cell (Page Layout Section)
visPLOAvenueSizeY | 21 | AvenueSizeY Cell (Page Layout Section)
visPLOAvoidPageBreaks | 4 | AvoidPageBreaks Cell (Page Layout Section)
visPLOBlockSizeX | 18 | BlockSizeX Cell (Page Layout Section)
visPLOBlockSizeY | 19 | BlockSizeY Cell (Page Layout Section)
visPLOCtrlAsInput | 3 | CtrlAsInput Cell (Page Layout Section)
visPLODynamicsOff | 2 | DynamicsOff Cell (Page Layout Section)
visPLOEnableGrid | 1 | EnableGrid Cell (Page Layout Section)
visPLOJumpCode | 12 | LineJumpCode Cell (Page Layout Section)
visPLOJumpDirX | 14 | LineJumpFactorX Cell (Page Layout Section)
visPLOJumpDirY | 15 | LineJumpFactorY Cell (Page Layout Section)
visPLOJumpFactorX | 24 | LineJumpFactorX Cell (Page Layout Section)
visPLOJumpFactorY | 25 | LineJumpFactorXYCell (Page Layout Section)
visPLOJumpStyle | 13 | LineJumpStyle Cell (Page Layout Section)
visPLOLineAdjustFrom | 26 | LineAdjustFrom Cell (Page Layout Section)
visPLOLineAdjustTo | 27 | LineAdjustTo Cell (Page Layout Section)
visPLOLineRouteExt | 29 | LineRouteExt Cell (Page Layout Section)
visPLOLineToLineX | 22 | LineToLineX Cell (Page Layout Section)
visPLOLineToLineY | 23 | LineToLineY Cell (Page Layout Section)
visPLOLineToNodeX | 16 | LineToNodeX Cell (Page Layout Section)
visPLOLineToNodeY | 17 | LineToNodeY Cell (Page Layout Section)
visPLOPlaceDepth | 10 | PlaceDepth Cell (Page Layout Section)
visPLOPlaceFlip | 28 | PlaceFlip Cell (Page Layout Section)
visPLOPlaceStyle | 8 | PlaceStyle Cell (Page Layout Section)
visPLOPlowCode | 11 | PlowCode Cell (Page Layout Section)
visPLOResizePage | 0 | ResizePage Cell (Page Layout Section)
visPLORouteStyle | 9 | RouteStyle Cell (Page Layout Section)
visPLOSplit | 30 | PageShapeSplit Cell (Page Layout Section)
visPolylineData | 2 | A Cell (Geometry Section)
visPrintPropertiesBottomMargin | 3 | PageBottomMargin Cell (Print Properties Section)
visPrintPropertiesCenterX | 8 | CenterX Cell (Print Properties Section)
visPrintPropertiesCenterY | 9 | CenterY Cell (Print Properties Section)
visPrintPropertiesLeftMargin | 0 | PageLeftMargin Cell (Print Properties Section)
visPrintPropertiesOnPage | 10 | OnPage Cell (Print Properties Section)
visPrintPropertiesPageOrientation | 16 | PrintPageOrientation Cell (Print Properties Section)
visPrintPropertiesPagesX | 6 | PagesX Cell (Print Properties Section)
visPrintPropertiesPagesY | 7 | PagesY Cell (Print Properties Section)
visPrintPropertiesPaperKind | 17 | PaperKind Cell (Print Properties Section)
visPrintPropertiesPaperSource | 18 | PaperSource Cell (Print Properties Section)
visPrintPropertiesPrintGrid | 11 | PrintGrid Cell (Print Properties Section)
visPrintPropertiesRightMargin | 1 | PageRightMargin Cell (Print Properties Section)
visPrintPropertiesScaleX | 4 | ScaleX Cell (Print Properties Section)
visPrintPropertiesScaleY | 5 | ScaleY Cell (Print Properties Section)
visPrintPropertiesTopMargin | 2 | PageTopMargin Cell (Print Properties Section)
visQuickStyleEffectsMatrix | 6 | QuickStyleEffectsMatrix Cell (Quick Style Section)
visQuickStyleFillColor | 1 | QuickStyleFillColor Cell (Quick Style Section)
visQuickStyleFillMatrix | 5 | QuickStyleFillMatrix Cell (Quick Style Section)
visQuickStyleFontColor | 3 | QuickStyleFontColor Cell (Quick Style Section)
visQuickStyleFontMatrix | 7 | QuickStyleFontMatrix Cell (Quick Style Section)
visQuickStyleLineColor | 0 | QuickStyleLineColor Cell (Quick Style Section)
visQuickStyleLineMatrix | 4 | QuickStyleLineMatrix Cell (Quick Style Section)
visQuickStyleShadowColor | 2 | QuickStyleShadowColor Cell (Quick Style Section)
visQuickStyleType | 8 | QuickStyleType Cell (Quick Style Section)
visQuickStyleVariation | 9 | QuickStyleVariation Cell (Quick Style Section)
visReflectionBlur | 3 | ReflectionBlur Cell (Additional Effects Properties Section)
visReflectionDist | 2 | ReflectionDist Cell (Additional Effects Properties Section)
visReflectionSize | 1 | ReflectionSize Cell (Additional Effects Properties Section)
visReflectionTrans | 0 | ReflectionTrans Cell (Additional Effects Properties Section)
visReplaceCopyCells | 3 | ReplaceCopyCells Cell (Change Shape Behavior Section)
visReplaceLockFormat | 2 | ReplaceLockFormat Cell (Change Shape Behavior Section)
visReplaceLockShapeData | 1 | ReplaceLockShapeData Cell (Change Shape Behavior Section)
visReplaceLockText | 0 | ReplaceLockText Cell (Change Shape Behavior Section)
visReviewerColor | 2 | Color Cell (Reviewer Section)
visReviewerCurrentIndex | 4 | CurrentIndex Cell (Reviewer Section)
visReviewerInitials | 1 | Initials Cell (Reviewer Section)
visReviewerName | 0 | Name Cell (Reviewer Section)
visReviewerReviewerID | 3 | ReviewerID Cell (Reviewer Section)
visRotateGradientWithShape | 6 | RotateGradientWithShape Cell (Gradient Properties Section)
visRotationType | 3 | RotationType Cell (3-D Rotation Properties Section)
visRotationXAngle | 0 | RotationXAngle Cell (3-D Rotation Properties Section)
visRotationYAngle | 1 | RotationYAngle Cell (3-D Rotation Properties Section)
visRotationZAngle | 2 | RotationZAngle Cell (3-D Rotation Properties Section)
visKeepTextFlat | 6 | KeepTextFlat Cell (3-D Rotation Properties Section)
visDistanceFromGround | 5 | DistanceFromGround Cell (3-D Rotation Properties Section)
visPerspective | 4 | Perspective Cell (3-D Rotation Properties Section)
visScratchA | 2 | A Cell (Scratch Section)
visScratchB | 3 | B Cell (Scratch Section)
visScratchC | 4 | C Cell (Scratch Section)
visScratchD | 5 | D Cell (Scratch Section)
visScratchX | 0 | X Cell (Scratch Section)
visScratchY | 1 | Y Cell (Scratch Section)
visSketchAmount | 10 | SketchAmount Cell (Additional Effect Properties Section)
visSketchEnabled | 9 | SketchEnabled Cell (Additional Effect Properties Section)
visSketchFillChange | 13 | SketchFillChange Cell (Additional Effect Properties Section)
visSketchLineChange | 12 | SketchLineChange Cell (Additional Effect Properties Section)
visSketchLineWeight | 11 | SketchLineWeight Cell (Additional Effect Properties Section)
visSketchSeed | 8 | SketchSeed Cell (Additional Effect Properties Section)
visSLOCategoryChanged | 24 | Reserved for internal use only.
visSLOConFixedCode | 12 | ConFixedCode Cell (Shape Layout Section)
visSLOFixedCode | 8 | ShapeFixedCode Cell (Shape Layout Section)
visSLOJumpCode | 13 | ConLineJumpCode Cell (Shape Layout Section)
visSLOJumpDirX | 16 | ConLineJumpDirX Cell (Shape Layout Section)
visSLOJumpDirY | 17 | ConLineJumpDirY Cell (Shape Layout Section)
visSLOJumpStyle | 14 | ConLineJumpStyle Cell (Shape Layout Section)
visSLOLineRouteExt | 19 | ConLineRouteExt Cell (Shape Layout Section)
visSLOPermeablePlace | 2 | ShapePermeablePlace Cell (Shape Layout Section)
visSLOPermX | 0 | ShapePermeableX Cell (Shape Layout Section)
visSLOPermY | 1 | ShapePermeableY Cell (Shape Layout Section)
visSLOPlaceFlip | 18 | ShapePlaceFlip Cell (Shape Layout Section)
visSLOPlaceStyle | 11 | ShapePlaceStyle Cell (Shape Layout Section)
visSLOPlowCode | 9 | ShapePlowCode Cell (Shape Layout Section)
visSLORelationships | 3 | Relationships Cell (Shape Layout Section)
visSLORelChanged | 23 | Reserved for internal use only.
visSLORouteStyle | 10 | ShapeRouteStyle Cell (Shape Layout Section)
visSLOSplittable | 21 | ShapeSplittable Cell (Shape Layout Section)
visSLOSplit | 20 | ShapeSplit Cell (Shape Layout Section)
visSLOZOrderChanged | 25 | ZOrderChanged Cell (Shape Layout Section)
visSmartTagButtonFace | 6 | ButtonFace Cell (Smart Tags Section)
visSmartTagDescription | 15 | Description Cell (Smart Tags Section)
visSmartTagDisabled | 7 | Disabled Cell (Smart Tags Section)
visSmartTagDisplayMode | 5 | DisplayMode Cell (Smart Tags Section)
visSmartTagName | 2 | TagName Cell (Smart Tags Section)
visSmartTagXJustify | 3 | X Justify Cell (Smart Tags Section)
visSmartTagX | 0 | X Cell (Smart Tags Section)
visSmartTagYJustify | 4 | Y Justify Cell (Smart Tags Section)
visSmartTagY | 1 | Y Cell (Smart Tags Section)
visSoftEdgeSize | 7 | SoftEdgesSize Cell (Additional Effect Properties Section)
visSpaceAfter | 5 | SpAfter Cell (Paragraph Section)
visSpaceBefore | 4 | SpBefore Cell (Paragraph Section)
visSpaceLine | 3 | SpLine Cell (Paragraph Section)
visSplineDegree | 5 | D Cell (Geometry Section)
visSplineKnot2 | 3 | B Cell (Geometry Section)
visSplineKnot3 | 4 | C Cell (Geometry Section)
visSplineKnot | 2 | A Cell (Geometry Section)
visStyleHidden | 3 | HideForApply Cell (Style Properties Section)
visStyleIncludesFill | 1 | EnableFillProps Cell (Style Properties Section)
visStyleIncludesLine | 0 | EnableLineProps Cell (Style Properties Section)
visStyleIncludesText | 2 | EnableTextProps Cell (Style Properties Section)
visTabAlign | 2 | Alignment Cell (Tabs Section)
visTabPos | 1 | Position Cell (Tabs Section)
visTabStopCount | 0 | X1 Cell (Tabs Section)
visTextPosAfterBullet | 12 | TextPosAfterBullet Cell (Paragraph Section)
visThemeIndex | 4 | ThemeIndex Cell (Theme Properties Section)
visTxtBlkBkgndTrans | 11 | TextBkgndTrans Cell (Text Block Format Section)
visTxtBlkBkgnd | 5 | TextBkgnd Cell (Text Block Format Section)
visTxtBlkBottomMargin | 3 | BottomMargin Cell (Text Block Format Section)
visTxtBlkDefaultTabStop | 6 | DefaultTabstop Cell (Text Block Format Section)
visTxtBlkDirection | 10 | TextDirection Cell (Text Block Format Section)
visTxtBlkLeftMargin | 0 | LeftMargin Cell (Text Block Format Section)
visTxtBlkRightMargin | 1 | RightMargin Cell (Text Block Format Section)
visTxtBlkTopMargin | 2 | TopMargin Cell (Text Block Format Section)
visTxtBlkVerticalAlign | 4 | VerticalAlign Cell (Text Block Format Section)
visUpdateAlignBox | 4 | UpdateAlignBox Cell (Miscellaneous Section)
visUseGroupGradient | 7 | UseGroupGradient Cell (Gradient Properties Section)
visUserPrompt | 1 | Prompt Cell (User-Defined Cells Section)
visUserValue | 0 | Value Cell (User-Defined Cells Section)
visVariationColorIndex | 5 | VariationColorIndex Cell (Theme Properties Section)
visVariationStyleIndex | 6 | VariationStyleIndex Cell (Theme Properties Section)
visWalkPref | 10 | WalkPreference Cell (Glue Info Section)
visXFormAngle | 6 | Angle Cell (Shape Transform Section)
visXFormFlipX | 7 | FlipX Cell (Shape Transform Section)
visXFormFlipY | 8 | FlipY Cell (Shape Transform Section)
visXFormHeight | 3 | Height Cell (Shape Transform Section)
visXFormLocPinX | 4 | LocPinX Cell (Shape Transform Section)
visXFormLocPinY | 5 | LocPinY Cell (Shape Transform Section)
visXFormPinX | 0 | PinX Cell (Shape Transform Section)
visXFormPinY | 1 | PinY Cell (Shape Transform Section)
visXFormResizeMode | 9 | ResizeMode Cell (Shape Transform Section)
visXFormWidth | 2 | Width Cell (Shape Transform Section)
visXGridDensity | 6 | XGridDensity Cell (Ruler & Grid Section)
visXGridOrigin | 10 | XGridOrigin Cell (Ruler & Grid Section)
visXGridSpacing | 8 | XGridSpacing Cell (Ruler & Grid Section)
visXRulerDensity | 0 | XRulerDensity Cell (Ruler & Grid Section)
visXRulerOrigin | 4 | XRulerOrigin Cell (Ruler & Grid Section)
visX | 0 | X Cell (Geometry Section)
visYGridDensity | 7 | YGridDensity Cell (Ruler & Grid Section)
visYGridOrigin | 11 | YGridOrigin Cell (Ruler & Grid Section)
visYGridSpacing | 9 | YGridSpacing Cell (Ruler & Grid Section)
visYRulerDensity | 1 | YRulerDensity Cell (Ruler & Grid Section)
visYRulerOrigin | 5 | YRulerOrigin Cell (Ruler & Grid Section)
visY | 1 | Y Cell (Geometry Section)


VisCellVals Enumeration (Visio)

 Copy code hover
[image]

VisCellVals Enumeration (Visio)
Send feedback

Published: July 16, 2012

Symbolic values for certain cells.

Constant | Value
visArchitectural | 1
visArrowSizeColossal | 6
visArrowSizeJumbo | 5
visArrowSizeLarge | 3
visArrowSizeMedium | 2
visArrowSizeSmall | 1
visArrowSizeVeryLarge | 4
visArrowSizeVerySmall | 0
visBackDotsMini | 8
visBackDotsWide | 18
visBold | 1
visCalArabicHijri | 1
visCalChineseTaiwan | 3
visCalHebrewLunar | 2
visCalJapaneseEmperor | 4
visCalKoreanDanki | 6
visCalSakaEra | 7
visCaltableHeaderaiBuddhist | 5
visCalTranslitEnglish | 8
visCalTranslitFrench | 9
visCalWestern | 0
visCaseAllCaps | 1
visCaseInitialCaps | 2
visCaseNormal | 0
visCnnctTypeInwardOutward | 2
visCnnctTypeInward | 0
visCnnctTypeOutward | 1
visComplexBold | 16
visComplexItalic | 32
visCtlLockedHidden | 6
visCtlLocked | 1
visCtlOffsetMaxHidden | 9
visCtlOffsetMax | 4
visCtlOffsetMidHidden | 8
visCtlOffsetMid | 3
visCtlOffsetMinHidden | 7
visCtlOffsetMin | 2
visCtlProportionalHidden | 5
visCtlProportional | 0
visCustom | 3
visDocPreviewQualityDetailed | 1
visDocPreviewQualityDraft | 0
visDocPreviewScope1stPage | 0
visDocPreviewScopeNone | 1
visDSArch | 7
visDSEngr | 6
visDSMetric | 5
visDynFBDefault | 0
visDynFBUCon3Leg | 1
visDynFBUCon5Leg | 2
visEngineering | 2
visForeDotsMini | 10
visForeDotsNarrow | 11
visForeDotsWide | 12
visFSTOblique | 2
visFSTPageDefault | 0
visFSTSimple | 1
visGlueTypeDefault | 0
visGlueTypeNoWalkingTo | 8
visGlueTypeNoWalking | 4
visGlueTypeWalking | 2
visGridCoarse | 2
visGridFine | 8
visGridFixed | 0
visGridNormal | 4
visGrpDispModeBack | 1
visGrpDispModeFront | 2
visGrpDispModeNone | 0
visGrpSelModeGroup1st | 1
visGrpSelModeGroupOnly | 0
visGrpSelModeMembers1st | 2
visHalfAndHalf | 9
visHorzCenter | 1
visHorzDistribute | 4
visHorzJustifyHigh | 8
visHorzJustifyLow | 6
visHorzJustifyMedium | 7
visHorzJustify | 3
visHorzLeft | 0
visHorzRight | 2
visItalic | 2
visLayerAvailable | 2
visLayerDeleted | 1
visLayerValid | 0
visLocFontAlways | 1
visLocFontIfArialOrSym | 0
visLocFontNever | 2
visLOFlagsDont | 4
visLOFlagsPlacable | 1
visLOFlagsPNRGroup | 8
visLOFlagsRoutable | 2
visLOFlagsVisDecides | 0
visLOFlipDefault | 0
visLOFlipNone | 8
visLOFlipRotate | 4
visLOFlipX | 1
visLOFlipY | 2
visLogical | 4
visLOJumpDirXDefault | 0
visLOJumpDirXDown | 2
visLOJumpDirXUp | 1
visLOJumpDirYDefault | 0
visLOJumpDirYLeft | 1
visLOJumpDirYRight | 2
visLOJumpStyle2Point | 5
visLOJumpStyle3Point | 6
visLOJumpStyle4Point | 7
visLOJumpStyle5Point | 8
visLOJumpStyle6Point | 9
visLOJumpStyleArc | 1
visLOJumpStyleDefault | 0
visLOJumpStyleGap | 2
visLOJumpStyleSquare | 3
visLOJumpStyleTriangle | 4
visLOPlaceBottomToTop | 4
visLOPlaceCircular | 6
visLOPlaceCompactDownLeft | 14
visLOPlaceCompactDownRight | 7
visLOPlaceCompactLeftDown | 13
visLOPlaceCompactLeftUp | 12
visLOPlaceCompactRightDown | 8
visLOPlaceCompactRightUp | 9
visLOPlaceCompactUpLeft | 11
visLOPlaceCompactUpRight | 10
visLOPlaceDefault | 0
visLOPlaceHierarchyBottomToTopCenter | 20
visLOPlaceHierarchyBottomToTopLeft | 19
visLOPlaceHierarchyBottomToTopRight | 21
visLOPlaceHierarchyLeftToRightBottom | 24
visLOPlaceHierarchyLeftToRightMiddle | 23
visLOPlaceHierarchyLeftToRightTop | 22
visLOPlaceHierarchyRightToLeftBottom | 27
visLOPlaceHierarchyRightToLeftMiddle | 26
visLOPlaceHierarchyRightToLeftTop | 25
visLOPlaceHierarchyTopToBottomCenter | 17
visLOPlaceHierarchyTopToBottomLeft | 16
visLOPlaceHierarchyTopToBottomRight | 18
visLOPlaceLeftToRight | 2
visLOPlaceParentDefault | 15
visLOPlaceRadial | 3
visLOPlaceRightToLeft | 5
visLOPlaceTopToBottom | 1
visLORouteCenterToCenter | 16
visLORouteDefault | 0
visLORouteExtDefault | 0
visLORouteExtNURBS | 2
visLORouteExtStraight | 1
visLORouteFlowchartEW | 13
visLORouteFlowchartNS | 5
visLORouteFlowchartSN | 12
visLORouteFlowchartWE | 6
visLORouteNetwork | 9
visLORouteOrgChartEW | 11
visLORouteOrgChartNS | 3
visLORouteOrgChartSN | 10
visLORouteOrgChartWE | 4
visLORouteRightAngle | 1
visLORouteSimpleEW | 20
visLORouteSimpleHV | 21
visLORouteSimpleNS | 17
visLORouteSimpleSN | 19
visLORouteSimpleVH | 22
visLORouteSimpleWE | 18
visLORouteStraight | 2
visLORouteTreeEW | 15
visLORouteTreeNS | 7
visLORouteTreeSN | 14
visLORouteTreeWE | 8
visNoFill | 0
visNoLayerColor | 255
visNoScale | 0
visPLOJumpDisplayOrder | 4
visPLOJumpHorizontal | 1
visPLOJumpLastRouted | 3
visPLOJumpNone | 0
visPLOJumpProhibitAll | 6
visPLOJumpReverseDisplayOrder | 5
visPLOJumpVertical | 2
visPLOLineAdjustFromAll | 1
visPLOLineAdjustFromNone | 2
visPLOLineAdjustFromNotRelated | 0
visPLOLineAdjustFromRoutingDefault | 3
visPLOLineAdjustToAll | 1
visPLOLineAdjustToDefault | 0
visPLOLineAdjustToNone | 2
visPLOLineAdjustToRelated | 3
visPLOPlaceBottomToTop | 4
visPLOPlaceCircular | 6
visPLOPlaceCompactDownLeft | 14
visPLOPlaceCompactDownRight | 7
visPLOPlaceCompactLeftDown | 13
visPLOPlaceCompactLeftUp | 12
visPLOPlaceCompactRightDown | 8
visPLOPlaceCompactRightUp | 9
visPLOPlaceCompactUpLeft | 11
visPLOPlaceCompactUpRight | 10
visPLOPlaceDefault | 0
visPLOPlaceDeptableHeaderDeep | 2
visPLOPlaceDeptableHeaderDefault | 0
visPLOPlaceDeptableHeaderMedium | 1
visPLOPlaceDeptableHeaderShallow | 3
visPLOPlaceLeftToRight | 2
visPLOPlaceRadial | 3
visPLOPlaceRightToLeft | 5
visPLOPlaceTopToBottom | 1
visPLOPlowAll | 1
visPLOPlowNone | 0
visPLOSplitAllow | 1
visPLOSplitNone | 0
visPosNormal | 0
visPosSub | 2
visPosSuper | 1
visPPFlagsRTLText | 1
visPPOLandscape | 2
visPPOPortrait | 1
visPPOSameAsPrinter | 0
visPrintSetup | 0
visPropTypeBool | 3
visPropTypeCurrency | 7
visPropTypeDate | 5
visPropTypeDuration | 6
visPropTypeListFix | 1
visPropTypeListVar | 4
visPropTypeNumber | 2
visPropTypeString | 0
visRulerCoarse | 8
visRulerFine | 32
visRulerFixed | 0
visRulerNormal | 16
visScaleCustom | 3
visScaleMechanical | 5
visScaleMetric | 4
visSLOConFixedRerouteAsNeeded | 1
visSLOConFixedRerouteFreely | 0
visSLOConFixedRerouteNever | 2
visSLOConFixedRerouteOnCrossover | 3
visSLOFixedConnPtsIgnore | 32
visSLOFixedConnPtsOnly | 64
visSLOFixedNoFoldToShape | 128
visSLOFixedPermeablePlow | 4
visSLOFixedPlacement | 1
visSLOFixedPlow | 2
visSLOJumpAlways | 2
visSLOJumpDefault | 0
visSLOJumpNeitableHeaderer | 4
visSLOJumpNever | 1
visSLOJumpOtableHeaderer | 3
visSLOPlowAlways | 2
visSLOPlowDefault | 0
visSLOPlowNever | 1
visSLOSplitAllow | 1
visSLOSplitNone | 0
visSLOSplittableAllow | 1
visSLOSplittableNone | 0
visSmallCaps | 8
visSmartTagDispModeAlways | 2
visSmartTagDispModeMouseOver | 0
visSmartTagDispModeShapeSelected | 1
visSmartTagXJustifyCenter | 1
visSmartTagXJustifyLeft | 0
visSmartTagXJustifyRight | 2
visSmartTagYJustifyBottom | 2
visSmartTagYJustifyMiddle | 1
visSmartTagYJustifyTop | 0
visSolid | 1
visStandard | 2
visTabStopCenter | 1
visTabStopComma | 4
visTabStopDecimal | 3
visTabStopLeft | 0
visTabStopRight | 2
visTFOKHorizontalInVertical | 1
visTFOKStandard | 0
vistableHeaderickDiagonalCross | 17
vistableHeaderickDownDiagonal | 15
vistableHeaderickHorz | 13
vistableHeaderickUpDiagonal | 16
vistableHeaderickVertical | 14
vistableHeaderinCross | 23
vistableHeaderinDiagonalCross | 24
vistableHeaderinDownDiagonal | 21
vistableHeaderinHorz | 19
vistableHeaderinUpDiagonal | 22
vistableHeaderinVert | 20
visTight | 1
visTxtBlkFlagsHideHiddens | 1
visTxtBlkLeftToRight | 0
visTxtBlkOpaque | 255
visTxtBlkTopToBottom | 1
visUIVHidden | 1
visUIVNormal | 0
visUnderLine | 4
visVertBottom | 2
visVertMiddle | 1
visVertTop | 0
visWalkPrefBegNS | 1
visWalkPrefEndNS | 2
visWideCross | 3
visWideDiagonalCross | 4
visWideDownDiagonal | 5
visWideHorz | 6
visWideUpDiagonal | 2
visWideVert | 7
visXFormResizeDontCare | 0
visXFormResizeScale | 2
visXFormResizeSpread | 1


VisCenterViewFlags Enumeration (Visio)

 Copy code hover
[image]

VisCenterViewFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define the different ways to center the view; passed to the Windows.CenterViewOnShape method.

Version Information

Version Added: Visio 2010

Name | Value | Description
visCenterViewDefault | 0 | Display the page that contains the specified shape, and center the view on the shape.
visCenterViewIfOffScreen | 1 | Center the view only if the shape is currently off screen.
visCenterViewSelectShape | 2 | Display the page that contains the specified shape, center the view on the shape, and select the shape.


VisCharsBias Enumeration (Visio)

 Copy code hover
[image]

VisCharsBias Enumeration (Visio)
Send feedback

Published: July 16, 2012

Bias constants to be passed to the Characters.CharPropsRow property and similar properties.

Constant | Value | Description
visBiasLeft | 1 | Specifies the ShapeSheet row that covers character formatting for the character to the left of the insertion point.
visBiasLetVisioChoose | 0 | Specifies that Microsoft Visio decide the kind of character formatting to apply based on certain rules. See the Characters.CharPropsRow property topic for more information.
visBiasRight | 2 | Specifies the ShapeSheet row that covers character formatting for the character to the right of the insertion point.


VisConnectedShapesFlags Enumeration (Visio)

 Copy code hover
[image]

VisConnectedShapesFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that identify shapes by the directionality of their connectors; passed to the Shape.ConnectedShapes method.

Note Note

Connection points that have dual directionality (both inward and outward) are identified as either incoming or outgoing based on how they are used in a particular connection.

Version Information

Version Added: Visio 2010

Name | Value | Description
visConnectedShapesAllNodes | 0 | The shapes that are connected by using either incoming or outgoing connections.
visConnectedShapesIncomingNodes | 1 | The shapes that are connected by using incoming connections.
visConnectedShapesOutgoingNodes | 2 | The shapes that are connected by using outgoing connections.


VisConnectorEnds Enumeration (Visio)

 Copy code hover
[image]

VisConnectorEnds Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define the end points of a connector; passed to the Shape.Disconnect method.

Version Information

Version Added: Visio 2010

Name | Value | Description
visConnectorBeginpoint | 0 | The begin point of the connector.
visConnectorEndPoint | 1 | The end point of the connector.
visConnectorBothEnds | 2 | Both the begin point and the end point of the connector.


VisContainerAutoResize Enumeration (Visio)

 Copy code hover
[image]

VisContainerAutoResize Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define the different ways that the container boundary can resize automatically to fit its contents; passed to and returned by the ContainerProperties.ResizeAsNeeded property.

Version Information

Version Added: Visio 2010

Name | Value | Description
visContainerAutoResizeNone | 0 | Do not automatically resize container.
visContainerAutoResizeExpand | 1 | Automatically expand the container size, but do not contract.
visContainerAutoResizeExpandContract | 2 | Automatically expand and contract the container size.


VisContainerFlags Enumeration (Visio)

 Copy code hover
[image]

VisContainerFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies which container member shape IDs to return; constants passed to the ContainerProperties.GetMemberShapes method.

Version Information

Version Added: Visio 2010

Name | Value | Description
visContainerFlagsDefault | 0 | Returns all shape types and includes items in nested containers.
visContainerFlagsExcludeContainers | 1 | Excludes member shapes that are containers.
visContainerFlagsExcludeConnectors | 2 | Excludes member shapes that are connectors.
visContainerFlagsExcludeCallouts | 4 | Excludes member shapes that are callouts.
visContainerFlagsExcludeElements | 8 | Excludes member shapes that are not containers, connectors, or callouts.
visContainerFlagsExcludeNested | 16 | Excludes any member shapes that are members of containers nested within the container.
visContainerFlagsExcludeListMembers | 32 | Excludes members of a list container that are explicitly members of the list. Does not exclude other shapes in the list container.


VisContainerFormatType Enumeration (Visio)

 Copy code hover
[image]

VisContainerFormatType Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that determine the container format to change; passed to the Selection.SetContainerFormat method.

Version Added: Visio 2010

Constant | Value | Description
visContainerFormatLockMembership | 0 | Change whether container membership is locked.
visContainerFormatContainerAutoResize | 1 | Change how the container resizes automatically.
visContainerFormatFitToContents | 2 | Force the container to resize so as to tightly include all member shapes, including any applicable margins between the container and the shapes.


VisContainerMemberState Enumeration (Visio)

 Copy code hover
[image]

VisContainerMemberState Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that denote the state of the input member shape with respect to the container; returned by the ContainerProperties.GetMemberState method.

Version Information

Version Added: Visio 2010

Name | Value | Description
visContainerMemberNotAMember | 0 | The shape is not a member of the container.
visContainerMemberInterior | 1 | The member shape is within the bounds of the container.
visContainerMemberOnBoundary | 2 | The member shape is on the boundary of the container.
visContainerMemberOutside | 3 | The member shape is outside the bounds of the container.
visContainerMemberInList | 4 | The member shape is a list member.


VisContainerNested Enumeration (Visio)

 Copy code hover
[image]

VisContainerNested Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies whether to include or exclude shapes from nested containers; constants passed to the Page.GetContainers and Selection.GetContainers methods.

Version Information

Version Added: Visio 2010

Name | Value | Description
visContainerIncludeNested | 0 | Include shapes that are in nested containers.
visContainerExcludeNested | 1 | Exclude shapes that are in nested containers.


VisContainerTypes Enumeration (Visio)

 Copy code hover
[image]

VisContainerTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies whether member shapes are arranged in a list; value returned by the ContainerProperties.ContainerType property.

Version Information

Version Added: Visio 2010

Name | Value | Description
visContainerTypeNormal | 0 | Member shapes are not arranged in a list.
visContainerTypeList | 1 | Member shapes are arranged in a list.


VisCutCopyPasteCodes Enumeration (Visio)

 Copy code hover
[image]

VisCutCopyPasteCodes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to be passed to the Cut, Copy, or Paste methods.

Flag | Value | Description
visCopyPasteNormal | &H0 | Follow default copying behavior.
visCopyPasteNoTranslate | &H1 | Copy shapes to their original coordinate locations.
visCopyPasteCenter | &H2 | Copy shapes to the center of the page.
visCopyPasteNoHealConnectors | &H4 | Do not clean up connectors attached to cut shapes.
visCopyPasteNoContainerMembers | &H8 | Do not cut and copy unselected members of containers or lists.
visCopyPasteNoAssociatedCallouts | &H16 | Do not cut and copy unselected callouts associated with shapes.
visCopyPasteDontAddToContainers | &H32 | Do not add pasted shapes to any underlying containers.
visCopyPasteNoCascade | &H64 | Do not offset shapes on copy.


VisDataColumnProperties Enumeration (Visio)

 Copy code hover
[image]

VisDataColumnProperties Enumeration (Visio)
Send feedback

Published: July 16, 2012

Data-column-property constants passed to the DataColumn.SetProperty and DataColumns.SetColumnProperties methods and returned by the DataColumn.GetProperty method.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visDataColumnPropertyCalendar | 3 | Calendar property of the data column.
visDataColumnPropertyCurrency | 5 | Currency property of the data column.
visDataColumnPropertyDisplayName | 6 | Display name of the data column in the UI.
visDataColumnPropertyHyperlink | 8 | Whether the data-column value becomes a hyperlink in the Microsoft Office Visio user interface when it is linked to a shape.
visDataColumnPropertyLangID | 2 | Language ID property of the data column.
visDataColumnPropertyType | 1 | Type property of the data column .
visDataColumnPropertyUnits | 4 | Units property of the data column.
visDataColumnPropertyVisible | 7 | Whether the data-column property is visible in the UI, and therefore if the data column participates in data linking. For shapes linked to data rows in a data recordset, only visible columns populate shape data items in the shape.


VisDataRecordsetAddOptions Enumeration (Visio)

 Copy code hover
[image]

VisDataRecordsetAddOptions Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants passed to the DataRecordsets.Add method, specifying characteristics of the data recordset to be added.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visDataRecordsetNoExternalDataUI | 1 | Prevents data in the new data recordset from being displayed in the External Data window.
visDataRecordsetNoRefreshUI | 2 | Prevents the data recordset from being displayed in the Refresh Data dialog box.
visDataRecordsetNoAdvConfig | 4 | Limits the control users have of how the data recordset is refreshed in the Configure Refresh dialog box for the data recordset. In particular, users cannot change the primary key or specify when shape data should be overwritten; however, users can set the refresh interval and can change the data source.
visDataRecordsetDelayQuery | 8 | Adds a data recordset but does not execute the command-string query until the next time you call the Refresh method.
visDataRecordsetDontCopyLinks | 16 | Adds a data recordset, but shape-data links are not copied to the Clipboard when shapes are copied or cut.


VisDefaultColors Enumeration (Visio)

 Copy code hover
[image]

VisDefaultColors Enumeration (Visio)
Send feedback

Published: July 16, 2012

Indices of colors in the default palette.

Constant | Value | Description
visBlack | 0 | Black
visBlue | 4 | Blue
visCyan | 7 | Cyan
visDarkBlue | 10 | Dark blue
visDarkCyan | 13 | Dark cyan
visDarkGray | 19 | Dark gray
visDarkGreen | 9 | Dark green
visDarkRed | 8 | Dark red
visDarkYellow | 11 | Dark yellow
visGray10 | 15 | 10% gray
visGray20 | 16 | 20% gray
visGray30 | 17 | 30% gray
visGray40 | 18 | 40% gray
visGray50 | 19 | 50% gray
visGray60 | 20 | 60% gray
visGray70 | 21 | 70% gray
visGray80 | 22 | 80% gray
visGray90 | 23 | 90% gray
visGray | 14 | Gray
visGreen | 3 | Green
visMagenta | 6 | Magenta
visPurple | 12 | Purple
visRed | 2 | Red
visTransparent | 0 | Transparent
visWhite | 1 | White
visYellow | 5 | Yellow


VisDefaultSaveFormats Enumeration (Visio)

 Copy code hover
[image]

VisDefaultSaveFormats Enumeration (Visio)
Send feedback

Published: July 16, 2012

Default Save format options.

Remarks

These options correspond to those available in the Save files in this format list on the Save tab of the Options dialog box (click the File tab, and then click Options).

Constant | Value | Description
visDefaultSaveCurrent | 0 | File format for current version of Microsoft Visio.
visDefaultSaveCurrentMacroEnabled | 3 | Macro-enabled file format for current version of Visio.
visDefaultSavePreviousBinary | 1 | Binary format for previous version of Visio (11.0).


VisDeleteFlags Enumeration (Visio)

 Copy code hover
[image]

VisDeleteFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define particular sets of instruction to apply to a deletion; passed to the Selection.DeleteEx and Shape.DeleteEx methods.

Version Information

Version Added: Visio 2010

Name | Value | Description
visDeleteNormal | 0 | Match the deletion behavior in the user interface.
visDeleteHealConnectors | 1 | Delete connectors attached to deleted shapes.
visDeleteNoHealConnectors | 2 | Do not delete connectors attached to deleted shapes.
visDeleteNoContainerMembers | 4 | Do not delete unselected members of containers or lists.
visDeleteNoAssociatedCallouts | 8 | Do not delete unselected callouts associated with shapes.


VisDiagramServices Enumeration (Visio)

 Copy code hover
[image]

VisDiagramServices Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that represent diagram services. These constants are passed to and returned by the Document.DiagramServicesEnabled property.

Version Added: Visio 2010

Constant | Value | Description
visServiceNone | 0 | No diagram services.
visServiceAll | -1 | All diagram services.
visServiceAnimations | 8 | Smooth transition behaviors to match user interface.
visServiceAutoSizePage | 1 | AutoSize (automatic page-sizing) behaviors.
visServiceStructureBasic | 2 | Structured-diagram behaviors that maintain existing relationships but do not create new relationships.
visServiceStructureFull | 4 | Structured-diagram behaviors that match all those in the user interface (UI).
visServiceVersion140 | 7 | All diagram services that exist in Microsoft Visio 2010.
visServiceVersion150 | 8 | All diagram services that exist in Microsoft Visio 2013.


VisDistributeTypes Enumeration (Visio)

 Copy code hover
[image]

VisDistributeTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Shape distribution types.

Remarks

These constants correspond to the options available in the Distribute Shapes dialog box. (Select three or more shapes, and on the Home tab, in the Arrange group, click Position, point to Space Shapes, and then click More Distribute Options.)

Constant | Value | Description
visDistHorzCenter | 2 | Distributes shapes hoirzontally so that their bottom edges are uniformly spaced.
visDistHorzLeft | 1 | Distributes shapes horizontally so that their left edges are uniformly spaced.
visDistHorzRight | 3 | Distributes shapes horizontally so that their right edges are uniformly spaced.
visDistHorzSpace | 0 | Distributes shapes horizontally so that there is a uniform space between shapes.
visDistVertBottom | 7 | Distributes shapes vertically so that their bottom edges are uniformly spaced.
visDistVertMiddle | 6 | Distributes shapes vertically so that their centers are uniformly spaced.
visDistVertSpace | 4 | Distributes shapes vertically so that there is a uniform space between shapes.
visDistVertTop | 5 | Distributes shapes vertically so that their top edges are uniformly spaced.


VisDocCleanActions Enumeration (Visio)

 Copy code hover
[image]

VisDocCleanActions Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags passed to the Document.Clean method that indicate which document conditions to detect, report, and fix.

Constant | Value | Description
visDocCleanActAll | &H3FFF | Perform all actions.
visDocCleanActBadDisplayLists | &H100 | Detect invalid display list linkages.
visDocCleanActBadFieldFormulas | &H800 | Detect fields that have missing or nonstandard formulas.
visDocCleanActBadFieldMarks | &H1000 | Detect fields that have out-of-sync count and marker values. Change the position of escape characters to match character counts.
visDocCleanActBadReferences | &H2000 | Detect formulas that have #Ref() errors.
visDocCleanActConstantFormulas | &H20 | Detect formulas that can be generated from the result.
visDocCleanActDefault | &H1FD8 | Default conditions to detect.
visDocCleanActDeletedFields | &H400 | Detect deleted fields.
visDocCleanActDuplicateSubs | &H80 | Detect duplicate subscriptions (cell dependencies).
visDocCleanActEmptyRowsAndSects | &H2 | Detect empty local rows and sections.
visDocCleanActLocalFormulas | &H1 | Detect unnecessary local overrides.
visDocCleanActMissingSubs | &H10 | Detect missing subscriptions (cell dependencies).
visDocCleanActNearZero | &H40 | Detect results that are almost zero and change them to zero.
visDocCleanActNonDefaultFonts | &H4 | Detect non-default font settings.
visDocCleanActStaleResults | &H8 | Detect results that don't match formulas.
visDocCleanAlertDefault | &H0 | Default conditions to report.
visDocCleanFixDefault | &H3D8 | Default conditions to fix.


VisDocCleanTargets Enumeration (Visio)

 Copy code hover
[image]

VisDocCleanTargets Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags passed to the Document.Clean method to indicate which objects to examine.

Constant | Value | Description
visDocCleanTargAll | &HFF | Examine all objects.
visDocCleanTargBPages | &H2 | Examine background pages.
visDocCleanTargDoc | &H10 | Examine document sheet.
visDocCleanTargFPages | &H1 | Examine foreground pages.
visDocCleanTargMasters | &H4 | Examine masters.
visDocCleanTargPageSheet | &H100 | Examine page sheet(s).
visDocCleanTargStyles | &H8 | Examine styles.


VisDocExIntent Enumeration (Visio)

 Copy code hover
[image]

VisDocExIntent Enumeration (Visio)
Send feedback

Published: July 16, 2012

Export intent constants passed to the Document.ExportAsFixedFormat method.

Name | Value | Description
visDocExIntentPrint | 1 | Intent is to publish online and to print.
visDocExIntentScreen | 0 | Intent is to publish online.


VisDocModeArgs Enumeration (Visio)

 Copy code hover
[image]

VisDocModeArgs Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags passed to or returned by the Document.Mode property and IDs returned by Document.ID.

Constant | Value | Description
visDocModeDesign | 1 | The document is in design mode.
visDocModeRun | 0 | The document is in run mode.
visInvalDocID | -1 | The document ID is invalid. Document.ID will never return this value for an open document.


VisDocumentTypes Enumeration (Visio)

 Copy code hover
[image]

VisDocumentTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Type codes returned by the Document.Type property.

Constant | Value | Description
visDocTypeInval | 0 | Not a Microsoft Visio document.
visTypeDrawing | 1 | Document type is a drawing.
visTypeStencil | 2 | Document type is a stencil.
visTypeTemplate | 3 | Document type is a template.


VisDocVersions Enumeration (Visio)

 Copy code hover
[image]

VisDocVersions Enumeration (Visio)
Send feedback

Published: July 16, 2012

Return values for the Document.Version property.

Constant | Value | Description
visVersion100 | 393216 (&H60000) | Visio version 2000 or 2002 document.
visVersion10 | 65571 (&H10023) | Visio 1.0 document.
visVersion110 | 720896 (&HB0000) | Visio 2003, Visio 2007, or Visio 2010 document.
visVersion120 | 720896 (&HB0000) | Visio 2003, Visio 2007, or Visio 2010 document.
visVersion140 | 720896 (&HB0000) | Visio 2003, Visio 2007, or Visio 2010 document.
visVersion150 | 983040 (&HF0000) | Visio 2013 document.
visVersion20 | 131072 (&H20000) | Visio 2.0 document.
visVersion30 | 196611 (&H30003) | Visio 3.0 document.
visVersion40 | 262144 (&H40000) | Visio 4.x document.
visVersion50 | 327680 (&H50000) | Visio 5.0 document.
visVersion60 | 393216 (&H60000) | Visio version 2000 or 2002 document.
visVersionUnsaved | 0 | Visio version number of an unsaved document.


VisDrawRegionFlags Enumeration (Visio)

 Copy code hover
[image]

VisDrawRegionFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to pass to the Selection.DrawRegion method.

Name | Value | Description
visDrawRegionDeleteInput | &H4 | Delete items in selection.
visDrawRegionIgnoreVisible | &H20 | Exclude visible geometry.
visDrawRegionIncludeDataGraphics | &H40 | Include data graphic callout shapes and their sub-shapes.
visDrawRegionIncludeHidden | &H10 | Include hidden geometry.


VisDrawSplineFlags Enumeration (Visio)

 Copy code hover
[image]

VisDrawSplineFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to pass to the DrawSpline and DrawPolyline methods.

Constant | Value | Description
visPolyarcs | 256 | Draw a sequence of arcs rather than a sequence of line segments.
visPolyline1D | 8 | Draw a shape that has one-dimensional (1-D) behavior.
visSpline1D | 8 | Draw a shape that has 1-D behavior.
visSplineAbrupt | 4 | Break the spline whenever an abrupt change of direction or curvature in the point's trail is detected.
visSplineDoCircles | 2 | Recognize circular segments in the given array of points and generate circular arcs for those segments.
visSplinePeriodic | 1 | Draw a periodic spline.


VisEdition Enumeration (Visio)

 Copy code hover
[image]

VisEdition Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that represent the installed edition of Microsoft Visio.

Name | Value | Description
visEditionStandard | 0 | Standard edition.
visEditionProfessional | 1 | Professional edition.


VisEventCodes Enumeration (Visio)

 Copy code hover
[image]

VisEventCodes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Codes for Microsoft Visio events, event actions, and event IDs.

Constant | Value | Description
visActCodeAdvise | 2 | AddAdvise action code
visActCodeRunAddon | 1 | RunAddon action code
visEvtAdd | 32768 | Event code for adding an Event object, passed to the Add and AddAdvise methods. Used in conjunction with object codes for particular objects.
visEvtAfterModal | 64 | AfterModal event
visEvtApp | 4096 | Application object
visEvtAppActivate | 1 | AppActivated event
visEvtAppDeactivate | 2 | AppDeactivated event
visEvtBeforeModal | 32 | BeforeModal event
visEvtBeforeQuit | 16 | BeforeQuit event
visEvtCell | 2048 | Cell object
visEvtCodeAfter CoauthMerge | 14 | AfterCoautjMerge event code
visEvtCodeAfterForcedFlush | 201 | AfterForcedFlush event code
visEvtCodeAfterResume | 209 | AfterResume event code
visEvtCodeAfterResumeEvents | 213 | AfterResumeEvents event code
visEvtCodeBefDocSaveAs | 8 | BeforeDocumentSaveAs event code
visEvtCodeBefDocSave | 7 | BeforeDocumentSave event code
visEvtCodeBefForcedFlush | 200 | BeforeForcedFlush event code
visEvtCodeBeforeReplaceShapes | 913 | BeforeReplaceShapes event code
visEvtCodeBeforeSuspend | 208 | BeforeSuspend event code
visEvtCodeBeforeSuspendEvents | 212 | BeforeSuspendEvents event code
visEvtCodeBefSelDel | 901 | BeforeSelectionDelete event code
visEvtCodeBefWinPageTurn | 703 | BeforeWindowPageTurn event code
visEvtCodeBefWinSelDel | 702 | BeforeWindowSelDelete event code
visEvtCodeCalloutRelationshipAdded | 504 | CalloutRelationshipAdded event code
visEvtCodeCalloutRelationshipDeleted | 505 | CalloutRelationshipDeleted event code
visEvtCodeCancelConvertToGroup | 908 | ConvertToGroupCanceled event code
visEvtCodeCancelDocClose | 10 | DocumentCloseCanceled event code
visEvtCodeCancelMasterDel | 401 | MasterDeleteCanceled event code
visEvtCodeCancelPageDel | 501 | PageDeleteCanceled event code
visEvtCodeCancelQuit | 205 | QuitCanceled event code
visEvtCodeCancelReplaceShapes | 912 | ReplaceShapesCancelled event code
visEvtCodeCancelSelDel | 904 | SelectionDeleteCanceled event code
visEvtCodeCancelSelGroup | 910 | GroupCanceled event code
visEvtCodeCancelStyleDel | 301 | StyleDeleteCanceled event code
visEvtCodeCancelSuspend | 207 | SuspendCanceled event code
visEvtCodeCancelSuspendEvents | 211 | SuspendEventsCanceled event code
visEvtCodeCancelUngroup | 906 | UngroupCanceled event code
visEvtCodeCancelWinClose | 707 | WindowCloseCanceled event code
visEvtCodeContainerRelationshipAdded | 502 | ContainerRelationshipAdded event code
visEvtCodeContainerRelationshipDeleted | 503 | ContainerRelationshipDeleted event code
visEvtCodeDocCreate | 1 | DocumentCreated event code
visEvtCodeDocDesign | 6 | DocumentDesignModeEntered event code
visEvtCodeDocOpen | 2 | DocumentOpened event code
visEvtCodeDocRunning | 5 | DocumentRunModeEntered event code
visEvtCodeDocSaveAs | 4 | DocumentSavedAs event code
visEvtCodeDocSave | 3 | DocumentSaved event code
visEvtCodeEnterScope | 202 | EnterScope event code
visEvtCodeExitScope | 203 | ExitScope event code
visEvtCodeInval | 0 | An event code no event can have.
visEvtCodeKeyDown | 712 | KeyDown event code
visEvtCodeKeyPress | 713 | KeyPress event code
visEvtCodeKeyUp | 714 | KeyUp event code
visEvtCodeMouseDown | 709 | MouseDown event code
visEvtCodeMouseMove | 710 | MousePress event code
visEvtCodeMouseUp | 711 | MouseUp event code
visEvtCodeQueryCancelConvertToGroup | 907 | QueryCancelConvertToGroup event code
visEvtCodeQueryCancelDocClose | 9 | QueryCancelDocumentClose event code
visEvtCodeQueryCancelMasterDel | 400 | QueryCancelMasterDelete event code
visEvtCodeQueryCancelPageDel | 500 | QueryCancelPageDelete event code
visEvtCodeQueryCancelReplaceShapes | 911 | QueryCancelReplaceShapes event code
visEvtCodeQueryCancelQuit | 204 | QueryCancelQuit event code
visEvtCodeQueryCancelSelDel | 903 | QueryCancelSelectionDeleted event code
visEvtCodeQueryCancelSelGroup | 909 | QueryCancelGroup event code
visEvtCodeQueryCancelStyleDel | 300 | QueryCancelStyleDeleted event code
visEvtCodeQueryCancelSuspend | 206 | QueryCancelSuspend event code
visEvtCodeQueryCancelSuspendEvents | 210 | QueryCancelSuspendEvents event code
visEvtCodeQueryCancelUngroup | 905 | QueryCancelUngroup event code
visEvtCodeQueryCancelWinClose | 706 | QueryCancelWindowClose event code
visEvtCodeRuleSetValidated | 13 | RuleSetValidated event code
visEvtCodeSelAdded | 902 | SelectionAdded event code
visEvtCodeSelectionMovedToSubprocess | 12 | SelectionMovedToSubprocess event code
visEvtCodeShapeBeforeTextEdit | 803 | BeforeShapeTextEdit event code
visEvtCodeShapeDelete | 801 | ShapesDeleted event code
visEvtCodeShapeExitTextEdit | 804 | ShapeExitedTextEdit event code
visEvtCodeShapeParentChange | 802 | ShapeParentChanged event code
visEvtCodeShapesReplaced | 914 | ShapesReplaced event code
visEvtCodeViewChanged | 705 | ViewChanged event code
visEvtCodeWinOnAddonKeyMSG | 708 | OnKeystrokeMessageForAddon event code
visEvtCodeWinPageTurn | 704 | WindowTurnToPage event code
visEvtCodeWinSelChange | 701 | SelectionChanged event code
visEvtConnect | 256 | Connect object
visEvtDel | 16384 | Event code for deleting an Event object, passed to the Delete and AddAdvise methods. Used in conjunction with object codes for particular objects.
visEvtDataRecordset | 32 | DataRecordset object
visEvtDoc | 2 | Document object
visEvtFormula | 4096 | FormulaChanged event
visEvtIDInval | -1 | An ID no event can have.
visEvtIdle | 1024 | VisioIsIdle event code
visEvtIdMostRecent | 0 | The ID of the most recent event to fire.
visEvtMarker | 256 | MarkerEvent event
visEvtMaster | 8 | Master object
visEvtMod | 8192 | Used in conjunction with object codes for particular objects to create events that report a change to an object. For example, visEvtMod + visEvtCell consitutes the CellChanged event.
visEvtNonePending | 512 | NoEventsPending event
visEvtObjActivate | 4 | AppObjActivated event
visEvtObjDeactivate | 8 | AppObjDeactivated
visEvtPage | 16 | Page object
visEvtRemoveHiddenInformation | 11 | AfterRemoveHiddenInformation event
visEvtRow | 1024 | Row object
visEvtSection | 512 | Section object
visEvtShape | 64 | Shape object
visEvtShapeDataGraphicChanged | 807 | ShapeDataGraphicChanged event
visEvtShapeLinkAdded | 805 | ShapeLinkAdded event
visEvtShapeLinkDeleted | 806 | ShapeLinkDeleted event
visEvtStyle | 4 | Style object
visEvtText | 128 | Text object
visEvtWinActivate | 128 | WindowActivated event
visEvtWindow | 1 | Window object
visScopeIDInval | -1 | An ID no event scope can have.


VisExistsFlags Enumeration (Visio)

 Copy code hover
[image]

VisExistsFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to be passed to the Shape.SectionExists property and similar properties.

Constant | Value | Description
visExistsAnywhere | 0 | The ShapeSheet section either exists locally in the shape or is inherited.
visExistsLocally | 1 | The ShapeSheet section exists locally in the shape.


VisFieldCategories Enumeration (Visio)

 Copy code hover
[image]

VisFieldCategories Enumeration (Visio)
Send feedback

Published: July 16, 2012

Text-field categories passed to the AddField and AddFieldEx methods.

Constant | Value | Description
visFCatCustom | 0 | Custom field.
visFCatDateTime | 1 | Date/time field.
visFCatDocument | 2 | Document information field.
visFCatGeometry | 3 | Geometery field.
visFCatObject | 4 | Object information.
visFCatPage | 5 | Page information field.
Note Note

Do not pass visFCatCustom to theAddField method. Pass it to AddCustomField or AddCustomFieldU instead.


VisFieldCodes Enumeration (Visio)

 Copy code hover
[image]

VisFieldCodes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Text-field codes passed to the AddField and AddFieldEx methods.

Constant | Value | Description
visFCodeAngle | 2 | Angle.
visFCodeBackgroundName | 0 | Background name.
visFCodeCategory | 9 | Document category.
visFCodeCompany | 8 | Document company.
visFCodeCreateDate | 0 | Document creation date.
visFCodeCreateTime | 1 | Document creation time.
visFCodeCreator | 0 | Creator.
visFCodeCurrentDate | 2 | Current date.
visFCodeCurrentTime | 3 | Current time.
visFCodeData1 | 0 | Data1 value.
visFCodeData2 | 1 | Data2 value.
visFCodeData3 | 2 | Data3 value.
visFCodeDescription | 1 | Document description.
visFCodeDirectory | 2 | Directory (folder).
visFCodeEditDate | 4 | Edit date.
visFCodeEditTime | 5 | Edit time.
visFCodeFileName | 3 | Document file name.
visFCodeHeight | 1 | Height
visFCodeHyperlinkBase | 10 | Hyperlink base.
visFCodeKeyWords | 4 | Keywords.
visFCodeManager | 7 | Manager name.
visFCodeMasterName | 4 | Master name.
visFCodeNumberOfPages | 2 | Number of pages.
visFCodeObjectID | 3 | Object ID.
visFCodeObjectName | 5 | Object name.
visFCodeObjectType | 6 | Object type.
visFCodePageName | 1 | Page name.
visFCodePageNumber | 3 | Page number.
visFCodePrintDate | 6 | Date printed.
visFCodePrintTime | 7 | Time printed.
visFCodeSubject | 5 | Document subject.
visFCodeTitle | 6 | Document title.
visFCodeWidth | 0 | Width.


VisFieldFormats Enumeration (Visio)

 Copy code hover
[image]

VisFieldFormats Enumeration (Visio)
Send feedback

Published: July 16, 2012

Text field formats.

Constant | Value
visFmt0PlDefUnits | 3
visFmt0PlNoUnits | 2
visFmt1PlDefUnits | 5
visFmt1PlNoUnits | 4
visFmt2PlDefUnits | 7
visFmt2PlNoUnits | 6
visFmt3PlDefUnits | 9
visFmt3PlNoUnits | 8
visFmtDateDDMMYY | 27
visFmtDateDMMMMYYYY | 29
visFmtDateDMMMYYYY | 28
visFmtDateDMYY | 26
visFmtDategeMMMMddd_K | 62
visFmtDategeMMMMddddww_K | 60
visFmtDategggemd_J | 56
visFmtDategggemdww_J | 54
visFmtDateLong | 21
visFmtDateMDYY | 22
visFmtDateMMDDYY | 23
visFmtDateMmmDYYYY | 24
visFmtDateMmmmDYYYY | 25
visFmtDateTWNfyyyymmdd_C | 53
visFmtDateTWNfYYYYMMDDD_C | 50
visFmtDateTWNfyyyymmddww_C | 52
visFmtDateTWNsYYYYMMDDD_C | 51
visFmtDateShort | 20
visFmtDatewwyyyymd_S | 79
visFmtDatewwyyyymmdd_S | 78
visFmtDateyy_mm_dd | 65
visFmtDateyymmdd | 45
visFmtDateyyyy_m_d | 64
visFmtDateyyyymd_J | 57
visFmtDateyyyymd_K | 63
visFmtDateyyyymd_S | 76
visFmtDateyyyymdww_J | 55
visFmtDateyyyymdww_K | 61
visFmtDateyyyymd | 44
visFmtDateyyyymmdd_S | 77
visFmtDateYYYYMMMDDD_C | 59
visFmtDateYYYYMMMDDDWWW_C | 58
visFmtDegrees | 12
visFmtFeetAndInches1Pl | 13
visFmtFeetAndInches2Pl | 14
visFmtFeetAndInches | 10
visFmtFraction1PlDefUnits | 16
visFmtFraction1PlNoUnits | 15
visFmtFraction2PlDefUnits | 18
visFmtFraction2PlNoUnits | 17
visFmtMsoDateEnglish | 208
visFmtMsoDateISO | 204
visFmtMsoDateLongDay | 201
visFmtMsoDateLong | 202
visFmtMsoDateMon_Yr | 210
visFmtMsoDateMonthYr | 209
visFmtMsoDateShortAbb | 207
visFmtMsoDateShortAlt | 203
visFmtMsoDateShortMon | 205
visFmtMsoDateShortSlash | 206
visFmtMsoDateShort | 200
visFmtMsoFEExtra1 | 217
visFmtMsoFEExtra2 | 218
visFmtMsoFEExtra3 | 219
visFmtMsoFEExtra4 | 220
visFmtMsoFEExtra5 | 221
visFmtMsoTime24 | 215
visFmtMsoTimeDatePM | 211
visFmtMsoTimeDateSecPM | 212
visFmtMsoTimePM | 213
visFmtMsoTimeSec24 | 216
visFmtMsoTimeSecPM | 214
visFmtNumGenDefUnits | 1
visFmtNumGenNoUnits | 0
visFmtRadians | 11
visFmtStrLower | 38
visFmtStrNormal | 37
visFmtStrUpper | 39
visFmtTimeAMPM_hmm_C | 70
visFmtTimeAMPM_hmm_J | 68
visFmtTimeAMPM_hmm_K | 72
visFmtTimeAMPMhhmm_S | 81
visFmtTimeAMPMhmm_C | 66
visFmtTimeAMPMhmm_J | 46
visFmtTimeAMPMhmm_K | 67
visFmtTimeAMPMhmm_S | 80
visFmtTimeGen | 30
visFmtTimeHHMM24 | 34
visFmtTimeHHMMAMPM_E | 75
visFmtTimeHHMMAMPM | 36
visFmtTimeHHMM | 32
visFmtTimehmm_C | 71
visFmtTimehmm_J | 69
visFmtTimehmm_K | 73
visFmtTimeHMM24 | 33
visFmtTimeHMMAMPM_E | 74
visFmtTimeHMMAMPM | 35
visFmtTimeHMM | 31


VisFilterActions Enumeration (Visio)

 Copy code hover
[image]

VisFilterActions Enumeration (Visio)
Send feedback

Published: July 16, 2012

Drag-state extensions of the MouseMove event to filter, corresponding to user mouse actions related to dragging and dropping Microsoft Visio objects. Passed to the Event.SetFilterActions method and returned by the Event.GetFilterActions method. By filtering, you can specify which mouse actions (event extensions) you want to listen to.

Name | Value | Description
visFilterMouseMoveDragBegin | 1 | Filter the DragBegin extension of the MouseMove event.
visFilterMouseMoveDragDrop | 5 | Filter the DragDrop extension of the MouseMove event.
visFilterMouseMoveDragEnter | 2 | Filter the DragEnter extension of the MouseMove event.
visFilterMouseMoveDragLeave | 4 | Filter the DragLeave extension of the MouseMove event.
visFilterMouseMoveDragOver | 3 | Filter the DragOver extension of the MouseMove event.
visFilterMouseMoveNoDrag | 0 | Do not filter any extensions of the MouseMove event.


VisFixedFormatTypes Enumeration (Visio)

 Copy code hover
[image]

VisFixedFormatTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

File format types passed to the Document.ExportAsFixedFormat method.

Name | Value | Description
visFixedFormatPDF | 1 | PDF format.
visFixedFormatXPS | 2 | XPS format.


VisFlipDirection Enumeration (Visio)

 Copy code hover
[image]

VisFlipDirection Enumeration (Visio)
Send feedback

Published: July 16, 2012

Direction constants to pass to the Selection.Flip method.

Constant | Value | Description
visFlipHorizontal | 1 | Flip the selection horizontally.
visFlipVertical | 2 | Flip the selection vertically.


VisFlipTypes Enumeration (Visio)

 Copy code hover
[image]

VisFlipTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Type constants to pass to the Selection.Flip method.

Constant | Value | Description
visFlipSelectionWithPin | 1 | Flip the selection around a pin.
visFlipSelection | 0 | Flip the selection around its center.
visFlipShapes | 2 | Flip the selected shapes around their pins.


VisFontAttributes Enumeration (Visio)

 Copy code hover
[image]

VisFontAttributes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Attribute codes returned by the Font.Attributes property.

Constant | Value | Description
visFont0Alias | 128 | Used instead of font 0 (the default font). The font 0 alias is used in some localized versions of Microsoft Visio and is controlled by means of entries in the registry.


VisFromParts Enumeration (Visio)

 Copy code hover
[image]

VisFromParts Enumeration (Visio)
Send feedback

Published: July 16, 2012

Codes returned by the Connect.FromPart property.

Note Note

The visControlPoint value is actually 100 plus the zero-based row index. For example, if the control point is in row 0, visControlPoint equals 100; if the control point is in row 1, visControlPoint equals 101.

Remarks

The VisFromParts return codes indicate the part of a shape from which a connection originates.

Constant | Value | Description
visBeginX | 7 | Connection is from the begin point x of a 1-D shape.
visBeginY | 8 | Connection is from the begin point y of a 1-D shape.
visBegin | 9 | Connection is from the begin point of a 1-D shape.
visBottomEdge | 4 | Connection is from bottom edge of shape.
visCenterEdge | 2 | Connection is from the center (x) of a 1-D shape.
visConnectFromError | -1 | Connection from an unknown part.
visControlPoint | 100 | Connection is from the control point plus the row index (see Note).
visEndX | 10 | Connection is from the endpoint (x) of a 1-D shape.
visEndY | 11 | Connection is from the endpoint (y) of a 1-D shape.
visEnd | 12 | Connection is from the end of a 1-D shape.
visFromAngle | 13 | Connection is from the direction of a connection point.
visFromNone | 0 | Connection is from nothing.
visFromPin | 14 | Connection is from the pin of a shape.
visLeftEdge | 1 | Connection is from the left edge of a shape.
visMiddleEdge | 5 | Connection is from the middle (y) of a shape.
visRightEdge | 3 | Connection is from the right edge of a shape.
visTopEdge | 6 | Connection is from the top edge of a shape.


VisGeomFlags Enumeration (Visio)

 Copy code hover
[image]

VisGeomFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to pass to methods of the Row object that get and put vertex arrays, such as GetPolylineData.

Constant | Value | Description
visGeomExcludeLastPoint | 1 (&H1) | The last point (the X and Y cells in the row) is not included in the data.
visGeomWHPct | 16 (&H10) | The X and Y values are percentages of width and height.
visGeomXYLocal | 32 (&H20) | The X and Y values are local, internal units in the drawing.


VisGetSetArgs Enumeration (Visio)

 Copy code hover
[image]

VisGetSetArgs Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to be passed to the GetResults, SetFormulas, and SetResults methods.

Constant | Value | Description
visGetFloats | 0 | Results returned as doubles (VT_R8).
visGetFormulasU | 5 | Formulas returned in universal syntax (VT_BSTR).
visGetFormulas | 4 | Formulas returned as strings (VT_BSTR).
visGetRoundedInts | 2 | Results returned as rounded long integers (VT_I4).
visGetStrings | 3 | Results returned as strings (VT_BSTR).
visGetTruncatedInts | 1 | Results returned as truncated long integers (VT_I4).
visSetBlastGuards | 2 | Override present cell values even if they're guarded.
visSetFormulas | 1 | Treat strings in results as formulas.
visSetTestCircular | 4 | Test for establishment of circular cell references.
visSetUniversalSyntax | 8 | Formulas are in universal syntax.


VisGluedShapesFlags Enumeration (Visio)

 Copy code hover
[image]

VisGluedShapesFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that identify which shapes to return, based on the dimensionality and directionality of the connection points that are glued to a particular shape; passed to the Shapes.GluedShapes method.

Version Information

Version Added: Visio 2010

Name | Value | Description
visGluedShapesAll1D | 0 | Return all 1-D shapes that are glued to this shape.
visGluedShapesIncoming1D | 1 | Return the 1-D shapes whose end points are glued to this shape.
visGluedShapesOutgoing1D | 2 | Return the 1-D shapes whose begin points are glued to this shape.
visGluedShapesAll2D | 3 | Return the 2-D shapes that are glued to this shape and the 2-D shapes to which this shape is glued.
visGluedShapesIncoming2D | 4 | If the source object is a 1-D shape, return the 2-D shape to which the begin point is glued. If the source object is a 2-D shape, return the 2-D shapes that are glued to this shape.
visGluedShapesOutgoing2D | 5 | If the source object is a 1-D shape, return the 2-D shape to which the end point is glued. If the source object is a 2-D shape, return the 2-D shapes to which this shape is glued.


VisGlueSettings Enumeration (Visio)

 Copy code hover
[image]

VisGlueSettings Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags passed to or returned by the Document.GlueSettings property.

Constant | Value | Description
visGlueToConnectionPoints | &H8 | Glue to connection points.
visGlueToDisabled | &H8000 | Disable glue.
visGlueToGeometry | &H20 | Glue to shape geometry.
visGlueToGuides | &H1 | Glue to guides.
visGlueToHandles | &H2 | Glue to shape handles.
visGlueToNone | &H0 | Glue is enabled but no other glue settings are on.
visGlueToVertices | &H4 | Glue to shape vertices.


VisGraphicField Enumeration (Visio)

 Copy code hover
[image]

VisGraphicField Enumeration (Visio)
Send feedback

Published: July 16, 2012

Graphic item primary-data-field constants passed to the GraphicItem.SetExpression method and returned by the GraphicItem.GetExpression method.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visGraphicExpression | 2 | The ShapeSheet formula of a shape data item.
visGraphicPropertyLabel | 1 | The label of a shape data item.


VisGraphicItemTypes Enumeration (Visio)

 Copy code hover
[image]

VisGraphicItemTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Represent the types of graphic items that can be added to data graphics. Returned by the GraphicItem.Type property.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visTypeIconSet | 2 | Represents an Icon Set graphic item.
visTypeTextCallout | 3 | Represents a Text graphic item.
visTypeDataBar | 4 | Represents a Data Bar graphic item.
visTypeColorByValue | 5 | Represents a Color by Value graphic item.
visTypeHeading | 6 | Represents a Text graphic item that has a Callout type of Heading x.


VisGraphicPositionHorizontal Enumeration (Visio)

 Copy code hover
[image]

VisGraphicPositionHorizontal Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants passed to and returned by the GraphicItem.HorizontalPosition property. Used to determine the horizontal position of a graphic item relative to its container or to a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visGraphicFarLeft | 0 | The right edge of the graphic item's alignment box is aligned with the left edge of the shape or container's alignment box.
visGraphicLeftEdge | 1 | The vertical centerline of the graphic item's alignment box is aligned with the left edge of the shape or container's alignment box.
visGraphicLeft | 2 | The left edge of the graphic item's alignment box is aligned with the left edge of the shape or container's alignment box.
visGraphicCenter | 3 | The vertical centerline of the graphic item's alignment box is aligned with the vertical centerline of the shape or container's alignment box.
visGraphicRight | 4 | The right edge of the graphic item's alignment box is aligned with the right edge of the shape or container's alignment box.
visGraphicRightEdge | 5 | The vertical centerline of the graphic item's alignment box is aligned with the right edge of the shape or container's alignment box.
visGraphicFarRight | 6 | The left edge of the graphic item's alignment box is aligned with the right edge of the shape or container's alignment box.


VisGraphicPositionVertical Enumeration (Visio)

 Copy code hover
[image]

VisGraphicPositionVertical Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants passed to and returned by the GraphicItem.VerticalPosition property. Used to determine the vertical position of a graphic item relative to its container or to a shape.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visGraphicBelow | 0 | The top edge of the graphic item's alignment box is aligned with the bottom edge of the shape or container's alignment box.
visGraphicBottomEdge | 1 | The horizontal centerline of the graphic item's alignment box is aligned with the bottom edge of the shape or container's alignment box.
visGraphicBottom | 2 | The bottom edge of the graphic item's alignment box is aligned with the bottom edge of the shape or container's alignment box.
visGraphicMiddle | 3 | The horizontal centerline of the graphic item's alignment box is aligned with the horizontal centerline of the shape or container's alignment box.
visGraphicTop | 4 | The top edge of the graphic item's alignment box is aligned with the top edge of the shape or container's alignment box.
visGraphicTopEdge | 5 | The horizontal centerline of the graphic item's alignment box is aligned with the top edge of the shape or container's alignment box.
visGraphicAbove | 6 | The bottom edge of the graphic item's alignment box is aligned with the top edge of the shape or container's alignment box.


VisGuideTypes Enumeration (Visio)

 Copy code hover
[image]

VisGuideTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Guide type codes to be passed to the Page.AddGuide method.

Constant | Value | Description
visHorz | 2 | Vertical guide
visPoint | 1 | Guide point
visVert | 3 | Horizontal guide


VisHitTestResults Enumeration (Visio)

 Copy code hover
[image]

VisHitTestResults Enumeration (Visio)
Send feedback

Published: July 16, 2012

Result values returned by the Shape.HitTest method.

Constant | Value | Descriptioin
visHitInside | 2 | Hit position is inside shape boundary.
visHitOnBoundary | 1 | Hit position is on shape boundary
visHitOutside | 0 | Hit position is outside shape boundary


VisHorizontalAlignTypes Enumeration (Visio)

 Copy code hover
[image]

VisHorizontalAlignTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies horizontal alignment type values to pass to the Selection.Align method.

Constant | Value | Description
visHorzAlignCenter | 2 | Align to the center of the primary selected shape.
visHorzAlignLeft | 1 | Align to the left of the primary selected shape.
visHorzAlignNone | 0 | No horizontal alignment.
visHorzAlignRight | 3 | Align to the right of the primary selected shape.


VisInsertObjArgs Enumeration (Visio)

 Copy code hover
[image]

VisInsertObjArgs Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to be passed to the Page.InsertObject and Page.InsertFromFile methods.

Constant | Value | Description
visInsertAsControl | 8192 | None.
visInsertAsEmbed | 16384 | None.
visInsertDontShow | 4096 | Don't execute the new object's show verb.
visInsertIcon | 16 | Display the new object as an icon
visInsertLink | 8 | If set, the new shape represents an OLE link to the named file. Otherwise, the InsertFromFile method produces an OLE object from the contents of the named file and embeds it in the document that contains the page, master, or group.
visInsertNoDesignModeTransition | 256 | If set, when an ActiveX control is inserted, prevents Microsoft Visio from transitioning to design mode.


VisKeyButtonFlags Enumeration (Visio)

 Copy code hover
[image]

VisKeyButtonFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags passed to the MouseDown, MouseMove, and MouseUp events.

Constant | Value | Descriptioin
visKeyControl | 8 | CTRL key.
visKeyShift | 4 | SHIFT key.
visMouseLeft | 1 | Left mouse button.
visMouseMiddle | 16 | Mouse wheel.
visMouseRight | 2 | Right mouse button.


VisLangFlags Enumeration (Visio)

 Copy code hover
[image]

VisLangFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies the language of the page name as local or universal; passed to the various members of the ServerPublishOptions object.

Name | Value | Description
visLangLocal | 0 | The page name is a local name.
visLangUniversal | 1 | The page name is a universal name.


VisLayoutDirection Enumeration (Visio)

 Copy code hover
[image]

VisLayoutDirection Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define the layout directions for a diagram or selection; passed to the ContainerProperties.RotateFlipList and Selection.LayoutChangeDirection methods.

Version Information

Version Added: Visio 2010

Name | Value | Description
visLayoutDirRotateRight | 0 | Rotates the diagram or selection 90 degrees clockwise.
visLayoutDirRotateLeft | 1 | Rotates the diagram or selection 90 degrees counter-clockwise.
visLayoutDirFlipVert | 2 | Flips the diagram or selection vertically.
visLayoutDirFlipHorz | 3 | Flips the diagram or selection horizontally.


VisLayoutHorzAlignType Enumeration (Visio)

 Copy code hover
[image]

VisLayoutHorzAlignType Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define the different ways to incrementally align a shape horizontally; passed to the Page.LayoutIncremental and Selection.LayoutIncremental methods.

Version Information

Version Added: Visio 2010

Name | Value | Description
visLayoutHorzAlignNone | 0 | Do not align horizontally.
visLayoutHorzAlignDefault | 1 | Let Visio choose how to align horizontally.
visLayoutHorzAlignLeft | 2 | Align the left edges of the shapes.
visLayoutHorzAlignCenter | 3 | Align the centers of the shapes.
visLayoutHorzAlignRight | 4 | Align the right edges of the shapes.


VisLayoutIncrementalType Enumeration (Visio)

 Copy code hover
[image]

VisLayoutIncrementalType Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define types of incremental layout; passed to the Page.LayoutIncremental and Selection.LayoutIncremental methods.

Version Information

Version Added: Visio 2010

Name | Value | Description
visLayoutIncrAlign | 1 | Align shapes.
visLayoutIncrSpace | 2 | Space shapes evenly.


VisLayoutVertAlignType Enumeration (Visio)

 Copy code hover
[image]

VisLayoutVertAlignType Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define the different ways to incrementally align a shape vertically; passed to the Page.LayoutIncremental and Selection.LayoutIncremental methods.

Version Information

Version Added: Visio 2010

Name | Value | Description
visLayoutVertAlignNone | 0 | Do not align vertically.
visLayoutVertAlignDefault | 1 | Let Visio choose how to align vertically.
visLayoutVertAlignTop | 2 | Align the top edges of the shapes.
visLayoutVertAlignMiddle | 3 | Align the middles of the shapes.
visLayoutVertAlignBottom | 4 | Align the bottom edges of the shapes.


VisLegendFlags Enumeration (Visio)

 Copy code hover
[image]

VisLegendFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies contants that define whether to populate the legend; passed to the DropLegend method.

Name | Value | Description
visLegendPopulate | 0 | Drop the legend and populate it.
visLegendNoContents | 1 | Drop the legend and do not populate it.


VisLinkReplaceBehavior Enumeration (Visio)

 Copy code hover
[image]

VisLinkReplaceBehavior Enumeration (Visio)
Send feedback

Published: July 16, 2012

Link replacement behavior constants passed to and returned by the DataRecordset.LinkReplaceBehavior property.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visLinkReplaceAlways | 1 | Always replace links when linking to a shape that has existing links.
visLinkReplaceNever | 0 | Never replace links when linking to a shape that has existing links.
visLinkReplacePrompt | 2 | Prompt the user before replacing links when the user attempts to create links in the Microsoft Office Visio user interface.


VisListAlignment Enumeration (Visio)

 Copy code hover
[image]

VisListAlignment Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define different ways to align shapes; passed to and returned by the ContainerProperties.ListAlignment property.

Version Information

Version Added: Visio 2010

Name | Value | Description
visListAlignLeftOrTop | 0 | Left-align or top-align shapes.
visListAlignCenterOrMiddle | 1 | Center-align or middle-align shapes.
visListAlignRightOrBottom | 2 | Right-align or bottom-align shapes.


VisListDirection Enumeration (Visio)

 Copy code hover
[image]

VisListDirection Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that identify the list direction; passed to and returned by the ContainerProperties.ListDirection property.

Version Information

Version Added: Visio 2010

Name | Value | Description
visListDirLeftToRight | 0 | Shapes are arranged horizontally, from left to right.
visListDirRightToLeft | 1 | Shapes are arranged horizontally, from right to left.
visListDirTopToBottom | 2 | Shapes are arranged vertically, from top to bottom.
visListDirBottomToTop | 3 | Shapes are arranged vertically, from bottom to top.


VisMasterProperties Enumeration (Visio)

 Copy code hover
[image]

VisMasterProperties Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values for various properties of a Microsoft Visio master.

Constant | Value | Description
visAutomatic | 1 | Generate icon automatically from shape data.
visCenter | 2 | Master name center-aligned.
visDouble | 4 | Icon size is double (64 x 64 pixels).
visIconFormatBMP | 2 | Use bitmap icon format.
visIconFormatVisio | 0 | Use Visio icon format.
visLeft | 1 | Master name left-aligned.
visManual | 0 | Generate icon manually.
visMasFPCenter | 4096 | Fill pattern is centered.
visMasFPScale | 16384 | Fill pattern is scaled.
visMasFPStretch | 8192 | Fill pattern is stretched to fit available space.
visMasFPTile | 0 | Fill pattern is tiled (repeated).
visMasIsFillPat | 4 | Master is a fill pattern.
visMasIsLineEnd | 2 | Master is a line end.
visMasIsLinePat | 1 | Master is a line pattern.
visMasLEDefault | 0 | Use default line-end properties.
visMasLEScale | 1024 | Line end is scaled.
visMasLEUpright | 256 | Line end always remains upright (does not rotate with the line).
visMasLPAnnotate | 48 | Line pattern is annotated.
visMasLPScale | 64 | Line pattern is scaled.
visMasLPStretch | 32 | Line pattern is stretched to fit available space.
visMasLPTileDeform | 0 | Line pattern is tiled and deformed when line curves.
visMasLPTile | 16 | Line pattern is tiled (repeated).
visNormal | 1 | Icon size is normal (32 x 32 pixels).
visRight | 3 | Master name right-aligned.
visTall | 2 | Icon size is tall (32 x 64 pixels).
visWide | 3 | Icon size is wide (64 x 32 pixels)


VisMasterTypes Enumeration (Visio)

 Copy code hover
[image]

VisMasterTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Master-type constants passed to the Masters.AddEx method.

Name | Value | Description
visTypeDataGraphic | 5 | Data graphic master.
visTypeFillPattern | 2 | Fill pattern master.
visTypeLineEnd | 4 | Line end master.
visTypeLinePattern | 3 | Line pattern master.
visTypeMaster | 1 | Generic master, no overload.
visTypeThemeColors | 6 | Theme colors master.
visTypeThemeEffects | 7 | Theme effects master.


VisMeasurementSystem Enumeration (Visio)

 Copy code hover
[image]

VisMeasurementSystem Enumeration (Visio)
Send feedback

Published: July 16, 2012

Measurement system types to be passed to the Documents.AddEx method.

Constant | Value | Description
visMSDefault | 0 | Choose metric or U.S., depending on regional options set in Control Panel.
visMSMetric | 1 | Metric measurement system.
visMSUS | 2 | U.S. (English) units measurement system.


VisMemberAddOptions Enumeration (Visio)

 Copy code hover
[image]

VisMemberAddOptions Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies whether to expand the container to accomodate the new member(s) or to resize it automatically according to the default settings; constants passed to the ContainerProperties.AddMember method.

Version Information

Version Added: Visio 2010

Name | Value | Description
visMemberAddUseResizeSetting | 0 | Defer to the setting of the ContainerProperties.ResizeAsNeeded property.
visMemberAddExpandContainer | 1 | Expand the container to fit the incoming shape(s).
visMemberAddDoNotExpand | 2 | Do not expand the container to fit the incoming shape(s).


VisMouseMoveDragStates Enumeration (Visio)

 Copy code hover
[image]

VisMouseMoveDragStates Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants returned by the MouseEvent.DragState property.

Name | Value | Description
visMouseMoveDragStatesBegin | 1 | User is beginning to drag an object with the mouse.
visMouseMoveDragStatesDrop | 5 | User dropped the dragged object in the drop-target window.
visMouseMoveDragStatesEnter | 2 | User is dragging an object into the drop-target window with the mouse.
visMouseMoveDragStatesLeave | 4 | User is moving the mouse out of the drop-target window.
visMouseMoveDragStatesNone | 0 | Either not a mouse movement or a mouse movement that is not a drag operation.
visMouseMoveDragStatesOver | 3 | User is moving the dragged object within the drop-target window with the mouse.


VisObjectTypes Enumeration (Visio)

 Copy code hover
[image]

VisObjectTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies codes returned by the ObjectType property.

Constant | Value | Description
visObjTypeAddon | 31 | Addon object
visObjTypeAddons | 32 | Addons collection
visObjTypeApplicationSettings | 51 | ApplicationSettings object
visObjTypeApp | 3 | Application object
visObjTypeCell | 4 | Cell object
visObjTypeChars | 5 | Characters object
visObjTypeColor | 29 | Color object
visObjTypeColors | 30 | Colors collection
visObjTypeComment | 74 | Comment object
visObjTypeComments | 74 | Comments collection
visObjTypeConnect | 8 | Connect object
visObjTypeConnects | 9 | Connects collection
visObjTypeContainerProperties | 60 | ContainerProperties collection
visObjTypeCurve | 42 | Curve object
visObjTypeDataColumn | 56 | DataColumn object
visObjTypeDataColumns | 55 | DataColumns collection
visObjTypeDataConnection | 54 | DataConnection object
visObjTypeDataRecordset | 53 | DataRecordset object
visObjTypeDataRecordsetChangedEvent | 57 | DataRecordsetChangedEvent object
visObjTypeDataRecordsets | 52 | DataRecordsets collection
visObjTypeDoc | 10 | Document object
visObjTypeDocs | 11 | Documents collection
visObjTypeEventList | 34 | EventList collection
visObjTypeEvent | 33 | Event object
visObjTypeFont | 27 | Font object
visObjTypeFonts | 28 | Fonts collection
visObjTypeGlobal | 36 | Global object
visObjTypeGraphicItem | 59 | GraphicItem object
visObjTypeGraphicItems | 58 | GraphicItems collection
visObjTypeHyperlink | 37 | Hyperlink object
visObjTypeHyperlinks | 43 | Hyperlinks collection
visObjTypeKeyboardEvent | 50 | KeyboardEvent object
visObjTypeLayer | 25 | Layer object
visObjTypeLayers | 26 | Layers collection
visObjTypeMasterShortcut | 47 | MasterShortcut object
visObjTypeMasterShortcuts | 46 | MasterShortcuts collection
visObjTypeMaster | 12 | Master object
visObjTypeMasters | 13 | Masters collection
visObjTypeMouseEvent | 49 | MouseEvent object
visObjTypeMovedSelectionEvent | 62 | MovedSelectionEvent object
visObjTypeMSGWrap | 48 | MSGWrap object
visObjTypeOLEObject | 39 | OLEObject object
visObjTypeOLEObjects | 38 | OLEObjects collection
visObjTypePage | 14 | Page object
visObjTypePages | 15 | Pages collection
visObjTypePath | 41 | Path object
visObjTypePaths | 40 | Paths collection
visObjTypeRelatedShapePairEvent | 61 | RelatedShapePairEvent object
visObjTypeReplaceShapesEvent | 71 | ReplaceShapesEvent object
visObjTypeRow | 45 | Row object
visObjTypeSection | 44 | Section object
visObjTypeSelection | 16 | Selection object
visObjTypeServerPublishOptions | 63 | ServerPublishOptions object
visObjTypeShape | 17 | Shape object
visObjTypeShapes | 18 | Shapes collection
visObjTypeStyle | 19 | Style object
visObjTypeStyles | 20 | Styles object
visObjTypeUnknown | 1 | Unknown object
visObjTypeValidation | 64 | Validation object
visObjTypeValidationIssue | 70 | ValidationIssue object
visObjTypeValidationIssues | 69 | ValidationIssues collection
visObjTypeValidationRule | 68 | ValidationRule object
visObjTypeValidationRules | 67 | ValidationRules collection
visObjTypeValidationRuleSet | 66 | ValidationRuleSet object
visObjTypeValidationRuleSets | 65 | ValidationRuleSets collection
visObjTypeWindow | 21 | Window object
visObjTypeWindows | 22 | Windows collection


VisOnComponentEnterCodes Enumeration (Visio)

 Copy code hover
[image]

VisOnComponentEnterCodes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to pass to the Application.OnComponentEnterState method.

Constant

Value

Description

visComponentStateModal

1

The state being identified is a modal state.

visModalDeferEvents

&H10000

Causes Microsoft Visio to attempt to defer firing events while modal. By default, Visio defers firing events when displaying its own dialog boxes, but does not defer firing events when client code has caused a dialog box to appear.

In the case of several nested modal scopes, if any scope is deferring events, all scopes within the outermost scope that is deferring events defer events.

This flag only has an effect when Visio is entering a modal scope. When exiting a modal scope, Visio behaves as it did when entering the scope.

visModalDisableVisiosFrame

&H80000

Causes Visio to disable its frame window while modal. By default, Visio disables its frame window when showing its own dialog boxes or when showing dialog boxes implemented by Microsoft Visual Basic for Applications (VBA), but not when client code in another process shows a dialog box.

If code in another process wants to show a dialog box and have the Visio frame window behave as if it is the Visio process showing the dialog box, it can set this flag.

This flag only has an effect when entering a modal scope. When exiting a modal scope, Visio behaves as it did when entering the scope.

visModalDontBlockMessages

&H40000

Prevents Visio from rejecting calls from outside its main thread while modal. By default, Visio does reject calls from outside its thread while modal.

In the case of several nested modal scopes, if any scope is deferring events, all scopes within the outermost scope that is deferring events defer events.

This flag only has an effect when entering a modal scope. When exiting a modal scope, Visio behaves as it did when entering the scope.

visModalNoBeforeAfter

&H20000

Prevents Visio from firing a BeforeModal event when entering a modal scope or an AfterModal event when leaving a modal scope.

By default, Visio fires these events when displaying its own dialog boxes or displaying dialog boxes implemented by VBA, but does not fire these events when client code displays a dialog box.

Calling the OnComponentEnterState method causes these events to fire unless visModalNoBeforeAfter is specified.


VisOpenSaveArgs Enumeration (Visio)

 Copy code hover
[image]

VisOpenSaveArgs Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to be passed to the Documents.AddEx, Documents.OpenEx, and Documents.SaveAsEx methods.

Constant | Value | Description
visAddDeclineAutoRefresh | 1024 | Adds a document without displaying the Configure Refresh dialog box.
visAddDocked | 4 | Adds a document in a docked window.
visAddHidden | 64 | Adds a document in a hidden window.
visAddMacrosDisabled | 128 | Adds a document with macros disabled.
visAddMinimized | 16 | Adds a document in a minimized window
visAddNoWorkspace | 256 | Adds a document with no workspace information.
visAddStencil | 512 | Adds a new stencil file.
visOpenCopy | 1 | Opens a copy of the document.
visOpenCopyOfNaming | 2048 | Opens a copy of the document, using a copy of the naming.
visOpenDeclineAutoRefresh | 1024 | Opens a document without displaying the Configure Refresh dialog box.
visOpenDocked | 4 | Opens a stencil in a docked window.
visOpenDontList | 8 | Opens the document without adding it to the Most Recently Used (MRU) list.
visOpenHidden | 64 | Opens the document in a hidden window.
visOpenMacrosDisabled | 128 | Opens the document with macros disabled.
visOpenMinimized | 16 | Opens the document in a minimized window.
visOpenNoWorkspace | 256 | Opens the document with no workspace information.
visOpenRO | 2 | Opens the document as read-only.
visOpenRW | 32 | Opens the document for both reading and writing.
visSaveAsCheckCompatibility |  | Displays the Compatibility Checker dialog box on save.
visSaveAsListInMRU | 4 | Saves the document and puts it in the MRU list.
visSaveAsRO | 1 | Saves the document as read-only.
visSaveAsWS | 2 | Saves the workspace and the file.


VisPageAndMasterIDs Enumeration (Visio)

 Copy code hover
[image]

VisPageAndMasterIDs Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values related to the IDs of Microsoft Visio masters and pages.

Constant | Value | Description
visInvalMasterID | -1 | An ID no master will ever have.
visInvalPageID | -1 | An ID no master will ever have.


VisPageSizingBehaviors Enumeration (Visio)

 Copy code hover
[image]

VisPageSizingBehaviors Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values for the DrawingControl.PageSizingBehavior property.

Constant | Value | Description
visNeverResizePages | 0 | Do not automatically resize pages under any circumstances.
visResizePages | 1 | Automatically resize all pages when the Microsoft Visio Drawing Control is resized or when a new document is loaded into it. Leave shapes unchanged.


VisPageTypes Enumeration (Visio)

 Copy code hover
[image]

VisPageTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Type codes returned by the Page.Type property.

Constant | Value | Description
visPageTypeInval | 0 | Not a Microsoft Visio page.
visTypeBackground | 2 | A background page.
visTypeForeground | 1 | A foreground page.
visTypeMarkup | 3 | An annotation page.


VisPaperSizes Enumeration (Visio)

 Copy code hover
[image]

VisPaperSizes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags passed to or returned by the Document.PaperSize property.

Constant | Value | Description
visPaperSizeA3 | 8 | A3 297 x 420 mm
visPaperSizeA4 | 9 | A4 210 x 297 mm
visPaperSizeA5 | 11 | A5 148 x 210 mm
visPaperSizeB4 | 12 | B4 (JIS) 250 x 354 mm
visPaperSizeB5 | 13 | B5 (JIS) 182 x 257 mm
visPaperSizeFolio | 14 | Folio 8 1/2 x 13 in.
visPaperSizeLegal | 5 | Legal 8 1/2 x 14 in.
visPaperSizeLetter | 1 | Letter 8 1/2 x 11 in.
visPaperSizeNote | 18 | Note 8 1/2 x 11 in.
visPaperSizeSizeC | 24 | C size sheet 17 x 22 in.
visPaperSizeSizeD | 25 | D size sheet 22 x 34 in.
visPaperSizeSizeE | 26 | E size sheet 34 x 44 in.
visPaperSizeUnknown | 0 | Unknown


VisPasteSpecialCodes Enumeration (Visio)

 Copy code hover
[image]

VisPasteSpecialCodes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Format codes passed to the PasteSpecial method.

Constant | Value | Description
visPasteBitmap | 2 | Paste bitmap.
visPasteDIB | 8 | Paste device-independent bitmap.
visPasteEMF | 14 | Paste enhanced metafile.
visPasteHyperlink | 65538 | Paste hyperlink.
visPasteInk | 65544 | Paste Ink data.
visPasteMetafile | 3 | Paste metafile.
visPasteOEMText | 7 | Paste OEM text.
visPasteOLEObject | 65536 | Paste OLE object.
visPasteRichText | 65537 | Paste rich text.
visPasteText | 1 | Paste ANSI text.
visPasteURL | 65539 | Paste Uniform Resource Locator (URL).
visPasteVisioIcon | 65543 | Paste Microsoft Visio icon.
visPasteVisioMastersXML | 65546 | Paste Visio masters XML.
visPasteVisioMasters | 65541 | Paste Visio masters.
visPasteVisioShapesXML | 65545 | Paste Visio shapes XML.
visPasteVisioShapesWithoutDataLinks | 65548 | Paste Visio drawing data without internal data links.
visPasteVisioShapes | 65540 | Paste Visio shapes.
visPasteVisioText | 65542 | Paste Visio text.


VisPrimaryKeySettings Enumeration (Visio)

 Copy code hover
[image]

VisPrimaryKeySettings Enumeration (Visio)
Send feedback

Published: July 16, 2012

Primary key settings constants passed to the DataRecordset.SetPrimaryKey method and returned by the DataRecordset.GetPrimaryKey method.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visKeyComposite | 3 | Use multiple columns as primary key columns.
visKeyRowOrder | 1 | Use row order as the primary key.
visKeySingle | 2 | Use a single column as the primary key column.


VisPrintOutRange Enumeration (Visio)

 Copy code hover
[image]

VisPrintOutRange Enumeration (Visio)
Send feedback

Published: July 16, 2012

Range constants to be used with the Document.PrintOut method.

Constant | Value | Description
visPrintAll | 0 | Print all foreground pages.
visPrintCurrentPage | 2 | Print current page.
visPrintCurrentView | 4 | Print current view area.
visPrintFromTo | 1 | Print pages between from index and to index.
visPrintSelection | 3 | Print selection.


VisProtection Enumeration (Visio)

 Copy code hover
[image]

VisProtection Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to be passed to or returned by the Document.Protection property.

Constant | Value | Description
visProtectBackgrounds | &H8 | Protect document backgrounds from user customization.
visProtectMasters | &H4 | Protect document masters from user customization.
visProtectNone | &H0 | Document is unprotected.
visProtectPreviews | &H10 | Protect document previews from user customization.
visProtectShapes | &H2 | Protect document shapes from user customization.
visProtectStyles | &H1 | Protect document styles from user customization.


VisPublishDataRecordsets Enumeration (Visio)

 Copy code hover
[image]

VisPublishDataRecordsets Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define which data recordsets to publish; passed to the ServerPublishOptions.SetRecordsetsToPublish method and returned by the ServerPublishOptions.GetRecordsetsToPublish method.

Version Information

Version Added: Visio 2010

Name | Value | Description
visPublishDataRecordsetAll | 0 | Publish all data recordsets in the document.
visPublishDataRecordsetNone | 1 | Publish none of the data recordsets in the document.
visPublishDataRecordsetSelect | 2 | Publish selected data recordsets.


VisPublishPages Enumeration (Visio)

 Copy code hover
[image]

VisPublishPages Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define which pages to publish; passed to the ServerPublishOptions.SetPagesToPublish method and returned by the ServerPublishOptions.GetPagesToPublish method.

Version Information

Version Added: Visio 2010

Name | Value | Description
visPublishPageAll | 0 | Publish all pages.
visPublishPageSelect | 1 | Publish selected pages.


VisQuickStyleColors Enumeration (Visio)

 Copy code hover
[image]

VisQuickStyleColors Enumeration (Visio)
Send feedback

Published: July 16, 2012

Quick style color constants passed to the Selection.SetQuickStyle and Shape.SetQuickStyle methods.

Members

Name | Value | Description
visQuickStyleColorAccent1 | 2 | Color accent 1
visQuickStyleColorAccent2 | 3 | Color accent 2
visQuickStyleColorAccent3 | 4 | Color accent 3
visQuickStyleColorAccent4 | 5 | Color accent 4
visQuickStyleColorAccent5 | 6 | Color accent 5
visQuickStyleColorAccent6 | 7 | Color accent 6
visQuickStyleColorBackground | 8 | Background color
visQuickStyleColorDark | 0 | Dark color
visQuickStyleColorLight | 1 | Light color
visQuickStyleColorVariant1 | 100 | Color variant 1
visQuickStyleColorVariant2 | 101 | Color variant 2
visQuickStyleColorVariant3 | 102 | Color variant 3
visQuickStyleColorVariant4 | 103 | Color variant 4
visQuickStyleColorVariant5 | 104 | Color variant 5
visQuickStyleColorVariant6 | 105 | Color variant 6
visQuickStyleColorVariant7 | 106 | Color variant 7


VisQuickStyleMatrixIndices Enumeration (Visio)

 Copy code hover
[image]

VisQuickStyleMatrixIndices Enumeration (Visio)
Send feedback

Published: July 16, 2012

Quick Style shape-style constants passed to the Selection.SetQuickStyle and Shape.SetQuickStyle methods.

Members

Name | Value | Description
visQuickStyleMatrixNone | 0 | No matrix theme
visQuickStyleMatrixTheme1 | 1 | Matrix theme 1
visQuickStyleMatrixTheme2 | 2 | Matrix theme 2
visQuickStyleMatrixTheme3 | 3 | Matrix theme 3
visQuickStyleMatrixTheme4 | 4 | Matrix theme 4
visQuickStyleMatrixTheme5 | 5 | Matrix theme 5
visQuickStyleMatrixTheme6 | 6 | Matrix theme 6
visQuickStyleMatrixVariant1 | 100 | Matrix variant 1
visQuickStyleMatrixVariant2 | 101 | Matrix variant 2
visQuickStyleMatrixVariant3 | 102 | Matrix variant 3
visQuickStyleMatrixVariant4 | 103 | Matrix variant 4


VisRasterExportColorFormat Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportColorFormat Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define the raster export color formats; passed to and returned by the RasterExportColorFormat property.

Name | Value | Description | Applicable File Formats
visRasterBiLevel | 0 | Bi-level color format | BMP, PNG, TIFF
visRaster16Color | 1 | 16-color format | BMP, PNG, TIFF
visRaster256Color | 2 | 256-color format | BMP, PNG, TIFF
visRaster24Bit | 3 | 24-bit color format; the default for PNG, TIFF, and BMP | BMP, PNG, TIFF
visRasterRGB | 4 | RGB color format; the default for JPG | JPG
visRasterYCC | 5 | YCC color format | JPG
visRasterGrayScale | 6 | Grayscale color format | JPG
visRasterCMYK | 7 | CMYK color format | JPG
visRaster16ColorGrayScale | 8 | 16-color grayscale color format | TIFF
visRaster256ColorGrayScale | 9 | 256-color grayscale color format | TIFF
visRaster16Bit | 10 | 16-bit color format | BMP


VisRasterExportColorReduction Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportColorReduction Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define the types of raster export color reduction; passed to and returned by the ApplicationSettings.RasterExportColorReduction property.

Name | Value | Description
visRasterAdaptive | 0 | Adaptive color reduction; the default for GIF files.
visRasterDiffusion | 1 | Diffusion color reduction.
visRasterHalftone | 2 | Halftone color reduction.


VisRasterExportDataCompression Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportDataCompression Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that identify the types of raster export data compression; passed to and returned by the ApplicationSettings.RasterExportDataCompression property.

Name | Value | Description | Applicable File Format
visRasterNone | 0 | No compression; the default for BMP. | BMP
visRasterRLE | 1 | RLE compression. | BMP
visRasterGroup3 | 2 | Group 3 compression. | TIFF
visRasterPackbits | 3 | Packbits compression. | TIFF
visRasterGroup4 | 4 | Group 4 compression. | TIFF
visRasterLZW | 5 | LZW compression. | TIFF
visRasterModifiedHuffman | 6 | Modified Huffman compression. | TIFF


VisRasterExportDataFormat Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportDataFormat Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that identify which raster export data format algorithm to use; passed to and returned by the RasterExportDataFormat property.

Name | Value | Description
visRasterInterlace | 0 | Interlace format; the default.
visRasterNonInterlace | 1 | Non-interlace format.


VisRasterExportFlip Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportFlip Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define how to apply the raster export flip; passed to and returned by the ApplicationSettings.RasterExportFlip property.

Name | Value | Description
visRasterNoFlip | 0 | No flip, the default.
visRasterFlipHorizontal | 1 | Flip horizontally.
visRasterFlipVertical | 2 | Flip vertically.


VisRasterExportOperation Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportOperation Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that identify the varieties of raster export operations; passed to and returned by the ApplicationSettings.RasterExportOperation property.

Name | Value | Description
visRasterBaseline | 0 | Baseline operation; the default.
visRasterProgressive | 1 | Progressive operation.


VisRasterExportResolution Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportResolution Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define which type of raster export resolution to use; passed to the SetRasterExportResolution method and returned by the GetRasterExportResolution method.

Name | Value | Description
visRasterUseScreenResolution | 0 | Use screen resolution.
visRasterUsePrinterResolution | 1 | Use printer resolution.
visRasterUseSourceResolution | 2 | Use source resolution.
visRasterUseCustomResolution | 3 | Use custom resolution.


VisRasterExportResolutionUnits Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportResolutionUnits Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define the raster export resolution units; passed to the SetRasterExportResolution method and returned by the GetRasterExportResolution method.

Name | Value | Description
visRasterPixelsPerInch | 0 | Pixels per inch.
visRasterPixelsPerCm | 1 | Pixels per centimeter.


VisRasterExportRotation Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportRotation Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define how to apply the raster export rotation; passed to and returned by the ApplicationSettings.RasterExportRotation property.

Name | Value | Description
visRasterNoRotation | 0 | No rotation; the default.
visRasterRotateLeft | 1 | Rotate left.
visRasterRotateRight | 2 | Rotate right.


VisRasterExportSize Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportSize Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define which raster export size to use; passed to the SetRasterExportSize method and returned by the GetRasterExportSize method.

Name | Value | Description
visRasterFitToScreenSize | 0 | Use screen size.
visRasterFitToPrinterSize | 1 | Use printer size.
visRasterFitToSourceSize | 2 | Use source size.
visRasterFitToCustomSize | 3 | Use custom size.


VisRasterExportSizeUnits Enumeration (Visio)

 Copy code hover
[image]

VisRasterExportSizeUnits Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define the raster export size units; passed to the SetRasterExportSize method and returned by the GetRasterExportSize method.

Name | Value | Description
visRasterPixel | 0 | Pixels
visRasterCm | 1 | Centimeters
visRasterInch | 2 | Inches


VisRefreshSettings Enumeration (Visio)

 Copy code hover
[image]

VisRefreshSettings Enumeration (Visio)
Send feedback

Published: July 16, 2012

Data recordset refresh constants passed to and returned by the DataRecordset.RefreshSettings property.

Note Note

This Visio object or member is available only to licensed users of Visio Professional 2013.

Name | Value | Description
visRefreshNoReconcilationUI | 2 | Disables display of the Refresh Conflicts task pane in the Microsoft Visio user interface after data is refreshed.
visRefreshOverwriteAll | 1 | When data is refreshed, overwrites all user changes made since the previous refresh operation.


VisRegionalUIOptions Enumeration (Visio)

 Copy code hover
[image]

VisRegionalUIOptions Enumeration (Visio)
Send feedback

Published: July 16, 2012

Text display options returned by the ApplicationSettings.AsianTextUI, ApplicationSettings.BIDITextUI, ApplicationSettings.ComplexTextUI, ApplicationSettings.KashidaTextUI, and ApplicationSettings.SATextUI properties.

Remarks

You can set regional user interface (UI) options on the Set the Office Language Preferences tab of the Visio Options dialog box. (Click the File tab, click Options, and then click Language).

Constant | Value | Description
visRegionalUIOptionsHide | 0 | Always hide regional UI.
visRegionalUIOptionsShow | 1 | Always show regional UI.
visRegionalUIOptionsUseSystemSettings | -1 | Not used.


VisRemoveHiddenInfoItems Enumeration (Visio)

 Copy code hover
[image]

VisRemoveHiddenInfoItems Enumeration (Visio)
Send feedback

Published: July 16, 2012

Document information constants passed to the Document.RemoveHiddenInformation method.

Name | Value | Description
visRHIDataRecordsets | 16 | Data recordsets.
visRHIMasters | 4 | Unused masters
visRHINone | 0 | No information.
visRHIPersonalInfo | 1 | Personal information.
visRHIPreview | 2 | Preview thumbnail.
visRHIStyles | 8 | Unused styles and display formats.
visRHIValidationRules | 32 | Validation rules.


VisReplaceFlags Enumeration (Visio)

 Copy code hover
[image]

VisReplaceFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Shape-replacement flags sent to the Shape.ReplaceShape and Selection.ReplaceShape methods and returned by the ReplaceShapesEvent.ReplaceFlags property, singly or in combination.

Members

Name | Value | Description
visReplaceShapeDefault | 0 | Use the behavior specified by the ShapeSheet cells ReplaceLockText, ReplaceLockShapeData, and ReplaceLockFormat, all in the Change Shape Behavior section.
visReplaceShapeKeepBasic | 1 | Override the behavior specified by the following ShapeSheet cells, all in the Change Shape Behavior section: behave as if ReplaceLockText = 0, ReplaceLockShapeData = 0, and ReplaceLockFormat = 0.
visReplaceShapeLockFormat | 8 | Override the behavior specified by the ReplaceLockFormat cell in the Change Shape Behavior section: behave as if ReplaceLockFormat = 1.
visReplaceShapeLockShapeData | 4 | Override the behavior specified by the ReplaceLockShapeData cell in the Change Shape Behavior section: behave as if ReplaceLockShapeData = 1.
visReplaceShapeLockText | 2 | Override the behavior specified by the ReplaceLockText cell in the Change Shape Behavior section: behave as if ReplaceLockText = 1.


VisResizeDirection Enumeration (Visio)

 Copy code hover
[image]

VisResizeDirection Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies the resize directions that correspond to the shape handles to move; passed to the Shape.Resize and Selection.Resize methods.

Version Information

Version Added: Visio 2010

Name | Value | Description
visResizeDirE | 0 | Middle right.
visResizeDirNE | 1 | Top right.
visResizeDirN | 2 | Top center.
visResizeDirNW | 3 | Top left.
visResizeDirW | 4 | Middle left.
visResizeDirSW | 5 | Bottom left.
visResizeDirS | 6 | Bottom center.
visResizeDirSE | 7 | Bottom right.


VisRibbonXModes Enumeration (Visio)

 Copy code hover
[image]

VisRibbonXModes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that identify the various modes in which to display the custom UI; constant passed to the RegisterRibbonX method.

Version Information

Version Added: Visio 2010

Name | Value | Description
visRXModeNone | 0 | Display the custom user interface (UI) when no document is active.
visRXModeDrawing | 1 | Display the custom UI in Drawing mode.
visRXModeStencil | 2 | Display the custom UI in Stencil mode.
visRXModePrintPreview | 4 | Display the custom UI in Print Preview mode.


VisRoleSelectionTypes Enumeration (Visio)

 Copy code hover
[image]

VisRoleSelectionTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies selections that contain all shapes of a given role; passed to the Master.CreateSelection, Page.CreateSelection, and Shape.CreateSelection methods.

Version Information

Version Added: Visio 2010

Name | Value | Description
visRoleSelConnector | 1 | A selection that contains all connector shapes.
visRoleSelContainer | 2 | A selection that contains all container shapes.
visRoleSelCallout | 4 | A selection that contains all callout shapes.


VisRotationTypes Enumeration (Visio)

 Copy code hover
[image]

VisRotationTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Rotation type constants to be passed to the Selection.Rotate method.

Constant | Value | Description
visRotateSelectionWithPin | 1 | Rotate the selection around a pin.
visRotateSelection | 0 | Rotate the selection relative to the center of the selection.
visRotateShapes | 2 | Rotate the selected shapes around their pins relative to their current angle.


VisRoundFlags Enumeration (Visio)

 Copy code hover
[image]

VisRoundFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants to pass to the Cell.ResultInt property.

Constant | Value | Description
visRound | 1 | Round the result.
visTruncate | 0 | Truncate the result.


VisRowIndices Enumeration (Visio)

 Copy code hover
[image]

VisRowIndices Enumeration (Visio)
Send feedback

Published: July 16, 2012

Logical indices of rows in ShapeSheet sections of Shape or Style objects.

Constant | Value | Description
visRow1stHyperlink | 0 | Index of the first row in visSectionHyperlink.
visRow3DRotationProperties | 30 | Index of the row in visSectionObject that defines the 3-D rotation properties of the shape.
visRowAction | 0 | Index of the first row in visSectionAction.
visRowAlign | 14 | Index of the row in visSectionObject that defines the shape's alignment.
visRowAnnotation | 0 | Index of the first row in visSectionAnnotation.
visRowBevelProperties | 29 | Index of the row in visSectionObject that defines the bevel properties of the shape.
visRowCharacter | 0 | Index of the first row in visSectionCharacter.
visRowComponent | 0 | Index of the component properties row in a Geometry section (visSectionFirstComponent+).
visRowConnectionPts | 0 | Index of the first row in visSectionConnectionPts.
visRowControl | 0 | Index of the first row in visSectionControl.
visRowDoc | 20 | Index of the row in visSectionObject that contains document properties.
visRowEvent | 5 | Index of the row in visSectionObject that contains event information.
visRowField | 0 | Index of the first row in visSectionTextField.
visRowFill | 3 | Index of the row in visSectionObject that defines fill properties.
visRowFirst | 0 | Row logically before every row in a section.
visRowForeign | 9 | Index of the row in visSectionObject that defines foreign properties (shape of type visTypeForeignObject).
visRowGradientProperties | 26 | Index of the row in visSectionObject that defines the gradient properties of the shape.
visRowGradientStop | 0 | Index of first row in visSectionLineGradientStops and visSectionFillGradientStops.
visRowGroup | 22 | Index of the row in visSectionObject that defines foreign properties (shape of type visTypeGroup).
visRowHelpCopyright | 16 | Index of the row in visSectionObject that defines Help and copyright properties.
visRowImage | 21 | Index of the row in visSectionObject that defines image properties (shape whose property is visTypeBitMap).
visRowInval | -1 | An invalid row index.
visRowLast | -2 | Row logically after every row in a section.
visRowLayerMem | 6 | Index of the row in visSectionObject that defines what layers the shape belongs to.
visRowLayer | 0 | Index of the first row in visSectionLayer.
visRowLine | 2 | Index of the row in visSectionObject that defines line properties.
visRowLock | 15 | Index of the row in visSectionObject that defines its lock properties.
visRowMisc | 17 | Index of the row in visSectionObject that defines miscellaneous behaviors.
visRowNone | -1 | Unspecified row.
visRowPageLayout | 24 | Index of the row in visSectionObject of a page or master that defines placement and routing.
visRowOtherEffectProperties | 28 | Index of the row in visSectionObject that defines other effect properties.
visRowPage | 10 | Index of the row in visSectionObject that defines page or master properties (shape of type visTypePage).
visRowParagraph | 0 | Index of the first row in visSectionParagraph.
visRowPrintProperties | 25 | Index of the row in visSectionObject of a document that defines printing properties. (Print Properties section in the ShapeSheet window.)
visRowProp | 0 | Index of the first row in visSectionProp.
visRowQuickStyleProperties | 27 | Index of the row in visSectionObject that defines QuickStyle properties.
visRowReplaceBehaviors | 32 | Index of the row in visSectionObject that defines replace-shape behaviors.
visRowReviewer | 0 | Index of the first row in visSectionReview.
visRowRulerGrid | 18 | Index of the row in visSectionObject of a page or master that defines the ruler and grid settings.
visRowScratch | 0 | Index of the first row in visSectionScratch.
visRowShapeLayout | 23 | Index of the row in visSectionObject of shape that defines placement and routing.
visRowSmartTag | 0 | Index of the first row in visSectionSmartTag.
visRowStyle | 8 | Index of the row in visSectionObject that defines style properties.
visRowTab | 0 | Index of the first row in visSectionTab.
visRowTextXForm | 12 | Index of the row in visSectionObject that defines a shape's text transform properties.
visRowText | 11 | Index of the row in visSectionObject that defines a shape or style's text block properties.
visRowThemeProperties | 31 | Index of the row in visSectionObject that defines theme properties for a shape.
visRowUser | 0 | Index of the first row in visSectionUser.
visRowVertex | 1 | Index of the first vertex row in a Geometry section.
visRowXForm1D | 4 | Index of the row in 1-D shape's visSectionObject that defines its endpoints.
visRowXFormOut | 1 | Index of the row in visSectionObject that defines the shape's transform properties.


VisRowTags Enumeration (Visio)

 Copy code hover
[image]

VisRowTags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Row-type constants used in conjunction with the Shape.RowType property and similar properties.

Constant | Value | Description
visTagArcTo | 140 | The row type of an ArcTo row in a Geometry section.
visTagCnnctNamed | 185 | The row type of a row in a visSectionConnectionPts section that has named rows.
visTagCnnctNamedABCD | 187 | The row type of an extended row in a visSectionConnectionPts section that has named rows. Seldom used.
visTagCnnctPt | 153 | The row type of a row in a visSectionConnectionPts section that has unnamed rows.
visTagCnnctPtABCD | 186 | The row type of an extended row in a visSectionConnectionPts section that has unnamed rows. Seldom used.
visTagComponent | 137 | The row type of the component properties row in a Geometry section.
visTagCtlPt | 162 | The row type of a row in visSectionControls that doesn't supply a ToolTip.
visTagCtlPtTip | 170 | The row type of a row in visSectionControls that supplies a ToolTip.
visTagDefault | 0 | Connotes row of default type to AddRow, AddNamedRows, or AddRows methods.
visTagEllipse | 143 | The row type of an Ellipse row in a Geometry section.
visTagEllipticalArcTo | 144 | The row type of an EllipticalArcTo row in a Geometry section.
visTagInfiniteLine | 141 | The row type of an InfiniteLine row in a Geometry section.
visTagLineTo | 139 | The row type of a LineTo row in a Geometry section.
visTagMoveTo | 138 | The row type of a MoveTo row in a Geometry section.
visTagNURBSTo | 195 | The row type of a NURBSTo row in a Geometry section.
visTagPolylineTo | 193 | The row type of a PolylineTo row in a Geometry section.
visTagRelCubBezTo | 236 | The row type of a RelCubBezTo row in a Geometry section.
visTagRelEllipticalArcTo | 240 | The row type of a RelEllipticalArcTo row in a Geometry section.
visTagRelLineTo | 239 | The row type of a RelLineTo row in a Geometry section.
visTagRelMoveTo | 238 | The row type of a RelMoveTo row in a Geometry section.
visTagRelQuadBezTo | 23777 | The row type of a RelQuadBezTo row in a Geometry section.
visTagSplineBeg | 165 | The row type of a SplineStart row in a Geometry section.
visTagSplineSpan | 166 | The row type of a SplineKnot row in a Geometry section.
visTagTab0 | 136 | The row type of a row in a visSectionTab section that defines 0 (zero) tab stops.
visTagTab10 | 151 | The row type of a row in a visSectionTab section that defines up to 10 tab stops.
visTagTab2 | 150 | The row type of a row in a visSectionTab section that defines up to 2 tab stops.
visTagTab60 | 181 | The row type of a row in a visSectionTab section that defines up to 60 tab stops.


VisRuleSetFlags Enumeration (Visio)

 Copy code hover
[image]

VisRuleSetFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define special rule-set behaviors; passed to and returned by the ValidationRuleSet.RuleSetFlags property.

Version Information

Version Added: Visio 2010

Name | Value | Description
visRuleSetDefault | 0 | The default rule-set property. The rule set appears in the Rules to Check list (click the Check Diagram arrow on the Process tab).
visRuleSetHidden | 1 | The rule set does not appear in the Rules to Check list.


VisRuleTargets Enumeration (Visio)

 Copy code hover
[image]

VisRuleTargets Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies contants that define the target of the validation rule; passed to and returned by the ValidationRule.TargetType property.

Version Information

Version Added: Visio 2010

Name | Value | Description
visRuleTargetDocument | 2 | The rule applies to the document itself.
visRuleTargetPage | 1 | The rule applies to pages in the document.
visRuleTargetShape | 0 | The rule applies to shapes in the document.


VisRunTypes Enumeration (Visio)

 Copy code hover
[image]

VisRunTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Run-type constants to be passed to the Characters.RunBegin and Characters.RunEnd properties.

Constant | Value | Description
visCharPropRow | 1 | Reports runs of characters that have common character properties. Corresponds to a set of characters covered by one row in a shape's Character section.
visFieldRun | 20 | Reports runs whose boundaries are between characters that are and aren't the result of the expansion of a text field, or between characters that are the result of the expansion of distinct text fields.
visParaPropRow | 2 | Reports runs of characters that have common paragraph properties. Corresponds to a set of characters covered by one row in the shape's Paragraph section.
visParaRun | 11 | Reports runs whose boundaries are between successive paragraphs in the shape's text. Mimics triple-clicking to select text.
visTabPropRow | 3 | Reports runs of characters that have common tab properties. Corresponds to a set of characters that are covered by one row in shape's Tabs section.
visWordRun | 10 | Reports runs whose boundaries are between successive words in a shape's text. Mimics double-clicking to select text.


VisSavePreviewMode Enumeration (Visio)

 Copy code hover
[image]

VisSavePreviewMode Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values passed to and returned by the Document.SavePreviewMode property.

Constant | Value | Description
visSavePreviewDraft1st | 1 | The first page; includes only Microsoft Visio shapes. Does not include embedded objects, text, or gradient fills.
visSavePreviewDraftAll | 4 | All file pages; includes only Visio shapes. Does not include embedded objects, text, or gradient fills.
visSavePreviewNone | 0 | No preview picture.


VisScrollbarStates Enumeration (Visio)

 Copy code hover
[image]

VisScrollbarStates Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants passed to and returned by the Window.ShowScrollBars property.

Constant | Value | Description
visScrollBarBoth | &H5 | Show both scrollbars.
visScrollBarHoriz | &H1 | Show the horizontal scrollbar.
visScrollBarNeither | &H0 | Show neither scrollbar.
visScrollBarVert | &H4 | Show the vertical scrollbar.


VisSectionIndices Enumeration (Visio)

 Copy code hover
[image]

VisSectionIndices Enumeration (Visio)
Send feedback

Published: July 16, 2012

Logical indices of ShapeSheet sections for Shape or Style objects.

Constant | Value | Description
visSectionAction | 240 | Stores the actions that appear on the shortcut menu.
visSectionAnnotation | 246 | Index of a section whose rows represent annotations.
visSectionCharacter | 3 | Stores character properties; for example, font.
visSectionConnectionPts | 7 | Stores an object's connection points.
visSectionControls | 9 | Stores an object's control handles.
visSectionFillGradientStops | 249 | Index of a section whose rows represent fill gradient stops.
visSectionFirstComponent | 10 | An object's first Geometry section. Additional sections have indices (visSectionFirstComponent + ).
visSectionFirst | 0 | Index whose value is less than any other section index.
visSectionHyperlink | 244 | Stores hyperlinks.
visSectionInval | 255 | An invalid index that no section will ever have.
visSectionLastComponent | 239 | An object's last Geometry section.
visSectionLast | 252 | Index whose value is greater than any other section index.
visSectionLayer | 241 | Stores a page or master's layer properties.
visSectionLineGradientStops | 248 | Index of a section whose rows represent line gradient stops.
visSectionNone | 255 | Unspecified section.
visSectionObject | 1 | Stores general non-repeating properties of an object.
visSectionParagraph | 4 | Stores paragraph properties; for example, indentation.
visSectionProp | 243 | Stores shape data (formerly custom properties).
visSectionReviewer | 245 | Index of section whose rows represent reviewers.
visSectionScratch | 6 | Holds scratch cells.
visSectionSmartTag | 247 | Index of section whose rows represent SmartTags.
visSectionTab | 5 | Stores position and alignment of tab stops.
visSectionTextField | 8 | Stores an object's text fields.
visSectionUser | 242 | Stores cells created and used by an external solution.


VisSelectArgs Enumeration (Visio)

 Copy code hover
[image]

VisSelectArgs Enumeration (Visio)
Send feedback

Published: July 16, 2012

Selection-type constants to be passed to the Selection.Select and Window.Select methods.

Constant | Value | Description
visDeselect | 1 | Deselects a shape but leaves the rest of the selection unchanged.
visSelect | 2 | Selects a shape but leaves the rest of the selection unchanged.
visSubSelect | 3 | Selects a shape whose parent is already selected.
visSelectAll | 4 | Selects a shape and all its peers.
visDeselectAll | 256 | Deselects a shape and all its peers.


VisSelectionTypes Enumeration (Visio)

 Copy code hover
[image]

VisSelectionTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Selection types to be passed to the CreateSelection method of the Master, Page, and Shape objects.

Constant | Value | Description
visSelTypeAll | 1 | A selection that initially contains all shapes.
visSelTypeByDataGraphic | 6 | A selection that initially contains all shapes that have a given type of data graphic appled.
visSelTypeByLayer | 3 | A selection that initially contains all the shapes of a given layer.
visSelTypeByMaster | 5 | A selection that initially contains all the instantiated shapes of a given master.
visSelTypeByRole | 7 | A selection that initially contains all the shapes that have a given role.
visSelTypeByType | 4 | A selection that initially contains all the shapes of a given type.
visSelTypeEmpty | 0 | A selection that initially contains no shapes.
visSelTypeSingle | 2 | A selection that initially contains one shape.


VisSelectItemStatus Enumeration (Visio)

 Copy code hover
[image]

VisSelectItemStatus Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values returned by the Selection.ItemStatus property.

Constant | Value | Description
visSelIsPrimaryItem | &H1 | The item is the primary item.
visSelIsSubItem | &H2 | The item is a subselected item.
visSelIsSuperItem | &H4 | The item is a superselected item.


VisSelectMode Enumeration (Visio)

 Copy code hover
[image]

VisSelectMode Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants passed to and returned by the Selection.IterationMode property and the CreateSelection method.

Constant | Value | Description
visSelModeOnlySub | &H0800 | Selection reports only subselected shapes.
visSelModeOnlySuper | &H0200 | Selection reports only superselected shapes.
visSelModeSkipSub | &H0400 | Selection does not report subselected shapes.
visSelModeSkipSuper | &H0100 | Selection does not report superselected shapes.


VisShapeIDs Enumeration (Visio)

 Copy code hover
[image]

VisShapeIDs Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values related to the IDs of shapes.

Constant | Value | Description
visInvalShapeID | -1 | An ID no shape will ever have; used for comparison against valid ID values that are returned by the Shape.ID and Shapes.ItemFromID properties.
visPageSheetID | 0 | The ID of a page's or master's page sheet; the value of the Shape.ID property when the shape is a page sheet.


VisShapeTypes Enumeration (Visio)

 Copy code hover
[image]

VisShapeTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Shape type codes returned by the Shape.Type and Shape.ForeignType properties.

Remarks

These codes are also used with the Event.GetFilterObjects and Event.SetFilterObjects methods to filter events by object type.

Constant | Value | Description
visTypeBitmap | 32 | Returned by Shape.ForeignType if the shape is a bitmap.
visTypeDoc | 6 | The document's DocumentSheet.
visTypeForeignObject | 4 | An imported shape.
visTypeGroup | 2 | A shape that contains other shapes.
visTypeGuide | 5 | A shape that is a guide.
visTypeInk | 64 | Returned by Shape.ForeignType if the shape is ink.
visTypeInval | 0 | The type of no shape. Means all types when used as filter code.
visTypeIsControl | 1024 | Returned by Shape.ForeignType if the shape is a control.
visTypeIsEmbedded | 512 | Returned by Shape.ForeignType if the shape is embedded.
visTypeIsLinked | 256 | Returned by Shape.ForeignType if the shape is linked.
visTypeIsOLE2 | 32768 | Returned by Shape.ForeignType if the shape is linked, embedded, or a control.
visTypeMetafile | 16 | Returned by Shape.ForeignType if the shape is a metafile.
visTypePage | 1 | Page's or master's PageSheet property.
visTypeShape | 3 | Native Microsoft Visio shape.


VisSnapExtensions Enumeration (Visio)

 Copy code hover
[image]

VisSnapExtensions Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags passed to or returned by the Document.SnapExtensions property.

Remarks

The VisSnapExtensions constants specify the snap extensions currently active in the document.

Constant | Value | Description
visSnapExtAlignmentBoxExtension | &H1 | Show alignment box extensions.
visSnapExtCenterAxes | &H2 | Show center alignment axes.
visSnapExtCurveExtension | &H40 | Show curved extensions
visSnapExtCurveTangent | &H4 | Show curve interior tangents.
visSnapExtEllipseCenter | &H800 | Show ellipse center points.
visSnapExtEndpointHorizontal | &H200 | Show horizontal lines at endpoint.
visSnapExtEndpointPerpendicular | &H80 | Show endpoint perpendicular lines.
visSnapExtEndpointVertical | &H400 | Show vertical lines at endpoint.
visSnapExtEndpoint | &H8 | Show segment endpoints.
visSnapExtIsometricAngles | &H1000 | Show isometric angle lines.
visSnapExtLinearExtension | &H20 | Show linear extensions.
visSnapExtMidpointPerpendicular | &H100 | Show midpoint perpendicular lines.
visSnapExtMidpoint | &H10 | Show segment midpoints.
visSnapExtNone | &H0 | Show no extentions.


VisSnapSettings Enumeration (Visio)

 Copy code hover
[image]

VisSnapSettings Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags passed to or returned by the Document.SnapSettings property.

Constant | Value | Description
visSnapToAlignmentBox | &H200 | Snap to the alignment box.
visSnapToConnectionPoints | &H20 | Snap to connection points.
visSnapToDisabled | &H8000 | Disable snap.
visSnapToExtensions | &H400 | Snap to shape extensions options.
visSnapToGeometry | &H100 | Snap to the visible edges of shapes.
visSnapToGrid | &H2 | Snap to the grid.
visSnapToGuides | &H4 | Snap to guides.
visSnapToHandles | &H8 | Snap to selection handles.
visSnapToIntersections | &H10000 | Snap to intersections.
visSnapToNone | &H0 | Snap to nothing.
visSnapToRulerSubdivisions | &H1 | Snap to tick marks on the ruler.
visSnapToVertices | &H10 | Snap to vertices.


VisSpatialRelationCodes Enumeration (Visio)

 Copy code hover
[image]

VisSpatialRelationCodes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Codes for spatial relationships between shapes to be passed to the Shape.SpatialRelation property.

Remarks

The spatial relationship between shapes can be indicated by any combination of the following values.

Constant | Value | Description
visSpatialContainedIn | &H4 | A shape can be contained within another shape. Shape B is contained within shape A if shape A encloses every region and path of shape B.
visSpatialContain | &H2 | A shape can contain another shape. Shape A contains shape B if shape A encloses every region and path of shape B.
visSpatialOverlap | &H1 | Two shapes can overlap. Shapes overlap if their interior regions have at least one point in common. You will also get this result if you compare a shape to itself or if either shape is a sub-shape of the other.
visSpatialTouching | &H8 | A shape can be touching another shape. Shape A touches shape B if neither one contains or overlaps the other and they have one or more common points whose distance is within the specified tolerance.


VisSpatialRelationFlags Enumeration (Visio)

 Copy code hover
[image]

VisSpatialRelationFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags passed to various properties of the Shape object, including the DistanceFrom, DistanceFromPoint, SpatialNeighbors, SpatialRelation, and SpatialSearch properties.

Constant | Value | Description
visSpatialBackToFront | &H8 | Order items back to front.
visSpatialFrontToBack | &H4 | Order items front to back.
visSpatialIgnoreVisible | &H20 | Do not consider visible Geometry sections. By default, visible Geometry sections influence the result.
visSpatialIncludeContainerShapes | &H80 | Include containers. By default, containers are not included.
visSpatialIncludeDataGraphics | &H40 | Include data graphic callout shapes and their sub-shapes. By default, data graphic callout shapes and their subshapes are not included. If the parent shape is itself a data graphic callout, searches are made between the parent shape's geometry and non-callout shapes, unless this flag is set.
visSpatialIncludeGuides | &H2 | Consider a guide's Geometry section. By default, guides do not influence the result.
visSpatialIncludeHidden | &H10 | Consider hidden Geometry sections. By default, hidden Geometry sections do not influence the result.


VisStatCodes Enumeration (Visio)

 Copy code hover
[image]

VisStatCodes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Status information codes returned by the Stat property of various objects.

Constant | Value | Description
visStatAppHasShutdown | 1 | The application has stopped.
visStatClosed | 8 | Object is closed.
visStatDeleted | 2 | Object is deleted.
visStatNormal | 0 | Object status is normal.
visStatSuspended | 16 | Object status is suspended.


VisSVGExportFormat Enumeration (Visio)

 Copy code hover
[image]

VisSVGExportFormat Enumeration (Visio)
See also Send feedback

Published: July 16, 2012

Constants passed to and returned by the ApplicationSettings.SVGExportFormat property that specify whether to include both SVG elements and Visio elements when saving Microsoft Visio documents to the SVG file format.

Members

Name | Value | Description
visSVGExcludeVisioElements | 1 | Include SVG elements only.
visSVGIncludeVisioElements | 0 | Include both SVG elements and Visio elements. This is the default.

See also

Other resources

ApplicationSettings.SVGExportFormat


VisThemeColors Enumeration (Visio)

 Copy code hover
[image]

VisThemeColors Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies theme color constants that are passed to and returned by the Page.ThemeColors property.

Name | Value | Description
visThemeColorsNone | 0 | No theme colors
visThemeColorsMonochrome | 1 | Monochrome
visThemeColorsOffice | 2 | Microsoft Office colors
visThemeColorsMedian | 3 | Median
visThemeColorsConcourse | 4 | Concourse
visThemeColorsSolstice | 5 | Solstice
visThemeColorsTechnic | 6 | Technic
visThemeColorsPaper | 7 | Paper
visThemeColorsFoundry | 8 | Foundry
visThemeColorsApex | 9 | Apex
visThemeColorsTrek | 10 | Trek
visThemeColorsModule | 11 | Module
visThemeColorsOriel | 12 | Oriel
visThemeColorsAspect | 13 | Aspect
visThemeColorsEquity | 14 | Equity
visThemeColorsCivic | 15 | Civic
visThemeColorsOpulent | 16 | Opulent
visThemeColorsVerve | 17 | Verve
visThemeColorsOrigin | 18 | Origin
visThemeColorsUrban | 19 | Urban
visThemeColorsFlow | 20 | Flow
visThemeColorsMetro | 21 | Metro
visThemeColorsOfficeLight | 22 | Microsoft Office colors light
visThemeColorsOfficeDark | 23 | Microsoft Office colors dark
visThemeColorsMedianLight | 24 | Median light
visThemeColorsMedianDark | 25 | Median dark
visThemeColorsConcourseLight | 26 | Concourse light
visThemeColorsConcourseDark | 27 | Concourse dark
visThemeColorsPaperLight | 28 | Paper light
visThemeColorsPaperDark | 29 | Paper dark
visThemeColorsFoundryLight | 30 | Foundry light
visThemeColorsFoundryDark | 31 | Foundry dark
visThemeColorsEquityLight | 32 | Equity light
visThemeColorsEquityDark | 33 | Equity dark
visThemeColorsVerveLight | 34 | Verve light
visThemeColorsVerveDark | 35 | Verve dark
visThemeColorsBasic | 36 | Basic
visThemeColorsAdjacency | 37 | Adjacency
visThemeColorsAngles | 38 | Angles
visThemeColorsApothecary | 39 | Apothecary
visThemeColorsAustin | 40 | Austin
visThemeColorsEssential | 41 | Essential
visThemeColorsBlackTie | 42 | Black tie
visThemeColorsComposite | 43 | Composite
visThemeColorsClarity | 44 | Clarity
visThemeColorsElemental | 45 | Elemental
visThemeColorsExecutive | 46 | Executive
visThemeColorsGrid | 47 | Grid
visThemeColorsHardcover | 48 | Hardcover
visThemeColorsHorizon | 49 | Horizon
visThemeColorsNewsprint | 50 | Newsprint
visThemeColorsCouture | 51 | Couture
visThemeColorsPerspective | 52 | Perspective
visThemeColorsPushpin | 53 | Pushpin
visThemeColorsSlipstream | 54 | Slipstream
visThemeColorsThatch | 55 | Thatch
visThemeColorsWaveform | 56 | Waveform


VisThemeEffects Enumeration (Visio)

 Copy code hover
[image]

VisThemeEffects Enumeration (Visio)
Send feedback

Published: July 16, 2012

Theme effects constants passed to and returned by the Page.ThemeEffects property. Thumbnails of theme effects are displayed in the Effects gallery in the Microsoft Visio user interface. Pause your mouse over a thumbnail to see the name of the theme effect.

Name | Value | Description
visThemeEffectsNone | 0 | No theme effect.
visThemeEffectsSubdued | 1 | Subdued.
visThemeEffectsSimpleShadow | 2 | Simple shadow.
visThemeEffectsButton | 3 | Button.
visThemeEffectsSquare | 4 | Square.
visThemeEffectsPillow | 5 | Pillow
visThemeEffectsBevelIllusion | 6 | Bevel illusion.
visThemeEffectsBevelHighlight | 7 | Bevel highlight.
visThemeEffectsOutline | 8 | Outline.
visThemeEffectsDecal | 9 | Decal.
visThemeEffectsRaisedSurface | 10 | Raised surface.
visThemeEffectsMesh | 11 | Mesh.
visThemeEffectsPinstripe | 12 | Pinstripe.
visThemeEffectsStripes | 13 | Stripes.
visThemeEffectsOblique | 14 | Oblique.
visThemeEffectsToy | 15 | Toy.
visThemeEffectsBasicShadow | 16 | Basic shadow.


VisThemeTypes Enumeration (Visio)

 Copy code hover
[image]

VisThemeTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Theme types passed to the Document.GetThemeNames and Document.GetThemeNamesU methods, as well as the Page.GetTheme method.

Name | Value | Description
visThemeTypeColor | 1 | Theme colors.
visThemeTypeConnector | 3 | Theme connectors.
visThemeTypeEffect | 2 | Theme effects.
visThemeTypeFont | 4 | Theme fonts.
visThemeTypeIndex | 0 | Theme indices.


VisToParts Enumeration (Visio)

 Copy code hover
[image]

VisToParts Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values returned by the Connect.ToPart property.

Remarks

The VisToParts return codes indicate the part of a shape to which a connection is made.

Constant | Value | Description
visConnectionPoint | 100 + row index of connection point | Connect to specified connection point on target shape.
visConnectToError | -1 | Error connecting to shape.
visGuideIntersect | 4 | Connect to intersection of guides on target shape.
visGuideX | 1 | Connect to vertical guide on target shape.
visGuideY | 2 | Connect to horizontal guide on target shape.
visToAngle | 7 | Connect to angle on target shape.
visToNone | 0 | Do not connect.
visWholeShape | 3 | Connect to entire target shape, using dynamic glue.


VisTraceFlags Enumeration (Visio)

 Copy code hover
[image]

VisTraceFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags to use with the Application.TraceFlags property.

Remarks

The value of the TraceFlags property can be a combination of the following values.

Constant | Value | Description
visTraceAddonInvokes | &H4 | Add-on invocations.
visTraceAdvises | &H2 | Outgoing advise calls.
visTraceCallsToVBA | &H8 | Microsoft Visual Basic for Applications (VBA) invocations.
visTraceEvents | &H1 | Event occurrences.


VisTypeSelectionTypes Enumeration (Visio)

 Copy code hover
[image]

VisTypeSelectionTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values passed to the Data argument of the CreateSelection method when the SelType argument is visSelTypeByType.

Constant | Value | Description
visTypeSelBitmap | 16 | A shape that is a bitmap.
visTypeSelGroup | 1 | A shape that contains other shapes.
visTypeSelGuide | 4 | A shape that is a guide.
visTypeSelInk | 32 | A shape that is ink.
visTypeSelMetafile | 8 | A shape that is a metafile.
visTypeSelOLE | 64 | A shape that is linked, embedded, or a control.
visTypeSelShape | 2 | A native Visio shape.


VisUIBarPosition Enumeration (Visio)

 Copy code hover
[image]

VisUIBarPosition Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values passed to and returned by the MenuSet.Position and Toolbar.Position properties.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constant | Value | Description
visBarBottom | 3 | Display docked at bottom of drawing window.
visBarFloating | 4 | Float in drawing window.
visBarLeft | 0 | Display docked at left of drawing window.
visBarMenu | 6 | Display in the menu bar.
visBarPopup | 5 | Float in drawing window.
visBarRight | 2 | Display docked at right of drawing window.
visBarTop | 1 | Display docked at top of drawing window.


VisUIBarProtection Enumeration (Visio)

 Copy code hover
[image]

VisUIBarProtection Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values passed to and returned by the MenuSet.Protection and Toolbar.Protection properties.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constant | Value | Description
visBarNoChangeDock | 16 | Can't be docked or floating.
visBarNoCustomize | 1 | Can't be customized.
visBarNoHorizontalDock | 64 | Can't be docked horizontally.
visBarNoMove | 4 | Can't be moved.
visBarNoProtection | 0 | No protection.
visBarNoResize | 2 | Can't be resized.
visBarNoVerticalDock | 32 | Can't be docked vertically.


VisUIBarRow Enumeration (Visio)

 Copy code hover
[image]

VisUIBarRow Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values passed to and returned by the MenuSet.RowIndex and Toolbar.RowIndex properties.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constant | Value | Description
visBarRowFirst | 0 | First row.
visBarRowLast | -1 | Last row.


VisUIButtonState Enumeration (Visio)

 Copy code hover
[image]

VisUIButtonState Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants describing the state of buttons in command bars to be passed to and returned from the ToolbarItem.State property

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constant | Value | Description
visButtonDown | -1 | Button is down.
visButtonUp | q | Button is up.


VisUIButtonStyle Enumeration (Visio)

 Copy code hover
[image]

VisUIButtonStyle Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants describing the style of command bar buttons to be passed to and returned by the ToolbarItem.Style property.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constant | Value | Description
visButtonAutomatic | 0 | Default style.
visButtonCaption | 2 | Text only (always).
visButtonIconandCaption | 3 | Image and text.
visButtonIcon | 1 | Text only (in menus).


VisUICmds Enumeration (Visio)

 Copy code hover
[image]

VisUICmds Enumeration (Visio)
Send feedback

Published: July 16, 2012

UI command ID constants, to be used in conjunction with the CmdNum property of various objects. These constants also correspond to scope IDs passed with the EnterScope and ExitScope events, and to command ranges passed to the Event.GetFilterCommands and Event.SetFilterCommands methods, as well as to commands passed to the Application.DoCmd method.

Constant | Value
visCmdABarAutoHeight | 1684
visCmdABarAutohide | 1652
visCmdABarHide | 1650
visCmdABarToggleFloat | 1651
visCmdAcquireImages | 1868
visCmdAddConnectPt | 1263
visCmdAddControlPt | 1266
visCmdAddDataRecordset | 1998
visCmdAddMemberToContainer | 2173
visCmdAddTextShape | 1181
visCmdAddToAllContainers | 2251
visCmdAddToNewContainer | 2268
visCmdAlignBox | 1768
visCmdAlignObjectBottom | 1201
visCmdAlignObjectCenter | 1197
visCmdAlignObjectLeft | 1196
visCmdAlignObjectMiddle | 1200
visCmdAlignObjectRight | 1198
visCmdAlignObjectTop | 1199
visCmdAllowThemes | 2056
visCmdApplyDataGraphic | 2017
visCmdApplyDataGraphicAfterLink | 2092
visCmdApplyMainTheme | 2285
visCmdApplyMainThemeToDocument | 2296
visCmdApplyMainThemeToPage | 2289
visCmdApplyThemeColors | 2188
visCmdApplyThemeEffects | 2189
visCmdApplyThemeToDoc | 2048
visCmdApplyThemeToNewShapesToggle | 2297
visCmdApplyThemeToPage | 2047
visCmdAppMaximize | 1864
visCmdAppMinimize | 1865
visCmdAppRestore | 1904
visCmdAssociateCallout | 2287
visCmdAutoAlign | 2223
visCmdAutoAlignAndSpace | 2222
visCmdAutoConnectToggle | 2091
visCmdAutoGenerateDataGraphics | 2105
visCmdAutoSpace | 2224
visCmdBreakOLELink | 1900
visCmdBrowseSampleDrawings | 1645
visCmdBullets | 1633
visCmdCancelInPlaceEditing | 1602
visCmdCenterDrawing | 1202
visCmdCheckCompatibility | 2182
visCmdCloseInkToolsRibbonTab | 2213
visCmdCloseWindow | 1361
visCmdCoauthMerging | 2385
visCmdCollapseShapesWindow | 2269
visCmdConnectorEffectCurved | 1945
visCmdConnectorEffectRightAngle | 1943
visCmdConnectorEffectStraight | 1944
visCmdConnPoints | 1774
visCmdContainerNoHeadingToggle | 2315
visCmdContainerAutoResizeExpandContract | 2349
visCmdContainerAutoResizeExpandOnly | 2348
visCmdContainerAutoResizeOff | 2347
visCmdCreateEditMaster | 1899
visCmdCreateNewDrawing | 1812
visCmdCreateShortcut | 1791
visCmdCropObject | 1192
visCmdCropTool | 1449
visCmdCustomPropertySets | 1675
visCmdCustProp | 1658
visCmdCustPropDefine | 1695
visCmdDataAutoConnect | 2098
visCmdDataAutoLink | 2046
visCmdDataAutoLinkWiz | 2045
visCmdDataColumnSettingsDlg | 2043
visCmdDataExplorerWindow | 2044
visCmdDataRecordsetProperties | 2072
visCmdDataRecordsetSetCommand | 2037
visCmdDataRecordsetSetPrimaryKey | 2038
visCmdDataRefresh | 2021
visCmdDataRefreshAddConflict | 2094
visCmdDataRefreshConfigDlg | 2022
visCmdDataRefreshDeleteConflict | 2095
visCmdDataRefreshDlg | 2019
visCmdDataRefreshResolveConflict | 2103
visCmdDataSelectorDlg | 2011
visCmdDataUnlinkRow | 2058
visCmdDataUnlinkShape | 2057
visCmdDecreaseIndent | 1093
visCmdDecreaseParaSpacing | 1095
visCmdDelConnectPt | 1265
visCmdDeleteBackWord | 1905
visCmdDeleteComment | 1920
visCmdDeleteConnectors | 2199
visCmdDeleteDataGraphic | 2067
visCmdDeleteDataRecordset | 1999
visCmdDeleteForwardWord | 2114
visCmdDeleteTheme | 2052
visCmdDeselectAll | 1213
visCmdDesignMode | 1388
visCmdDetectAndRepair | 1890
visCmdDiagramFlipHorizontal | 2229
visCmdDiagramFlipVertical | 2228
visCmdDiagramGallery | 1982
visCmdDiagramRotateLeft | 2227
visCmdDiagramRotateRight | 2226
visCmdDisbandContainer | 2204
visCmdDistributeBottom | 1238
visCmdDistributeCenter | 1233
visCmdDistributeHSpace | 1231
visCmdDistributeLeft | 1232
visCmdDistributeMiddle | 1237
visCmdDistributeRight | 1234
visCmdDistributeTop | 1236
visCmdDistributeVSpace | 1235
visCmdDlgCustomFit | 1536
visCmdDragDuplicate | 1184
visCmdDrawFillStyle | 1123
visCmdDrawGlue | 1125
visCmdDrawAddGuide | 1180
visCmdDrawingExplorer | 1721
visCmdDrawingTools | 1946
visCmdDrawLineStyle | 1122
visCmdDrawOval | 1183
visCmdDrawSnap | 1124
visCmdDrawRect | 1182
visCmdDrawRegion | 1742
visCmdDrawTextStyle | 1121
visCmdDrawZoom | 1126
visCmdDRConnectionTool | 1226
visCmdDRConnectorTool | 1225
visCmdDRLineTool | 1221
visCmdDropAndContain | 2172
visCmdDropAndInsertIntoList | 2196
visCmdDropCallout | 2286
visCmdDropManyOnPage | 1869
visCmdDropManyLinked | 2108
visCmdDropOnPage | 1246
visCmdDropOnStencil | 1244
visCmdDropOnText | 1243
visCmdDROvalTool | 1224
visCmdDRPencilTool | 1220
visCmdDRPointerTool | 1219
visCmdDRQtrArcTool | 1222
visCmdDRRectTool | 1223
visCmdDRRotateTool | 1228
visCmdDRSplineTool | 1311
visCmdDRTextTool | 1227
visCmdDuplicateDataGraphic | 2106
visCmdDuplicatePage | 2383
visCmdDuplicateTheme | 2050
visCmdEditUndoMultiple | 1682
visCmdDynamicGrid | 1765
visCmdDynConnReroute | 1829
visCmdEditConvertObject | 1439
visCmdEditFind | 1043
visCmdEditInsertField | 1032
visCmdEditInsertObject | 1031
visCmdEditLinks | 1030
visCmdEditOpenObject | 1029
visCmdEditPasteLink | 1028
visCmdEditPasteSpecial | 1027
visCmdEditRedo | 1018
visCmdEditRedoMultiple | 1683
visCmdEditRedoOrRepeat | 2295
visCmdEditRepeat | 1019
visCmdEditReplace | 1179
visCmdEditSelectSpecial | 1026
visCmdEditTheme | 2049
visCmdEditThemeColors | 2190
visCmdEditThemeEffects | 2191
visCmdEditUndo | 1017
visCmdEmailRouting | 1588
visCmdExportDatabaseAddon | 1891
visCmdFileCheckin | 1787
visCmdFileCheckout | 1788
visCmdFileChooseTemplates | 1583
visCmdFileClose | 1003
visCmdFileExit | 1016
visCmdFileImport | 1007
visCmdFileLastFile1 | 1012
visCmdFileLastFile10 | 2127
visCmdFileLastFile11 | 2128
visCmdFileLastFile12 | 2129
visCmdFileLastFile13 | 2130
visCmdFileLastFile14 | 2131
visCmdFileLastFile15 | 2132
visCmdFileLastFile16 | 2133
visCmdFileLastFile17 | 2134
visCmdFileLastFile18 | 2136
visCmdFileLastFile19 | 1012
visCmdFileLastFile2 | 1013
visCmdFileLastFile20 | 2137
visCmdFileLastFile3 | 1014
visCmdFileLastFile4 | 1015
visCmdFileLastFile5 | 1561
visCmdFileLastFile6 | 1569
visCmdFileLastFile7 | 1570
visCmdFileLastFile8 | 1571
visCmdFileLastFile9 | 1572
visCmdFileNew | 1001
visCmdFileNewBlankDrawing | 1579
visCmdFileNewBlankDrawingMetric | 1671
visCmdFileNewBlankDrawingUS | 1672
visCmdFileNewBlankStencil | 1582
visCmdFileNewBlankStencilMetric | 1673
visCmdFileNewBlankStencilUS | 1674
visCmdFileNewStencilDlg | 1580
visCmdFileOpen | 1002
visCmdFileOpenStencil | 1442
visCmdFilePrint | 1010
visCmdFileSave | 1004
visCmdFileSaveAs | 1005
visCmdFileSaveAsDrawing | 2306
visCmdFileSaveAsDrawingPreviousFileFormat | 2298
visCmdFileSaveAsDWG | 2305
visCmdFileSaveAsEMF | 2302
visCmdFileSaveAsJPG | 2301
visCmdFileSaveAsMacroDrawing | 2311
visCmdFileSaveAsPNG | 2300
visCmdFileSaveAsSVG | 2303
visCmdFileSaveAsTemplate | 2299
visCmdFileSaveAsWebPage | 1785
visCmdFileSaveWorkspace | 1006
visCmdFileSummaryInfoDlg | 1009
visCmdFileUndoCheckout | 2109
visCmdFirstTile | 1515
visCmdFitContainerToContents | 2195
visCmdFitCurve | 1538
visCmdFormatAllTextProps | 1642
visCmdFormatBehavior | 1071
visCmdFormatBlock | 1070
visCmdFormatCorners | 1334
visCmdFormatCustPropDef | 1687
visCmdFormatCustPropEdit | 1312
visCmdFormatDefineStyles | 1064
visCmdFormatDoubleClick | 1118
visCmdFormatFill | 1066
visCmdFormatInkDlg | 1955
visCmdFormatLine | 1065
visCmdFormatPainter | 1271
visCmdFormatParagraph | 1068
visCmdFormatPictureAutobalance | 2205
visCmdFormatPictureCompressionDlg | 2212
visCmdFormatProtection | 1072
visCmdFormatShadow | 1333
visCmdFormatSpecial | 1073
visCmdFormatStyle | 1063
visCmdFormatTabs | 1069
visCmdFormatText | 1067
visCmdFullScreenMode | 1492
visCmdGoToPageToolbar | 1635
visCmdGrid | 1767
visCmdGuides | 1771
visCmdHeaderFooter | 1720
visCmdHelpAboutVisio | 1100
visCmdHelpContents | 1092
visCmdHelpMode | 1386
visCmdHelpSearch | 1809
visCmdHelpShapeBasics | 1822
visCmdHelpTemplates | 1586
visCmdHideAllToolbars | 1726
visCmdHideDocumentStencil | 1689
visCmdHideMoreShapes | 2291
visCmdHyperlinkHier | 1611
visCmdHyperlinkList | 1719
visCmdIconBucketTool | 1543
visCmdIconLassoTool | 1544
visCmdIconLeftColor | 1143
visCmdIconPencilTool | 1145
visCmdIconRightTool | 1144
visCmdIconSelectNet | 1545
visCmdIgnoreValidationIssue | 2254
visCmdIgnoreValidationRule | 2256
visCmdImageProperties | 1887
visCmdImagePropertiesDlg | 1883
visCmdIncreaseIndent | 1094
visCmdIncreaseParaSpacing | 1096
visCmdINETAddToFavorites | 1506
visCmdINETCopyHyperlink | 1610
visCmdINETDeleteHlink | 1609
visCmdINETDiagrammingResources | 1606
visCmdINETEditHyperlink | 1619
visCmdINETGoBack | 1599
visCmdINETGoForward | 1598
visCmdINETKnowledgeBase | 1605
visCmdINETOpenHLink | 1607
visCmdINETOpenHLinkNewWnd | 1608
visCmdINETPasteAsHyperlink | 1620
visCmdINETUserSearchPage | 1595
visCmdINETVisioHomePage | 1596
visCmdINETVisioOnTheWeb | 1831
visCmdINETVisioSolutionsLibrary | 1604
visCmdInkEraser | 1970
visCmdInkReviewPen | 1971
visCmdInkStockPen0 | 1973
visCmdInkStockPen1 | 1974
visCmdInkTool | 1661
visCmdInsertAutoCADAddOn | 1521
visCmdInsertCheckBoxControl | 2150
visCmdInsertClipArt | 1497
visCmdInsertClipArtDlg | 2345
visCmdInsertComboBoxControl | 2152
visCmdInsertComment | 1501
visCmdInsertControlDlg | 1522
visCmdInsertDataMap | 1282
visCmdInserTextBoxControl | 2145
visCmdInsertHyperLink | 1585
visCmdInsertImageControl | 2148
visCmdInsertLabelControl | 2144
visCmdInsertLegendHorizontal | 2331
visCmdInsertLegendVertical1 | 2335
visCmdInsertListBoxControl | 2153
visCmdInsertMemberIntoList | 2174
visCmdInsertMicrosoftGraph | 1499
visCmdInsertNewBackgroundPage | 2165
visCmdInsertPageTab | 2202
visCmdInsertPushButtonControl | 2147
visCmdInsertRadioButtonControl | 2151
visCmdInsertScrollBarControl | 2149
visCmdInsertSpinControl | 2146
visCmdInsertTextBox | 2006
visCmdInsertToggleButtonControl | 2154
visCmdInsertVertTextBox | 2007
visCmdInsertWordArt | 1498
visCmdIntersect | 1453
visCmdJoin | 1533
visCmdLanguagePreferencesDlg | 2363
visCmdLast | 65535
visCmdLastTile | 1516
visCmdLayerDlg | 1446
visCmdLayerSetupDlg | 1448
visCmdLayoutDynamic | 1493
visCmdLinkRowToShape | 1997
visCmdListInsertAfter | 2271
visCmdListInsertBefore | 2270
visCmdLockContainer | 2220
visCmdMasterExplorer | 1916
visCmdMasterSetup | 1343
visCmdMDIMaximize | 1901
visCmdMDIMinimize | 1902
visCmdMDIRestore | 1903
visCmdMinimizeRibbonToggle | 2232
visCmdModConnectPt | 1264
visCmdModControlPt | 1267
visCmdMovConnectPt | 1269
visCmdMove1D | 1186
visCmdMove2D | 1187
visCmdMoveComment | 1502
visCmdMoveObject | 1185
visCmdMsoAutoCorrect | 1872
visCmdMsoAutoCorrectDlg | 1866
visCmdMsoAutoFormat | 1873
visCmdMsoCustomItem | 1896
visCmdMSOInsertEquation | 1646
visCmdMSOInsertSymbol | 1504
visCmdMSOInsertSymbolDlg | 1505
visCmdMsoMediaGallery | 1885
visCmdMultipleFileImport | 2201
visCmdNewDefDocBlankDrawing | 1906
visCmdNewForegroundPage | 2361
visCmdNewFromExisting | 1897
visCmdNewThemeColors | 2065
visCmdNewThemeEffects | 2064
visCmdNextCommentMarkup | 2180
visCmdNextMarkup | 1914
visCmdNextTile | 1514
visCmdNextWindow | 1886
visCmdObjectAddToGroup | 1053
visCmdObjectAlignObjects | 1049
visCmdObjectBringForward | 1045
visCmdObjectBringToFront | 1046
visCmdObjectCombine | 1061
visCmdObjectConnectObjects | 1050
visCmdObjectConvertToGroup | 1055
visCmdObjectDistributeDlg | 1230
visCmdObjectFlipHorizontal | 1058
visCmdObjectFlipVertical | 1057
visCmdObjectFragment | 1062
visCmdObjectGroup | 1051
visCmdObjectHelp | 1428
visCmdObjectInfoDlg | 1425
visCmdObjectRemoveFromGroup | 1054
visCmdObjectReverse | 1059
visCmdObjectRotate90 | 1056
visCmdObjectSendBackward | 1047
visCmdObjectSendToBack | 1048
visCmdObjectSwapEnds | 1870
visCmdObjectUngroup | 1052
visCmdObjectUnion | 1060
visCmdOfficeCenterOptions | 2141
visCmdOffsetDlg | 1387
visCmdOfficeDiagnostics | 1890
visCmdOpenActiveObject | 1601
visCmdOpenCommentForEdit | 1503
visCmdOpenInVisio | 1491
visCmdOptionsColorPaletteDlg | 1082
visCmdOptionsDeletePages | 1079
visCmdOptionsEditBackground | 1075
visCmdOptionsEditDrawing | 1074
visCmdOptionsGoToDrawing | 1077
visCmdOptionsNewPage | 1078
visCmdOptionsPageSetup | 1076
visCmdOptionsPreferences | 1081
visCmdOptionsProtectDocument | 1083
visCmdOptionsReorderPages | 1080
visCmdOptionsSnapGlueSetup | 1084
visCmdPageAutoSizeToggle | 2333
visCmdPageMeasureUnitsDlg | 1274
visCmdPageSizeDlg | 2176
visCmdPageSizeToFitDrawing | 2332
visCmdPagesList | 1654
visCmdPanObject | 1193
visCmdPanZoom | 1653
visCmdPasteShortcut | 1790
visCmdPasteToLocation | 2221
visCmdPauseRecordingMacro | 1778
visCmdPreviousCommentMarkup | 2179
visCmdPreviousMarkup | 1915
visCmdPreviousTile | 1513
visCmdPrintPage | 1443
visCmdPrintPreview | 1490
visCmdProgRefHelp | 1584
visCmdPublishToProcessRepository | 2294
visCmdPublishToVisioServices | 2293
visCmdRecalcObjectWH | 1146
visCmdRecordNewMacro | 1775
visCmdReinstateValidationIssue | 2255
visCmdRelayoutShapes | 2068
visCmdRemoveDataGraphicFromSel | 2107
visCmdRemoveFromAllContainers | 2252
visCmdRemoveMemberFromContainer | 2175
visCmdRemoveMemberFromList | 2346
visCmdRemoveThemeFromSel | 2119
visCmdRemoveVBAFromActiveDoc | 1590
visCmdReorderList | 2197
visCmdReplaceShape | 2051
visCmdRHI | 2009
visCmdRHIDlg | 2010
visCmdReOrderPage | 1795
visCmdResearchLookUp | 1967
visCmdResearchThesaurus | 2178
visCmdResearchTranslate | 1968
visCmdResumeRecordingMacro | 1779
visCmdReviewerVisibilityAll | 1836
visCmdReviewerVisibilityNone | 1919
visCmdRightDragCancel | 1881
visCmdRightDragCopy | 1879
visCmdRightDragLink | 1880
visCmdRightDragMove | 1878
visCmdRotate90Clockwise | 1494
visCmdRotateObject | 1190
visCmdRulerGridDlg | 1318
visCmdRulSub | 1766
visCmdRunAddOnDlg | 1484
visCmdRunAddonMenu | 1090
visCmdSaveAsFixedFormatDlg | 2117
visCmdSaveForAutoRecover | 1857
visCmdSelectContainerMembers | 2219
visCmdSelectionModeExtend | 1909
visCmdSelectionModeLasso | 1908
visCmdSelectionModeRect | 1907
visCmdSendAsMail | 1292
visCmdSetAddMarkup | 1744
visCmdSetCharColor | 1404
visCmdSetCharSizeDown | 1406
visCmdSetCharSizeUp | 1405
visCmdSetContainerProperties | 2181
visCmdSetDynConnAppearanceCurved | 1895
visCmdSetDynConnAppearanceDefault | 1893
visCmdSetDynConnAppearanceStraight | 1894
visCmdSetDynConnLineJumpStyle_2pt | 1713
visCmdSetDynConnLineJumpStyle_3pt | 1714
visCmdSetDynConnLineJumpStyle_4pt | 1715
visCmdSetDynConnLineJumpStyle_5pt | 1716
visCmdSetDynConnLineJumpStyle_6pt | 1717
visCmdSetDynConnLineJumpStyle_Arc | 1709
visCmdSetDynConnLineJumpStyle_Gap | 1710
visCmdSetDynConnLineJumpStyle_Page | 1708
visCmdSetDynConnLineJumpStyle_Square | 1711
visCmdSetDynConnLineJumpStyle_Triangle | 1712
visCmdSetDynConnRerouteAsNeeded | 1697
visCmdSetDynConnRerouteFreely | 1696
visCmdSetDynConnRerouteNever | 1698
visCmdSetDynConnRerouteOnCrossover | 1837
visCmdSetDynConnRoutingStyle | 1700
visCmdSetFillColor | 1385
visCmdSetFillPattern | 1399
visCmdSetFillShadow | 1379
visCmdSetHeaderFooter | 1858
visCmdSetIndexInStencil | 1871
visCmdSetLanguageDlg | 1888
visCmdSetLineColor | 1359
visCmdSetLineCornerStyle | 1358
visCmdSetLineEnds | 1357
visCmdSetLinePattern | 1356
visCmdSetLineWeight | 1355
visCmdSetPageLineJumpCode_D | 1703
visCmdSetPageLineJumpCode_Horz | 1705
visCmdSetPageLineJumpCode_Last | 1707
visCmdSetPageLineJumpCode_None | 1704
visCmdSetPageLineJumpCode_Vert | 1706
visCmdSetPageOrientation | 2170
visCmdSetPagePlow | 1699
visCmdSetPageSize | 2171
visCmdSetThemeBehavior | 2382
visCmdShapeActions | 1309
visCmdShapeComment | 1686
visCmdShapeCommentDelete | 1688
visCmdShapeCommentDlg | 1685
visCmdShapeExplorer | 1389
visCmdShapeGalleryAddOn | 1867
visCmdShapeGeo | 1769
visCmdShapeHand | 1772
visCmdShapeIntersect | 1830
visCmdShapeLayerToolbar | 1634
visCmdShapeSearchWindowToggle | 2344
visCmdShapeStudioAddOn | 1985
visCmdShapesWindow | 1669
visCmdShapeTransparency | 1875
visCmdShapeTransparencyDlg | 1874
visCmdShapeVert | 1773
visCmdShowIgnoredIssuesToggle | 2258
visCmdShowLineJumpsToggle | 2231
visCmdShowShapeSheetDocument | 2169
visCmdShowShapeSheetPage | 2168
visCmdShowShapeSheetShape | 2167
visCmdSize1D | 1188
visCmdSize2D | 1189
visCmdSizeObjects | 1925
visCmdSizePos | 1670
visCmdSizeTextBlock | 1194
visCmdSmartAlign | 2223
visCmdSmartAlignAndSpace | 2222
visCmdSmartSpace | 2224
visCmdSpaceShapesAvoidPageBreaksToggle | 2340
visCmdSpellingChange | 1889
visCmdSpellingOptionsDlg | 2042
visCmdSSWindowAddSection | 1384
visCmdSSWindowChangeRowType | 1383
visCmdSSWindowCollapse | 1250
visCmdSSWindowDeselect | 1253
visCmdSSWindowExpand | 1251
visCmdSSWindowPasteFunction | 1382
visCmdSSWindowPasteName | 1381
visCmdSSWindowSelect | 1252
visCmdSSWindowShowSection | 1380
visCmdSSWindowShowTraceWindow | 1781
visCmdStampTool | 1424
visCmdStartRecordingMacro | 1776
visCmdStenActivate | 1458
visCmdStenAutoArrange | 1483
visCmdStenCleanup | 1106
visCmdStenClose | 1452
visCmdStenDrawingExplorer | 1796
visCmdStenEditDrawing | 1102
visCmdStenEditIcon | 1101
visCmdStenEditOff | 1681
visCmdStenEditOn | 1680
visCmdStenEditToggle | 1679
visCmdStenIconAndDetail | 1892
visCmdStenIconAndName | 1480
visCmdStenIconOnly | 1481
visCmdStenImageMaster | 1105
visCmdStenNameMaster | 1103
visCmdStenNameOnly | 1482
visCmdStenNamesUnderIcons | 2005
visCmdStenNewMaster | 1104
visCmdStenProperties | 1678
visCmdStenSave | 1676
visCmdStenSaveAs | 1677
visCmdStopIgnoringValidationRule | 2257
visCmdStopRecordingMacro | 1777
visCmdSubtract | 1454
visCmdSWAccept | 1140
visCmdSWAddSectionDlg | 1116
visCmdSWCancel | 1139
visCmdSWChangeRowTypeDlg | 1114
visCmdSWDeleteRow | 1115
visCmdSWDeleteSection | 1117
visCmdSWExpandRow | 1718
visCmdSWFormula | 1141
visCmdSWInsertRow | 1112
visCmdSWInsertRowAfter | 1113
visCmdSWPasteFunctionDlg | 1111
visCmdSWPasteNameDlg | 1110
visCmdSWShapeActionDlg | 1444
visCmdSWShowFormulas | 1108
visCmdSWShowSectionsDlg | 1109
visCmdSWShowToggle | 1142
visCmdSWShowValues | 1107
visCmdTaskPane | 1896
visCmdTaskPaneDataGraphic | 2024
visCmdTaskPaneDocumentManagement | 1972
visCmdTaskPaneResearch | 1969
visCmdTaskPaneReviewer | 1939
visCmdTaskTogglePreviewSize | 2053
visCmdTextAllCaps | 1862
visCmdTextBlockTool | 1451
visCmdTextBold | 1131
visCmdTextDoubleStrikeThrough | 1951
visCmdTextDoubleULine | 1863
visCmdTextEditRuler | 1810
visCmdTextEditState | 1214
visCmdTextFont | 1129
visCmdTextHAlignCenter | 1408
visCmdTextHAlignDistribute | 1952
visCmdTextHAlignJustify | 1412
visCmdTextHAlignLeft | 1407
visCmdTextHAlignRight | 1409
visCmdTextItalic | 1132
visCmdTextRotate90 | 1098
visCmdTextSize | 1130
visCmdTextSmallCaps | 1133
visCmdTextStrikeThrough | 1741
visCmdTextStyle | 1128
visCmdTextSubscript | 1135
visCmdTextSuperScript | 1134
visCmdTextULine | 1136
visCmdTextVAlignBottom | 1422
visCmdTextVAlignMiddle | 1414
visCmdTextVAlignTop | 1413
visCmdToggleDocumentStencil | 1690
visCmdToolbarsDlg | 1500
visCmdToolsArrayShapesAddOn | 1354
visCmdToolsInventory | 1335
visCmdToolsLayoutShapesDlg | 1574
visCmdToolsMacroDlg | 1577
visCmdToolSnapLines | 1807
visCmdToolsRunVBE | 1576
visCmdToolsSpelling | 1270
visCmdTranslateOptions | 2352
visCmdTrim | 1534
visCmdTrustCenterDlg | 2104
visCmdTurnToNextPage | 1148
visCmdTurnToPrevPage | 1147
visCmdUFEditClear | 1023
visCmdUFEditCopy | 1021
visCmdUFEditCut | 1020
visCmdUFEditDuplicate | 1024
visCmdUFEditPaste | 1022
visCmdUFEditSelectAll | 1025
visCmdUpgradeThemeModel | 2384
visCmdUpdateColumnsInLinkedShapes | 2061
visCmdUpdateContentCache | 1241
visCmdValidateDiagram | 2253
visCmdValidationIssueNavigateToShape | 2236
visCmdValidationIssuesArrangeByCategory | 2279
visCmdValidationIssuesArrangeByIgnored | 2281
visCmdValidationIssuesArrangeByPage | 2280
visCmdValidationIssuesArrangeByRule | 2278
visCmdValidationIssuesArrangeOriginalOrder | 2282
visCmdValidationIssuesWindowToggle | 2263
visCmdView100 | 1035
visCmdView150 | 1036
visCmdView200 | 1037
visCmdView400 | 1280
visCmdView50 | 1279
visCmdView75 | 1034
visCmdViewConnections | 1042
visCmdViewCustom | 1038
visCmdViewDirectionToggle | 2012
visCmdViewFitInWindow | 1033
visCmdViewGrid | 1040
visCmdViewGuides | 1041
visCmdViewLeftToRight | 2013
visCmdViewPageBreaks | 1509
visCmdViewRightToLeft | 2014
visCmdViewRulers | 1039
visCmdViewStatusBar | 1044
visCmdWindowCascadeAll | 1086
visCmdWindowNewWindow | 1085
visCmdWindowShowDrawPage | 1091
visCmdWindowShowMasterObjects | 1089
visCmdWindowShowShapeSheet | 1088
visCmdWindowTileAll | 1087
visCmdZoomArea | 1218
visCmdZoomIn | 1216
visCmdZoomInIgnoreSel | 1917
visCmdZoomLast | 1495
visCmdZoomOut | 1217
visCmdZoomOutIgnoreSel | 1918
visCmdZoomPageWidth | 1496
visCmdZoomPt | 1215
visCmdZoomSingleTile | 1512


VisUICtrlTypes Enumeration (Visio)

 Copy code hover
[image]

VisUICtrlTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Constants that describe control types, used in conjuction with the CntrlType property of the Menu, MenuItem, and ToolbarItem objects.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constant | Value | Description
visCtrlTypeBUTTON_OWNERDRAW | 33 | Owner-draw push button.
visCtrlTypeBUTTON | 2 | Push button.
visCtrlTypeCOMBOBOX | 128 | Combo box.
visCtrlTypeDROPDOWN | 272 | Drop-down combo box.
visCtrlTypeEDITBOX | 64 | Text box.
visCtrlTypeLABEL | 2048 | Label.
visCtrlTypeSPLITBUTTON_MRU_COLOR | 16 | Split button, with MRU color behavior.
visCtrlTypeSPLITBUTTON_MRU_COMMAND | 18 | Split button, with MRU command behavior.
visCtrlTypeSPLITBUTTON | 17 | Split button.


VisUIIconIDs Enumeration (Visio)

 Copy code hover
[image]

VisUIIconIDs Enumeration (Visio)
Send feedback

Published: July 16, 2012

Icon identifiers used in conjunction with the FaceID property of the Menu, MenuItem, and ToolbarItem objects.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constant | Value
visIconIXACCEPT | 85
visIconIXADDIN | 149
visIconIXALIGNBOTTOM | 69
visIconIXALIGNBOX | 224
visIconIXALIGNCENTER | 65
visIconIXALIGNLEFT | 64
visIconIXALIGNMIDDLE | 68
visIconIXALIGNRIGHT | 66
visIconIXALIGNTOP | 67
visIconIXALIGN | 63
visIconIXARRANGE | 83
visIconIXBOLD | 50
visIconIXBRING_FORWARD | 245
visIconIXBRINGFRONT | 90
visIconIXBULLETS | 113
visIconIXCANCEL | 84
visIconIXCANTFIND | 129
visIconIXCASCADE | 94
visIconIXCHART | 134
visIconIXCHECKMARK | 128
visIconIXCLEAR | 9
visIconIXCLIPART | 130
visIconIXCLOSE | 143
visIconIXCONNECTIONPOINTS | 36
visIconIXCONNECTIONPTTOOL | 30
visIconIXCONNECTORTOOL | 96
visIconIXCONNECTSHAPES | 75
visIconIXCONNPOINTS | 229
visIconIXCOPY | 7
visIconIXCORNERSTYLE | 40
visIconIXCROP | 29
visIconIXCUSTOM_BALLOON | 162
visIconIXCUSTOM_BANK | 153
visIconIXCUSTOM_BELL | 159
visIconIXCUSTOM_BOX | 173
visIconIXCUSTOM_CALC | 164
visIconIXCUSTOM_CAMCORD | 163
visIconIXCUSTOM_CARDS | 169
visIconIXCUSTOM_CLUB | 168
visIconIXCUSTOM_DIAMOND | 166
visIconIXCUSTOM_DOWN | 178
visIconIXCUSTOM_EIGHTBALL | 191
visIconIXCUSTOM_EYE | 190
visIconIXCUSTOM_FEET | 174
visIconIXCUSTOM_FISH | 182
visIconIXCUSTOM_FROWN | 152
visIconIXCUSTOM_GEARS | 184
visIconIXCUSTOM_HEART | 165
visIconIXCUSTOM_HOURGLASS | 186
visIconIXCUSTOM_KEYBOARD | 180
visIconIXCUSTOM_KEY | 183
visIconIXCUSTOM_LEFT | 175
visIconIXCUSTOM_LOAD | 155
visIconIXCUSTOM_MAN | 187
visIconIXCUSTOM_MIC | 157
visIconIXCUSTOM_MUG | 170
visIconIXCUSTOM_NOTE | 160
visIconIXCUSTOM_PAGES | 181
visIconIXCUSTOM_PASTE | 154
visIconIXCUSTOM_PENCIL | 172
visIconIXCUSTOM_PHONE | 161
visIconIXCUSTOM_QUESTION | 192
visIconIXCUSTOM_RIGHT | 176
visIconIXCUSTOM_RUN | 189
visIconIXCUSTOM_SAVE | 156
visIconIXCUSTOM_SCALES | 185
visIconIXCUSTOM_SMILE | 151
visIconIXCUSTOM_SPADE | 167
visIconIXCUSTOM_SPEAKER | 158
visIconIXCUSTOM_TACK | 179
visIconIXCUSTOM_TRASH | 171
visIconIXCUSTOM_UP | 177
visIconIXCUSTOM_WOMAN | 188
visIconIXCUSTOMPROP_WINDOW | 215
visIconIXCUSTPROP | 111
visIconIXCUT | 6
visIconIXDCREROUTE_ASNEEDED | 214
visIconIXDCREROUTE_FREELY | 213
visIconIXDCREROUTE_NEVER | 235
visIconIXDCREROUTE | 236
visIconIXDECRINDENT | 114
visIconIXDECRPARA | 116
visIconIXDELETECOMMENT | 195
visIconIXDELETE | 196
visIconIXDESIGNMODE | 119
visIconIXDHORZ_CENTER | 72
visIconIXDHORZ_EQSPACE | 71
visIconIXDISTRIBUTE | 70
visIconIXDOUBLE_UNDERLINE | 253
visIconIXDRAWINGEXPLORER | 219
visIconIXDVERT_EQSPACE | 73
visIconIXDVERT_MIDDLE | 74
visIconIXDYNGRID | 221
visIconIXEDITCOMMENT | 194
visIconIXEDITSTEN | 197
visIconIXEXCHANGEFOLDER | 137
visIconIXFILLCOLOR | 43
visIconIXFILLPATTERN | 47
visIconIXFIND | 138
visIconIXFIRSTPAGE | 76
visIconIXFLIPHORIZONTAL | 18
visIconIXFLIPVERTICAL | 19
visIconIXFOLDER | 144
visIconIXFORMATPAINTER | 101
visIconIXFULLSCREEN | 124
visIconIXGLUE | 32
visIconIXGOBACK | 107
visIconIXGOFORWARD | 108
visIconIXGRID | 34
visIconIXGROUP | 92
visIconIXGUIDES | 226
visIconIXGUIDE | 35
visIconIXHELPASSISTANT | 133
visIconIXHELPBOOK | 125
visIconIXHELPMODE | 102
visIconIXICONBUCKET | 87
visIconIXICONLASSO | 88
visIconIXICONNAME | 80
visIconIXICONONLY | 81
visIconIXICONPENCIL | 86
visIconIXICONSELNET | 89
visIconIXIMAGE | 131
visIconIXINCRINDENT | 115
visIconIXINCRPARA | 117
visIconIXINSERT_EQUATION | 250
visIconIXINSERT_OBJECT | 248
visIconIXINSERTCOMMENT | 193
visIconIXINSERTCONTROL | 118
visIconIXINSERTHYPERLINK | 105
visIconIXITALIC | 51
visIconIXLARGE_PADLOCK | 249
visIconIXLASTPAGE | 77
visIconIXLAYERPROPERTIES | 103
visIconIXLAYOUTSHAPES | 104
visIconIXLINECOLOR | 44
visIconIXLINEEND | 41
visIconIXLINEJUMPSTYLE_2PT | 208
visIconIXLINEJUMPSTYLE_3PT | 209
visIconIXLINEJUMPSTYLE_4PT | 210
visIconIXLINEJUMPSTYLE_5PT | 211
visIconIXLINEJUMPSTYLE_6PT | 212
visIconIXLINEJUMPSTYLE_ARC | 204
visIconIXLINEJUMPSTYLE_GAP | 205
visIconIXLINEJUMPSTYLE_PAGE | 218
visIconIXLINEJUMPSTYLE_SQUARE | 206
visIconIXLINEJUMPSTYLE_TRIANGLE | 207
visIconIXLINEPATTERN | 46
visIconIXLINETOOL | 22
visIconIXLINEWEIGHT | 45
visIconIXMACROS | 121
visIconIXMAILRECPT | 135
visIconIXMAXIMIZE | 142
visIconIXMINIMIZE | 141
visIconIXNAMEONLY | 82
visIconIXNEWSTEN | 198
visIconIXNEWWINDOW | 39
visIconIXNEW | 0
visIconIXNEXTPAGE | 14
visIconIXOPENSTENCIL | 2
visIconIXOPEN | 1
visIconIXOVALTOOL | 25
visIconIXPAGEBREAKS | 78
visIconIXPAGELINEJUMPCODE_DISP | 217
visIconIXPAGELINEJUMPCODE_HORZ | 201
visIconIXPAGELINEJUMPCODE_LASTROUTED | 203
visIconIXPAGELINEJUMPCODE_NONE | 200
visIconIXPAGELINEJUMPCODE_RDISP | 231
visIconIXPAGELINEJUMPCODE_VERT | 202
visIconIXPAGEPLOW | 216
visIconIXPANZOOM | 139
visIconIXPASTE | 8
visIconIXPENCILTOOL | 21
visIconIXPOINTERTOOL | 20
visIconIXPOINTSIZEDOWN | 48
visIconIXPOINTSIZEUP | 49
visIconIXPREVIOUSPAGE | 13
visIconIXPRINTPREVIEW | 5
visIconIXPRINT | 4
visIconIXQTRARCTOOL | 23
visIconIXRECTANGLETOOL | 24
visIconIXREDO | 11
visIconIXREPEAT | 12
visIconIXREPLACE | 252
visIconIXRESTORE | 140
visIconIXROTATECLOCKWISE | 37
visIconIXROTATECOUNTERCLOCKWISE | 38
visIconIXROTATETEXT | 112
visIconIXROTATETOOL | 28
visIconIXROUTINGRECPT | 136
visIconIXRULER | 33
visIconIXRULSUB | 222
visIconIXSAVE | 3
visIconIXSEARCHTHEWEB | 106
visIconIXSEND_BACKWARD | 246
visIconIXSENDBACK | 91
visIconIXSHADOWSTYLE | 42
visIconIXSHAPE_INTERSECT | 220
visIconIXSHAPEEXPLORER | 126
visIconIXSHAPEEXPL | 110
visIconIXSHAPEEXT | 230
visIconIXSHAPEGEO | 225
visIconIXSHAPEHAND | 227
visIconIXSHAPESHEET | 120
visIconIXSHAPEVERT | 228
visIconIXSHOWDOCSTEN | 199
visIconIXSINGLETILE | 99
visIconIXSIZEPOS | 150
visIconIXSMALL_PADLOCK | 247
visIconIXSMALLCAPS | 234
visIconIXSNAP_LINES | 232
visIconIXSNAPTOGRID | 223
visIconIXSNAP | 31
visIconIXSPELLING | 100
visIconIXSPLINETOOL | 79
visIconIXSTAMPTOOL | 26
visIconIXSTRIKETHROUGH | 233
visIconIXSTYLE | 251
visIconIXSUBSCRIPT | 54
visIconIXSUPERSCRIPT | 53
visIconIXTEXTALIGNBOTTOM | 62
visIconIXTEXTALIGNCENTER | 57
visIconIXTEXTALIGNJUSTIFY | 59
visIconIXTEXTALIGNLEFT | 56
visIconIXTEXTALIGNMIDDLE | 61
visIconIXTEXTALIGNRIGHT | 58
visIconIXTEXTALIGNTOP | 60
visIconIXTEXTBLOCKTOOL | 97
visIconIXTEXTCOLOR | 55
visIconIXTEXTOOL | 27
visIconIXTILE | 95
visIconIXUNDERLINE | 52
visIconIXUNDO | 10
visIconIXUNGROUP | 93
visIconIXVBAMACRO | 148
visIconIXVBEDITOR | 122
visIconIXVERTICALTEXT | 123
visIconIXVSD | 145
visIconIXVSS | 146
visIconIXVST | 147
visIconIXWEBPAGE | 127
visIconIXWEBTOOLBAR | 109
visIconIXWHOLEPAGE | 98
visIconIXWORDART | 132
visIconIXZOOM100 | 17
visIconIXZOOMIN | 16
visIconIXZOOMOUT | 15


VisUIMenuAnimation Enumeration (Visio)

 Copy code hover
[image]

VisUIMenuAnimation Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values used in conjunction with the UIObject.MenuAnimationStyle property.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constant | Value | Description
visMenuAnimationNone | 0 | Animations appear immediately.
visMenuAnimationRandom | 1 | Animations unfold or slide randomly.
visMenuAnimationSlide | 3 | Animations appear to slide into view from above.
visMenuAnimationUnfold | 2 | Animations appear to expand from a point in the upper-left corner of the animation.


VisUIObjSets Enumeration (Visio)

 Copy code hover
[image]

VisUIObjSets Enumeration (Visio)
Send feedback

Published: July 16, 2012

UI object-set identifiers, used with the SetID and ItemAtID properties and the AddAtID method of the AccelTable, MenuSet, and ToolbarSet collections. Valid identifiers for particular collections are indicated.

Note Note

Starting with Microsoft Visio 2010, the Microsoft Office Fluent user interface (UI) replaces the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio 2013, but they function differently.

Constant | Value | Description | AccelTable | MenuSet | ToolbarSet
visUIObjSetActiveXDoc | 18 | Visio is running as an ActiveX document. | X |  |
visUIObjSetCntx_AddComments | 1000 | Built-in commands available in the Customize dialog box |  | X |
visUIObjSetCntx_AnchorBar_Base | 61 | Shortcut menu: anchored windows. |  | X |
visUIObjSetCntx_AnchorBar_CustProp | 62 | Shortcut menu: Shape Data anchored window. |  | X |
visUIObjSetCntx_AnchorBar_Shapes | 69 | Shortcut menu: Shapes window. |  |  |
visUIObjSetCntx_AnchorBar_SizePos | 63 | Shortcut menu: Size & Position anchored window. |  | X |
visUIObjSetCntx_BuiltInMenus | 1010 | Built-in menus available in the Customize dialog box. |  | X |
visUIObjSetCntx_CommentMarker | 68 | Shortcut menu: Comment Marker. |  | X |
visUIObjSetCntx_ConnectPtType | 44 | Shortcut menu: Connection Point. |  | X |
visUIObjSetCntx_DEDocument | 49 | Shortcut menu: Drawing Explorer, root item. |  | X |
visUIObjSetCntx_DELayers | 54 | Shortcut menu: Drawing Explorer, Layers folder. |  | X |
visUIObjSetCntx_DELayer | 55 | Shortcut menu: Drawing Explorer, Layer item. |  | X |
visUIObjSetCntx_DEMasters | 58 | Shortcut menu: Drawing Explorer, Masters folder. |  | X |
visUIObjSetCntx_DEMaster | 59 | Shortcut menu: Drawing Explorer, item. |  | X |
visUIObjSetCntx_DEPages | 50 | Shortcut menu: Drawing Explorer, Pages folder. |  | X |
visUIObjSetCntx_DEPage | 51 | Shortcut menu: Drawing Explorer, item. |  | X |
visUIObjSetCntx_DEPatterns | 60 | Shortcut menu: Drawing Explorer, Patterns folder. |  | X |
visUIObjSetCntx_DEShapes | 52 | Shortcut menu: Drawing Explorer, Shapes folder. |  | X |
visUIObjSetCntx_DEShape | 53 | Shortcut menu: Drawing Explorer, item. |  | X |
visUIObjSetCntx_DEStyles | 56 | Shortcut menu: Drawing Explorer, Styles folder. |  | X |
visUIObjSetCntx_DEStyle | 57 | Shortcut menu: Drawing Explorer, Style item. |  | X |
visUIObjSetCntx_DrawObjSel | 9 | Shortcut menu: Visio drawing shape. |  | X |
visUIObjSetCntx_DrawOleObjSel | 10 | Shortcut menu: foreign drawing shape. |  | X |
visUIObjSetCntx_Fullscreen | 17 | Shortcut menu: Full Screen mode. |  | X |
visUIObjSetCntx_Issues | 76 | Issues window. |  |  |
visUIObjSetCntx_Master | 14 | Shortcut menu: Master. |  | X |
visUIObjSetCntx_MEDocument | 66 | Shortcut menu: Master Explorer, root item |  | X |
visUIObjSetCntx_MEMasters | 67 | Shortcut menu: Master Explorer, Masters folder |  | X |
visUIObjSetCntx_Page | 75 | Page in drawing window, no shape selected. |  |  |
visUIObjSetCntx_PageTabNavigation | 74 | Page tab navigation. |  |  |
visUIObjSetCntx_PageTabs | 47 | Shortcut menu: Page tab |  | X |
visUIObjSetCntx_ShapeSheet | 15 | Shortcut menu: Shape window. |  | X |
visUIObjSetCntx_Stencil | 21 | Shortcut menu: Stencil window. |  | X |
visUIObjSetCntx_TextEdit | 13 | Shortcut menu: editing shape text. |  | X |
visUIObjSetDrawing | 2 | Drawing window is active or no documents are open. | X | X | X
visUIObjSetHostingInPlace | 22 | An object is active in Visio. | X |  |
visUIObjSetIcon | 5 | Icon editing window is active. | X | X | X
visUIObjSetInPlace | 6 | Use for accelerators only when Visio is running in place. | X |  |
visUIObjSetPal_AlignShapes | 30 | Toolbar palette: Align Shapes |  |  | X
visUIObjSetPal_ConnectorTool | 40 | Toolbar palette: Connector, Connection Point, and Stamp drawing tools |  |  | X
visUIObjSetPal_CornerRounding | 34 | Toolbar palette: Corner Rounding |  |  | X
visUIObjSetPal_DistributeShapes | 31 | Toolbar palette: Distribute Shapes |  |  | X
visUIObjSetPal_FillColors | 27 | Toolbar palette: Fill Color |  |  | X
visUIObjSetPal_FillPatterns | 28 | Toolbar palette: Fill Pattern |  |  | X
visUIObjSetPal_LineColors | 24 | Toolbar palette: Line Color |  |  | X
visUIObjSetPal_LineEnds | 33 | Toolbar palette: Line Ends |  |  | X
visUIObjSetPal_LinePatterns | 26 | Toolbar palette: Line Pattern |  |  | X
visUIObjSetPal_LineTool | 42 | Toolbar palette: Line, Arc, Pencil, and Freeform drawing tool |  |  | X
visUIObjSetPal_LineWeights | 25 | Toolbar palette: Line Weight |  |  | X
visUIObjSetPal_Rectangle_Tool | 37 | Toolbar palette: Rectangle and Ellipse drawing tools |  |  | X
visUIObjSetPal_RotationTool | 43 | Toolbar palette: Rotation and Crop tools |  |  | X
visUIObjSetPal_Shadow | 32 | Toolbar palette: Shadow Color |  |  | X
visUIObjSetPal_TextColors | 29 | Toolbar palette: Text Color |  |  | X
visUIObjSetPal_TextTool | 41 | Toolbar palette: Text and Text Block drawing tools |  |  | X
visUIObjSetPopup_LineJumpCode | 38 | Toolbar palette: Add line jumps to |  |  | X
visUIObjSetPopup_LineJumpStyle | 39 | Toolbar palette: Line Jump Style |  |  | X
visUIObjSetPrintPreview | 7 | Visio is in Print Preview mode. | X | X | X
visUIObjSetShapeSheet | 4 | ShapeSheet window is active. | X | X | X
visUIObjSetStencil | 3 | Stencil window is active. | X | X | X


VisUniqueIDArgs Enumeration (Visio)

 Copy code hover
[image]

VisUniqueIDArgs Enumeration (Visio)
Send feedback

Published: July 16, 2012

Action codes to be passed to the Shape.UniqueID property.

Constant | Value | Description
visDeleteGUID | 2 | Clear the unique ID of a shape and return a zero-length string ("").
visDeleteGUIDWithUndo | 4 | Clear the unique ID of a shape and return a zero-length string (""). Undoable.
visGetGUID | 0 | Return the unique ID string only if the shape already has a unique ID.
visGetOrMakeGUID | 1 | Return the unique ID string of the shape. If the shape does not already have a unique ID, assign one to the shape and return the new ID.
visGetOrMakeGUIDWithUndo | 3 | Return the unique ID string of the shape. If the shape does not already have a unique ID, assign one to the shape and return the new ID. Undoable.


VisUnitCodes Enumeration (Visio)

 Copy code hover
[image]

VisUnitCodes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Unit codes used in conjunction with Cell.Result and similar properties.

Constant | Value | Description
visAcre | 36 | Acre
visAngleUnits | 80 | Angle units
visCentimeters | 69 | Centimeters
visCicerosAndDidots | 52 | Ciceros and didots
visCiceros | 54 | Ciceros
visCurrency | 111 | Currency
visDate | 40 | Date
visDegreeMinSec | 82 | Degrees, minutes, and seconds
visDegrees | 81 | Degrees
visDidots | 53 | Didots
visDrawingUnits | 64 | Drawing units
visDurationUnits | 42 | Duration
visElapsedDay | 44 | Elapsed days
visElapsedHour | 45 | Elapsed hours
visElapsedMin | 46 | Elapsed minutes
visElapsedSec | 47 | Elapsed seconds
visElapsedWeek | 43 | Elapsed weeks
visFeetAndInches | 67 | Feet and inches
visFeet | 66 | Feet
visHectare | 37 | Hectares
visInches | 65 | Inches
visInchFrac | 73 | Fractions of inches
visKilometers | 72 | Kilometers
visMeters | 71 | Meters
visMileFrac | 74 | Fractions of miles
visMiles | 68 | Miles
visMillimeters | 70 | Millimeters
visMin | 84 | Minutes
visNautMiles | 76 | Nautical miles
visNoCast | 252 | No unit conversion
visNumber | 32 | Number
visPageUnits | 63 | Page units
visPercent | 33 | Percent
visPicasAndPoints | 49 | Picas and points
visPicas | 51 | Picas
visPoints | 50 | Points
visRadians | 83 | Radians
visSec | 85 | Seconds
visTypeUnits | 48 | Type units
visUnitsColor | 251 | Color units
visUnitsGUID | 95 | GUID units
visUnitsInval | 255 | Invalid units
visUnitsNURBS | 138 | NURBS units
visUnitsPoint | 225 | Point units
visUnitsPolyline | 139 | Polyline units
visUnitsString | 231 | String units
visYards | 75 | Yards


VisValidationFlags Enumeration (Visio)

 Copy code hover
[image]

VisValidationFlags Enumeration (Visio)
Send feedback

Published: July 16, 2012

Specifies constants that define special validation behaviors; passed to the Validation.Validate method.

Version Information

Version Added: Visio 2010

Name | Value | Description
visValidationDefault | 0 | Validate document, and if validation issues are found, open the Issues window.
visValidationNoOpenWindow | 1 | Validate document, but do not open the Issues window.


VisVerticalAlignTypes Enumeration (Visio)

 Copy code hover
[image]

VisVerticalAlignTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Vertical alignment type values to pass to the Selection.Align method.

Constant | Value | Description
visVertAlignBottom | 3 | Align to bottom of primary selected shape.
visVertAlignMiddle | 2 | Align to middle of primary selected shape.
visVertAlignNone | 0 | No vertical alignment.
visVertAlignTop | 1 | Align to top of primary selected shape.


VisWindowArrange Enumeration (Visio)

 Copy code hover
[image]

VisWindowArrange Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values to pass to the Windows.Arrange method.

Constant | Value | Description
visArrangeCascade | 3 | Cascade the windows.
visArrangeTileHorizontal | 2 | Tile the windows horizontally.
visArrangeTileVertical | 1 | Tile the windows vertically.


VisWindowFit Enumeration (Visio)

 Copy code hover
[image]

VisWindowFit Enumeration (Visio)
Send feedback

Published: July 16, 2012

Values returned by the Window.ViewFit property.

Constant | Value | Description
visFitNone | 0 | No auto-fit.
visFitPage | 1 | Fit whole page.
visFitWidth | 2 | Fit to page width.


VisWindowScrollX Enumeration (Visio)

 Copy code hover
[image]

VisWindowScrollX Enumeration (Visio)
Send feedback

Published: July 16, 2012

X parameters to pass to the Window.Scroll method.

Constant | Value | Description
visScrollLeftPage | 2 | Scroll horizontally so that the left edge of the drawing page is centered in the window.
visScrollLeft | 0 | Scroll horizontally to the left the same distance as clicking the left scroll button.
visScrollNoneX | 9 | Do not scroll horizontally.
visScrollRightPage | 3 | Scroll horizontally so that the right edge of the drawing page is centered in the window.
visScrollRight | 1 | Scroll horizontally to the right the same distance as clicking the right scroll button.
visScrollToLeft | 6 | Scroll so that the upper left corner of the drawing page is centered in the window.
visScrollToRight | 7 | Scroll so that the lower right corner of the drawing page is centered in the window.


VisWindowScrollY Enumeration (Visio)

 Copy code hover
[image]

VisWindowScrollY Enumeration (Visio)
Send feedback

Published: July 16, 2012

Y parameters to pass to the Window.Scroll method.

Constant | Value | Description
visScrollDownPage | 3 | Scroll vertically so that the upper edge of the drawing page is centered in the window.
visScrollDown | 1 | Scroll vertically down the same distance as clicking the down scroll button.
visScrollNoneY | 9 | Do not scroll vertically.
visScrollToBottom | 7 | Scroll so that the lower right corner of the drawing page is centered in the window.
visScrollToTop | 6 | Scroll so that the upper left corner of the drawing page is centered in the window.
visScrollUpPage | 2 | Scroll vertically so that the lower edge of the drawing page is centered in the window.
visScrollUp | 0 | Scroll vertically up the same distance as clicking the up scroll button.


VisWindowStates Enumeration (Visio)

 Copy code hover
[image]

VisWindowStates Enumeration (Visio)
Send feedback

Published: July 16, 2012

Window-state codes passed to and returned by the Window.WindowState property.

Constant | Value | Description
visWSActive | &H4000000 | Active window.
visWSAnchorAutoHide | &H200 | Anchor window with AutoHide on.
visWSAnchorBottom | &H100 | Window is anchored at the bottom.
visWSAnchorLeft | &H20 | Window is anchored at the left.
visWSAnchorMerged | &H400 | Window is merged.
visWSAnchorRight | &H80 | Window is anchored at the right.
visWSAnchorTop | &H40 | Window is anchored at the top.
visWSDockedBottom | &H8 | Window is docked at the bottom. Not used for the Shapes window in Visio 2013
visWSDockedLeft | &H1 | Window is docked at the left.
visWSDockedRight | &H2 | Window is docked at the right.
visWSDockedTop | &H10 | Window is docked at the top. Not used for the Shapes window in Visio 2013.
visWSFloating | &H40000000 | Window is floating.
visWSMaximized |  | Window is maximized.
visWSMinimized | &H20000000 | Window is minimized.
visWSNone | &H0 | No window state.
visWSRestored | &H10000000 | Window is restored.
visWSVisible | &H8000000 | Window is visible.


VisWinTypes Enumeration (Visio)

 Copy code hover
[image]

VisWinTypes Enumeration (Visio)
Send feedback

Published: July 16, 2012

Type and ID codes returned by Window.Type, Window.SubType, and Window.ID.

Constant | Value | Description
visAnchorBarAddon | 10 | Window created by an add-on that has tabs at the bottom when merged (floating, anchored, or docked window)
visAnchorBarBuiltIn | 6 | Visio built-in window that has tabs at the bottom when merged—presently, the Custom Properties, Size & Position, Drawing Explorer, Master Explorer, Pan & Zoom and Validation Issues windows (floating, anchored, or docked windows).
visApplication | 5 | Microsoft Visio application window.
visDockedStencilAddon | 11 | An add-on window that has docked stencil behavior.
visDockedStencilBuiltIn | 7 | Stencil window docked in a drawing window.
visDrawing | 1 | Drawing window (MDI frame window).
visDrawingAddon | 8 | Drawing window created by an add-on (MDI frame window).
visIcon | 4 | Icon editing window (MDI frame window).
visInvalWinID | -1 | Window has no ID.
visMasterGroupWin | 96 | A group editing window of a group in a master.
visMasterWin | 64 | A master drawing page window.
visPageGroupWin | 160 | A group editing window of a group on a page.
visPageWin | 128 | A drawing window showing a page.
visSheet | 3 | ShapeSheet window (MDI frame window).
 | 2 | Stencil window (MDI frame window).
visStencil | 9 | Add-on window that has stencil window behavior.
visStencilAddon | 1658 | When Window.Type is visAnchorBarBuiltIn, Custom Properties window.
visWinIDCustProp | 1721 | When Window.Type is visAnchorBarBuiltIn, Drawing Explorer window.
visWinIDDrawingExplorer | 2044 | When Window.Type is visAnchorBarBuiltIn, External Data window.
visWinIDExternalData | 1781 | When Window.Type is visAnchorBarBuiltIn, ShapeSheet Formula Tracing window.
visWinIDFormulaTracing | 1916 | When Window.Type is visAnchorBarBuiltIn, Master Explorer window in master editing window.
visWinIDMasterExplorer | 1653 | When Window.Type is visAnchorBarBuiltIn, Pan & Zoom window.
visWinIDPanZoom | 1669 | When Window.Type is visAnchorBarBuiltIn, Shapes window.
visWinIDSizePos | 1670 | When Window.Type is visAnchorBarBuiltIn, Size & Position window.
visWinIDStencilExplorer | 1796 | When Window.Type is visAnchorBarBuiltIn, Drawing Explorer window in MDI stencil window.
visWinIDValidationIssues | 2263 | When Window.Type is visAnchorBarBuiltIn, Validation Issues window.
visWinOther | 0 | Unknown window type.


VisZoomBehavior Enumeration (Visio)

 Copy code hover
[image]

VisZoomBehavior Enumeration (Visio)
Send feedback

Published: July 16, 2012

Flags used in conjunction with the Application.DefaultZoomBehavior, Document.ZoomBehavior, and Window.ZoomBehavior properties.

Constant | Value | Description
visZoomInPlaceContainer | 1 | The container performs the zoom.
visZoomNone | 0 | Undefined zoom behavior; use the zoom behavior of the document or application.
visZoomVisio | 2 | Microsoft Visio performs the zoom. The default.
visZoomVisioExact | 4 | Visio zooms when open in place; Visio does not adjust the zoom level.


Welcome to the Visio 2013 ShapeSheet reference

 Copy code hover
[image]

Welcome to the Visio 2013 ShapeSheet reference
Send feedback

This reference contains conceptual overviews, programming tasks, samples, and references to guide you in developing solutions based on Visio 2013.

We welcome your comments or questions about this content. You can send feedback to docthis@microsoft.com.

Initial publication: July 2012 | Updated: October 2012

This documentation contains the following sections:

  • What's New: Provides a list of new members by object and in alphabetical order.

  • Concepts: Provides important concepts for developing custom Visio ShapeSheet solutions.

  • Common Tasks: Provides some short procedures for the most common ShapeSheet tasks.

  • Reference: Provides reference materials for the Visio ShapeSheet functions, cells, rows, and sections.

Additional resources

  • Visio Developer Center

  • Accessibility in Microsoft Products

  • Document Conventions

  • Microsoft Visio 2013 SDK Copyright Notice

  • Microsoft Online Privacy Notice


What's new for ShapeSheet developers in Visio 2013

 Copy code hover
[image]

What's new for ShapeSheet developers in Visio 2013
Send feedback

Published: July 16, 2012

Conceptual overview topic

Visio 2013 provides a powerful single platform for your custom drawing solutions. New ShapeSheet cells and functions, along with new Automation objects, properties, methods, and events, give you more options to define and control the behavior of the elements in your solutions.

In this article
New and changed cells
New rows
New and deprecated functions
Additional resources

New and changed cells

The following table lists the new cells that you can use to build ShapeSheet solutions in Visio 2013.

New cell | Section
BevelBottomHeight | Bevel Properties
BevelBottomType | Bevel Properties
BevelBottomWidth | Bevel Properties
BevelContourColor | Bevel Properties
BevelContourSize | Bevel Properties
BevelDepthColor | Bevel Properties
BevelDepthSize | Bevel Properties
BevelLightingAngle | Bevel Properties
BevelLightingType | Bevel Properties
BevelMaterialType | Bevel Properties
BevelTopHeight | Bevel Properties
BevelTopType | Bevel Properties
BevelTopWidth | Bevel Properties
ClippingPath | Foreign Image Info
ColorSchemeIndex | Theme Properties
CompoundType | Line Format
ConnectorSchemeIndex | Theme Properties
DistanceFromGround | 3-D Rotation Properties
DocLockReplace | Document Properties
EffectSchemeIndex | Theme Properties
FillGradientAngle | Gradient Properties
FillGradientDir | Gradient Properties
FillGradientEnabled | Gradient Properties
FontSchemeIndex | Theme Properties
GlowColor | Additional Effect Properties
GlowColorTrans | Additional Effect Properties
GlowSize | Additional Effect Properties
KeepTextFlat | 3-D Rotation Properties
LineGradientAngle | Gradient Properties
LineGradientDir | Gradient Properties
LineGradientEnabled | Gradient Properties
LockReplace | Protection
LockThemeConnectors | Protection
LockThemeFonts | Protection
LockThemeIndex | Protection
NoCoauth | Document Properties
PageLockReplace | Page Properties
Perspective | 3-D Rotation Properties
QuickStyleEffectsMatrix | Quick Style
QuickStyleFillColor | Quick Style
QuickStyleFillMatrix | Quick Style
QuickStyleFontColor | Quick Style
QuickStyleLineColor | Quick Style
QuickStyleLineMatrix | Quick Style
QuickStyleShadowColor | Quick Style
QuickStyleType | Quick Style
ReflectionBlur | Additional Effect Properties
ReflectionDist | Additional Effect Properties
ReflectionSize | Additional Effect Properties
ReflectionTrans | Additional Effect Properties
ReplaceCopyCells | Change Shape Behavior
ReplaceLockFormat | Change Shape Behavior
ReplaceLockShapeData | Change Shape Behavior
ReplaceLockText | Change Shape Behavior
RotateGradientWithShape | Gradient Properties
RotationType | 3-D Rotation Properties
RotationXAngle | 3-D Rotation Properties
RotationYAngle | 3-D Rotation Properties
RotationZAngle | 3-D Rotation Properties
ShapeShdwBlur | Fill Format
ShapeShdwShow | Fill Format
SketchAmount | Additional Effect Properties
SketchEnabled | Additional Effect Properties
SketchFillChange | Additional Effect Properties
SketchLineChange | Additional Effect Properties
SketchLineWeight | Additional Effect Properties
SketchSeed | Additional Effect Properties
SoftEdgesSize | Additional Effect Properties
ThemeIndex | Theme Properties
UseGroupGradient | Gradient Properties

The following table lists the cells that have been changed in Visio 2013.

Changed cell | Notes
ShdwType | New value and Automation constant

New rows

The following table lists the new rows that you can use to build ShapeSheet solutions in Visio 2013.

New row | Section
GradientStop | Fill Gradient
GradientStop | Line Gradient
RelCubBezTo | Geometry
RelEllipticalArcTo | Geometry
RelLineTo | Geometry
RelMoveTo | Geometry
RelQuadBezTo | Geometry

New and deprecated functions

The following table lists the new functions in Visio 2013.

New function

FONT

ISTHEMED

LANGUAGE

THEMECBV

THEMEPROP

THEMEVAL

The following table lists the deprecated functions in Visio 2013.

Deprecated function | Notes
CELLISTHEMED | Replaced by ISTHEMED function.

Additional resources

For a list of new Automation objects, properties, methods, events, and interfaces, see the Visio 2013 Automation reference.

For the latest information about developing with Visio, including product news, technical articles, downloads, samples, and the Visio SDK, see the MSDN Visio Developer Center.


Concepts (Visio 2013 ShapeSheet)

 Copy code hover
[image]

Concepts (Visio 2013 ShapeSheet)
Send feedback

This navigation page contains links to overview topics about programmability in Visio. Click the links below or use the table of contents to navigate to the following topics:

  • About Cell References

  • About Currency Constants

  • About Date, Time, and Duration Values

  • About Error Values

  • About Format Pictures

  • About Formulas

  • About Functions

  • About Operators

  • About Security Settings and Running Code in Visio

  • About Strings

  • About the Formula Tracing Window

  • About the ShapeSheet Spreadsheet

  • About the Style Explorer Window

  • About Units of Measure


About Cell References

 Copy code hover
[image]

About Cell References
Send feedback

You can create interdependencies among formulas by means of ShapeSheet cell references. Cell references give you the power to calculate a value for one cell based on another cell's value. For example, a shape's Width cell might contain a formula that calculates the shape's width by referring to the value of its Height cell, so that when a user resizes the shape vertically, its width stays in proportion.

In a cell's formula, you can refer to a cell of the same shape or another object, such as a document or page, so that Microsoft Visio calculates a value for one cell based on another cell's value.

What cell references can include

Cell references can include shape identifiers (IDs) or names. You can always refer to any shape on the page by its ID, whether the shape is named or not. If a shape hasn't been named, its default name is Sheet.i, where i is the shape ID. The ID is assigned when the shape is created and does not change unless you move the shape to another page or document. If more than one shape on a page has the same name, you must include the assigned ID.

Cell reference syntax and examples

The syntax you use and whether you can refer to a shape by name depend on the relationship between the two objects. These general rules apply:

  • If a shape is a peer of the shape whose formula you are editing, you can refer to the peer shape by name. If the peer shape is a group, you can refer by name to the group, but not its members. Neither can you refer by name to a shape's parent or its parent's peers.

  • You can use Sheet.ID syntax to refer to any shape on the page, whether the shape is in a group or is a parent of a shape.

  • Names that contain nonstandard characters must be enclosed in single quotation marks. Single quotation mark characters in a nonstandard name must be prefixed by a single quotation mark.

To reference a cell of | Use this syntax | Example
The same shape | CellName | Width
A shape, group, or guide | Shapename!CellName | Star!Angle
A shape, group, or guide in which more than one shape at the same level has the same name | Shapename.ID!CellName | Executive.2!Height
A named column with indexed rows | Section.Column[index] | Char.Font[3]
An unnamed column with indexed rows | Section.ColumnIndex | Scratch.A5
Any shape, page, master, or style | Sheet.ID!CellName | Sheet.8!FillForegnd
A master | Masters[MasterName]!SheetName!CellReference | Masters[Gear]!Shaft!Geometry1.X1
The page or master page on which the object is located | ThePage!CellReference | ThePage!User.Vanishing_Point
Another page in the document | Pages[PageName]!SheetName!CellReference | Pages[Page-3]!Sheet.4!BeginX
A style | Styles!SheetName!CellReference | Styles!Manager!LineColor
The document | TheDoc!CellReference | TheDoc!PreviewQuality
A shape, page, master, document, or style with a nonstandard name. | 'Sheetname'!CellName | '1-D'!LineColor


About Currency Constants

 Copy code hover
[image]

About Currency Constants
Send feedback

To format a number as currency, you can use the CY function and pass an optional constant to specify which country/region's currency to use. The currency constants can be specified as the ID number that corresponds to a country/region or as a string (enclosed in quotation marks) that corresponds to an ISO 4217 three-character abbreviation.

If you show currency symbols for nonlocal currencies, and the system does not know the symbol for a given currency, the dollar symbol ($) is displayed.

IDs and abbreviations

ID | Abbreviation | Currency
0 | SYS | Uses system settings
1 | XXX | Formats as a number
2 - 9 | Reserved
10 | EUR | Euro
11 | USD | U.S. dollar
12 | ATS | Austrian Schilling
13 | AUD | Australian Dollar
14 | BEF | Belgian Franc
15 | CAD | Canadian Dollar
16 | CHF | Swiss Franc
17 | CNY | Chinese Yuan Renminbi
18 | DEM | German Mark
19 | DKK | Danish Krone
20 | ESP | Spanish Peseta
21 | FIM | Finnish Markka
22 | FRF | French Franc
23 | GBP | British Pound Sterling
24 | GRD | Greek Drachma
25 | HKD | Hong Kong Special Administrative Region (SAR) Dollar
26 | HUF | Hungarian Forint
27 | IDR | Indonesian Rupiah
28 | IEP | Irish Punt
29 | ILS | Israeli Shekel
30 | ITL | Italian Lira
31 | JPY | Japanese Yen
32 | KRW | Korean Won
33 | LUF | Luxembourgian Franc
34 | MXN | Mexican Peso
35 | MYR | Malaysian Ringgit
36 | NLG | Dutch Guilder
37 | NOK | Norwegian Krone
38 | NZD | New Zealand Dollar
39 | PHP | Philippine Peso
40 | PLZ (Historic. Use PLN.) | Polish Zloty
41 | PTE | Portuguese Escudo
42 | ROL | Romanian Leu
43 | RUR (Historic. Use RUB.) | Russian Ruble
44 | SEK | Swedish Kroner
45 | SGD | Singapore Dollar
46 | THB | Thai Baht
47 | TWD | New Taiwan Dollar
48 | XEU (Historic. Use EUR.) | ECU (pre-1998)
49 | YUN (Historic. Use YUM.) | Yugoslavian Dinar
50 | ZAR | South African Rand
51 - 55 | Reserved
56 | ARS | Argentinean Peso
57 | BMD | Bermudian Dollar
58 | BOB | Bolivian Boliviano
59 | BRR (Historic. Use BRL.) | Brazilian Cruziero Real
60 | BSD | Bahamanian Dollar
61 | CLP | Chilean Peso
62 | COP | Colombian Peso
63 | CRC | Costa Rican Colon
64 | CZK | Czech Koruna
65 | DOP | Dominican Peso
66 | ECS | Ecuadorean Sucre
67 | EGP | Egyptian Pound
68 | HNL | Honduran Lempira
69 | INR | Indian Rupee
70 | JMD | Jamaican Dollar
71 | JOD | Jordanian Dinar
72 | KWD | Kuwaiti Dinar
73 | MOP | Macanese Pataca
74 | NIO | Nicaraguan Cordoba Oro
75 | PAB | Panamanian Balboa
76 | PEN | Peruvian Nuevo Sol
77 | PKR | Pakistani Rupee
78 | PYG | Paraguayan Guarani
79 | SAR | Saudi Riyal
80 | SIT | Slovenian Tolar
81 | SKK | Slovakian Koruna
82 | SVC | El Salvadoran Colon
83 | TRY | New Turkish Lira
84 | TTD | Trinidad and Tobago Dollar
85 | UYU | Uruguayan Peso Uruguayo
86 | VEB | Venezuelan Bolivar
87 | VND | Vietnamese Dong
88 | BRL | Brazilian Real
89 | PLN | Polish Zloty
90 | RUB | Russian Ruble
91 | YUM | Yugoslavian Dinar
92 | BYB (Historic. Use BYR.) | Belarusian Ruble
93 | UAH | Ukrainian Hryvnia
94 | AFA | Afghani (added in Visio 2002)
95 | ALL | Lek (added in Visio 2002)
96 | DZD | Algerian Dinar (added in Visio 2002)
97 | ADP | Andorran Peseta (added in Visio 2002)
98 | AOA | Kwanza (added in Visio 2002)
99 | XCD | East Caribbean Dollar (added in Visio 2002)
100 | AMD | Armenian Dram (added in Visio 2002)
101 | AWG | Aruban Guilder (added in Visio 2002)
102 | AZM | Azerbaijanian Manat (added in Visio 2002)
103 | BHD | Bahraini Dinar (added in Visio 2002)
104 | BDT | Taka (added in Visio 2002)
105 | BBD | Barbados Dollar (added in Visio 2002)
106 | BYR | Belarussian Ruble (added in Visio 2002)
107 | BZD | Belize Dollar (added in Visio 2002)
108 | XOF | CFA Franc BCEAO (added in Visio 2002)
109 | BTN | Ngultrum (added in Visio 2002)
110 | BAM | Convertible Marks (added in Visio 2002)
111 | BWP | Pula (added in Visio 2002)
112 | BND | Brunei Dollar (added in Visio 2002)
113 | BGL (Historic. Use BGN.) | Lev
114 | BGN | Bulgarian Lev (added in Visio 2002)
115 | BIF | Burundi Franc (added in Visio 2002)
116 | KHR | Riel (added in Visio 2002)
117 | XAF | CFA Franc BEAC (added in Visio 2002)
118 | CVE | Cape Verde Escudo (added in Visio 2002)
119 | KYD | Cayman Islands Dollar (added in Visio 2002)
120 | KMF | Comoro Franc (added in Visio 2002)
121 | CDF | Franc Congolais (added in Visio 2002)
122 | HRK | Croatian Kuna (added in Visio 2002)
123 | CUP | Cuban Peso (added in Visio 2002)
124 | CYP | Cyprus Pound (added in Visio 2002)
125 | DJF | Djibouti Franc (added in Visio 2002)
126 | TPE | Timor Escudo (added in Visio 2002)
127 | ERN | Nakfa (added in Visio 2002)
128 | EEK | Kroon (added in Visio 2002)
129 | ETB | Ethiopian Birr (added in Visio 2002)
130 | FKP | Falkland Islands (Islas Malvinas) Pound (added in Visio 2002)
131 | FJD | Fijian Dollar (added in Visio 2002)
132 | XPF | CFP Franc (added in Visio 2002)
133 | GMD | Dalasi (added in Visio 2002)
134 | GEL | Lari (added in Visio 2002)
135 | GHC | Cedi (added in Visio 2002)
136 | GIP | Gibraltar Pound (added in Visio 2002)
137 | GTQ | Quetzal (added in Visio 2002)
138 | GNF | Guinea Franc (added in Visio 2002)
139 | GWP | Guinea-Bissau Peso (added in Visio 2002)
140 | GYD | Guyana Dollar (added in Visio 2002)
141 | HTG | Gourde (added in Visio 2002)
142 | ISK | Iceland Krona (added in Visio 2002)
143 | IRR | Iranian Rial (added in Visio 2002)
144 | IQD | Iraqi Dinar (added in Visio 2002)
145 | KZT | Tenge (added in Visio 2002)
146 | KES | Kenyan Shilling (added in Visio 2002)
147 | KPW | North Korean Won (added in Visio 2002)
148 | KGS | Som (added in Visio 2002)
149 | LAK | Kip (added in Visio 2002)
150 | LVL | Latvian Lats (added in Visio 2002)
151 | LBP | Lebanese Pound (added in Visio 2002)
152 | LSL | Loti (added in Visio 2002)
153 | LRD | Liberian Dollar (added in Visio 2002)
154 | LYD | Libyan Dinar (added in Visio 2002)
155 | LTL | Lithuanian Litus (added in Visio 2002)
156 | MKD | Denar (added in Visio 2002)
157 | MGF (Historic. Use MGA.) | Madagascar Franc (added in Visio 2002)
158 | MWK | Malawian Kwacha (added in Visio 2002)
159 | MVR | Rufiyaa (added in Visio 2002)
160 | MTL | Maltese Lira (added in Visio 2002)
161 | MRO | Ouguiya (added in Visio 2002)
162 | MUR | Mauritius Rupee (added in Visio 2002)
163 | MDL | Moldovan Leu (added in Visio 2002)
164 | MNT | Tugrik (added in Visio 2002)
165 | MAD | Moroccan Dirham (added in Visio 2002)
166 | MZM | Metical (added in Visio 2002)
167 | MMK | Kyat (added in Visio 2002)
168 | NAD | Namibia Dollar (added in Visio 2002)
169 | NPR | Nepalese Rupee (added in Visio 2002)
170 | ANG | Netherlands Antillian Guilder (added in Visio 2002)
171 | NGN | Naira (added in Visio 2002)
172 | OMR | Rial Omani (added in Visio 2002)
173 | PGK | Kina (added in Visio 2002)
174 | QAR | Qatari Rial (added in Visio 2002)
175 | RWF | Rwanda Franc (added in Visio 2002)
176 | SHP | Saint Helena Pound (added in Visio 2002)
177 | WST | Tala (added in Visio 2002)
178 | STD | Dobra (added in Visio 2002)
179 | SCR | Seychelles Rupee (added in Visio 2002)
180 | SLL | Leone (added in Visio 2002)
181 | SBD | Solomon Islands Dollar (added in Visio 2002)
182 | SOS | Somali Shilling (added in Visio 2002)
183 | LKR | Sri Lanka Rupee (added in Visio 2002)
184 | SDD | Sudanese Dinar (added in Visio 2002)
185 | SRG | Suriname Guilder (added in Visio 2002)
186 | SZL | Lilangeni (added in Visio 2002)
187 | SYP | Syrian Pound (added in Visio 2002)
188 | TJR (Historic. Use TJS.) | Tajik Ruble
189 | TJS | Tajik Somoni (added in Visio 2002)
190 | TZS | Tanzanian Shilling (added in Visio 2002)
191 | TOP | Pa'anga (added in Visio 2002)
192 | TND | Tunisian Dinar (added in Visio 2002)
193 | TMM | Manat (added in Visio 2002)
194 | UGX | Uganda Shilling (added in Visio 2002)
195 | AED | UAE Dirham (added in Visio 2002)
196 | UZS | Uzbekistan Sum (added in Visio 2002)
197 | VUV | Vatu (added in Visio 2002)
198 | YER | Yemeni Rial (added in Visio 2002)
199 | ZMK | Zambian Kwacha (added in Visio 2002)
200 | ZWD | Zimbabwe Dollar (added in Visio 2002)
201 | VEF | Venezuelan Bolivar Fuente (added in Visio 2010)
202 | MGA | Malagasy Ariary (added in Visio 2010)
203 | RSD | Serbian Dinar (added in Visio 2010)
204 | CSD (Historic. Use RSD.) | Serbian Dinar (added in Visio 2010)


About Date, Time, and Duration Values

 Copy code hover
[image]

About Date, Time, and Duration Values
Send feedback

You can perform operations in formulas using date, time, and duration values. In Microsoft Visio, a date and time expression can be evaluated as a single value. A date and time expression is any expression commonly recognized as a date and/or time or a reference to a cell containing a date and/or time. This includes strings and numbers that look like a date and time, and date and time values returned from functions.

Date and time values in Visio are stored internally as a 64-bit floating point number. The value to the left of the decimal represents the number of days since December 30, 1899. The value to the right of the decimal represents the fraction of a day since midnight. Noon is represented by .5.

To use dates and times within an expression (rather than as a single constant), you must use the appropriate function to identify them as date and time values.

Valid dates

"2/28" | "2/28/99" | "2/28/1999"
"2-28" | "2-28-99" | "2-28/1999"
"6 Mar 99" | "6 Mar" | "6 Mar 99"
"1 January 99" | "Jan 1, 99" | "Jan 1, 1999"
"Jan 00" | "January, 2000" | "Jan 1, 00"

Valid times

"3:45" | "3:45:27" | "7a"
"7 am" | "7 p" | "7:30 PM"

Date and time functions

Function | Description
DATE | Converts numbers to a date value.
DATETIME | Converts a string to a date and time value.
DATEVALUE | Converts a string to a date value.
NOW | Returns the current system date as a date and time value.
TIME | Converts numbers to a time value.
TIMEVALUE | Converts a string to a time value.
DAY | Returns the day component in a date and time expression.
DAYOFYEAR | Returns the sequential day of the year in a date and time expression.
HOUR | Returns the hours component in a date and time expression.
MINUTE | Returns the minutes component in a date and time expression.
MONTH | Returns the month component in a date and time expression.
SECOND | Returns the seconds component in a date and time expression.
WEEKDAY | Returns the number of the weekday in a date and time expression.
YEAR | Returns the year component in a date and time expression.

Duration

You can perform operations that calculate duration or elapsed time. Duration is stored internally as days and the fraction of a day. For example, 1 elapsed week, 7 elapsed days, and 168 elapsed hours all are stored internally as 7.0, but are displayed with the appropriate units.

Visio recognizes the units of duration in the following table.

Unit | Abbreviation | Universal abbreviation
elapsed day | eday, ed. | ed
elapsed hour | ehour, eh. | eh
elapsed minute | eminute, em. | em
elapsed second | esecond, es. | es
elapsed week | eweek, ew. | ew

You can add a date and time to a duration to calculate a new date and time. You can perform the operations listed in this table using dates, times, and durations.

Input | Result
Date-time +/- duration | Date and time value
Duration +/- date-time | Date and time value
Duration +/- duration | Duration value
Date-time + date-time | Date and time value
Date-time - date-time | Duration value


About Error Values

 Copy code hover
[image]

About Error Values
Send feedback

Error values are displayed in cells that have incorrect formulas for that cell.

If a formula references a cell that contains an error value, that formula also displays an error value. You can use the function ISERR, ISERRNA, ISERROR, or ISERRVALUE to look for error values.

Error values
If the cell displays | The formula includes | Example
#DIV/0! | Division by 0 | 10/0
#VALUE! | An argument or operand of the wrong type | 5 + "House"
#REF! | A reference to a cell that does not exist | A cell that refers to another cell that no longer exists
#NUM! | An invalid number | Square root of a negative number
#N/A! | Not an available value | NA( ) function
#DIM! | A dimensional value that exceeds the dimension range (valid powers are integers -128 <= n <= 127) A dimensional value used with an inappropriate operation | 1in^100 * 1in^100 (the result is 1in^200, which is beyond the dimension range) 5.2cm^1.5 (not an integer power)


About Format Pictures

 Copy code hover
[image]

About Format Pictures
Send feedback

A format picture is used to determine how a value is displayed. For example, you can control the number of digits displayed to the right or left of a decimal point, or whether a text string appears as uppercase or lowercase.

Note Note

To define a date or time format picture by using Microsoft Office system formatting, enclose the format picture in double curly braces , for example, "{{m/d/yy}}". If you are using a predefined format, for example, 201, enclose it in curly braces and angle brackets, like this: "{<201>}"

The following sections show symbols you can use to format different types of values for display.

String and numeric values

Character | Description
# | Digit placeholder. Displays either a digit or nothing. Leading and trailing zeros are not displayed. If more digits than placeholders are to the left of the decimal, all digits are displayed. If more digits than placeholders are to the right of the decimal, the fraction is rounded to the number of placeholders. For a dimension, if the placeholder is the leftmost digit, subunits that are 0 are not displayed. For example, FORMAT(0ft 11.25in,"#.##u") displays 11.25in.
0 | Digit placeholder (zero). Displays either a digit or nothing. Leading and trailing zeros are displayed. If more digits than placeholders are to the left of the decimal, all digits are displayed. If more digits than placeholders are to the right of the decimal, the fraction is rounded to the number of placeholders. For a dimension, subunits that are 0 are displayed. For example, FORMAT(2ft 11.33in,"0.## u") displays 2 ft. 11.33 in.
. | Decimal placeholder. Determines how many digits are displayed to the left and right of the decimal position. In a multipart unit, the decimal is used in the smallest (rightmost) subunit. Displays the decimal character defined for the system's Region and Language settings (Control Panel). For example, FORMAT(250 cm,"0.000 u") displays 250.000 cm.
, | Thousands separator. If surrounded by digit placeholders (# or 0), the separator separates thousands from hundreds within a number that has four or more digits to the left of the decimal. Displays the thousands separator defined for the system's Region and Language settings (Control Panel).
E- E+ e- e+ | Scientific format. If the format contains at least one digit placeholder to the right of these symbols, the number is displayed in scientific format. Inserts the E or e between the number and its exponent. For E+ or e+, displays the plus (+) sign before positive exponents and the minus (-) sign before negative exponents. For E- or e-, displays the minus (-) sign only when the exponent is negative. For example, FORMAT(12345.67,"###.#e+#") displays 123.5e+2.
u or U | Short label placeholder. Inserts abbreviated unit labels after each subunit. For example: in., ft., deg. The U placeholder inserts mixed-case labels, while the u placeholder inserts lowercase labels. Inserts the same number of spaces before the label as before the placeholder. For example, FORMAT(12 c 13 d,"#u") displays 13c1.
uu or UU | Long label placeholder. Inserts unit labels after each subunit. For example: inches, feet, degrees The U placeholder inserts mixed-case labels, while the u placeholder inserts lowercase labels. Inserts the same number of spaces before the label as before the placeholder. For example, FORMAT(12.43in,"# #/4 UU") displays 12 2/4 INCHES.
uuu or UUU | Universal label placeholder. Inserts the universal (internal to Visio) form of unit labels after each subunit. The U placeholder inserts mixed-case labels, while the u placeholder inserts lowercase labels. Inserts the same number of spaces before the label as before the placeholder.
/ | Fraction placeholder. Displays expression as a whole number with fraction if a leading digit placeholder is present. Otherwise, displays only the whole number in the numerator. If a number follows the digit placeholder in the denominator, rounds the fraction to the nearest fraction whose numerator is 1 and simplifies it. If a number is specified in the denominator without the digit placeholder, rounds to the nearest fraction but does not simplify it. For example, FORMAT(12.43,"# #/4") displays 12 2/4.
space | Displays a space character in the formatted output. To display another character, use the backslash (\) character.

Currency values

Character | Description
$ | Currency symbol. Displays the currency symbol defined for the system's Region and Language settings (Control Panel)
u or U | Short label placeholder. Inserts the standard symbol for local currency or the three-character currency abbreviations for nonlocal currencies. For example, $99.00, 42.70 FRF. The u placeholder inserts lowercase, and U inserts mixed-case labels.
uu or UU | Long label placeholder. Inserts long currency labels after each subunit. For example: U.S. dollar, French franc. The u placeholder inserts lowercase, and U inserts mixed-case labels.
uuu or UUU | Universal label placeholder. Inserts the universal, three-character currency abbreviations for all currencies after each subunit. For example, 99.00 USD, 42.70 FRF. The u placeholder inserts lowercase, and U inserts mixed-case labels. Inserts the same number of spaces before the label as before the placeholder.

Text values

Character | Description
\ | Displays the next character as is. To display the backslash character, type \\. See also "text".
"text" or 'text' | Displays the text enclosed in quotation marks as is. See also \ (backslash).
@ | Text placeholder. Replaces a string if the value of an expression is a string. For example, FORMAT("Hello", "'You entered ('@')'" ) results in "You entered (Hello)".
@+ | Uppercase text placeholder. For string values, substitutes the input with uppercase. For example, FORMAT("Hello", "@ @+ @-" ) results in "Hello HELLO hello)".
@- | Text placeholder. For string values, substitutes the input with lowercase. For example, FORMAT("Hello", "@ @+ @-" ) results in "Hello HELLO hello)".

Date values

Character

Description

c or C

Date or time placeholder. Displays date and time values using a short (c) or long (C) date format, and the general time format. Visio versions 4.0 and earlier ignore this placeholder.

For example: FORMAT(DATETIME("6/25/07 12:05"),"C") displays Monday, June 25, 2007 12:05:00 PM. FORMAT(DATETIME("Jun. 25, 2007"),"c") displays 6/25/2007.

/

Date separator. If the expression is a date, separates the date components. Displays the date separator defined for the system's Region and Language settings (Control Panel).

[ ]

Elapsed date placeholder. Used with the d, dd, w, and ww placeholders to display duration units.

For example, [d] or [dd] is elapsed days and [w] or [ww] is elapsed weeks.

d

Day placeholder. Displays the day as a number (1-31) without a leading zero.

dd

Day placeholder. Displays the day as a number (01-31) with a leading zero.

ddd or w

Short day of week placeholder. Displays the day as an abbreviation (Sun-Sat).

dddd or w

Long day of week placeholder. Displays the day as a full name (Sunday-Saturday).

ddddd

Short date placeholder. Displays a date in the short form defined for the system's Region and Language settings (Control Panel).

dddd

Long date placeholder. Displays a date in the long form defined for the system's Region and Language settings (Control Panel).

D

Day placeholder for Traditional Chinese. Displays the day of the month as the textual representation of the ordinal number. Locale-specific.

D_c

Day placeholder for Traditional Chinese. Displays the day of the month as the textual representation of the ordinal number. Independent of the user locale.

w_c or w_c

Day placeholder for Traditional Chinese. Independent of the user locale.

w_e

Short day of week placeholder for English. Displays the day as an abbreviation (Sun-Sat). Independent of the user locale.

w_j

Short day of week placeholder for Japanese. Displays the day as an abbreviation. Independent of the user locale.

w_k

Short day of week placeholder for Korean. Displays the day as an abbreviation. Independent of the user locale.

w_s or w_s

Day placeholder for Simplified Chinese. Independent of the user locale.

ww_e

Long day of week placeholder for English. Displays the day as a full name (Sunday-Saturday). Independent of the user locale.

ww_j

Long day of week placeholder for Japanese. Displays the day as a full name. Independent of the user locale.

w_k

Long day of week placeholder for Korean. Displays the day as a full name. Independent of the user locale.

M

Month placeholder. Displays the month as a number (1-12) without a leading zero. See also m (minute placeholder).

MM

Month placeholder. Displays the month as a number (01-12) with a leading zero. See also mm (minute placeholder).

MMM

Month placeholder. Displays the month in abbreviated form (Jan-Dec).

MMMM

Month placeholder. Displays the full name of the month (January-December).

MMMM_c

Month placeholder for Traditional Chinese. Displays the full name of the month. Independent of the user locale.

MMMM_e

Month placeholder for English. Displays the full name of the month. Independent of the user locale.

yy

Year placeholder. Displays the year as a two-digit number (00-99).

yyyy

Year placeholder. Displays the year as a four-digit number (1900-2078).

g

Year placeholder. Locale-specific. For Japanese, displays short version for Gengo era. For Korean, displays Korean year label followed by a space.

g_j

Year placeholder. For Japanese, displays short version for Gengo era. Independent of user locale.

gg or G

Year placeholder. Locale-specific. For Traditional Chinese, displays short version for formal year label. For Japanese, displays short version for Gengo era in Kanji. For Korean, displays Korean year label followed by a space.

gg_c

Year placeholder. For Traditional Chinese, displays short version for formal year label. Independent of user locale.

gg_j

Year placeholder. For Japanese, displays short version for Gengo era in Kanji. Independent of user locale.

gg_k

Year placeholder. For Korean, displays Korean year label followed by a space. Independent of user locale.

ggg or GG

Year placeholder. Locale-specific. For Traditional Chinese, displays full version for formal year label. For Japanese, displays full version for Gengo era in Kanji. For Korean, displays Korean year label followed by a space.

ggg_c

Year placeholder. For Traditional Chinese, displays full version for formal year label. Independent of user locale.

ggg_j

Year placeholder. For Japanese, displays full version for Gengo era in Kanji. Independent of user locale.

e

Year placeholder. Locale-specific. For Traditional Chinese, displays string representing the Julian year. For Japanese, displays Gengo year as one or two digits and no leading zero. For Korean, displays the Korean year as a four-digit Arabic numeral.

e_c

Year placeholder. For Traditional Chinese, displays string representing the Julian year. Independent of user locale.

e_j

Year placeholder. For Japanese, displays Gengo year as a one- or two-digit Arabic numeral. Independent of user locale.

e_k

Year placeholder. For Korean, displays the Korean year as a four-digit Arabic numeral. Independent of user locale.

E

Year placeholder. Locale-specific. For Traditional Chinese, displays a string representing the republic year. For Japanese, displays Gengo year as one or two digits and no leading zero. For Korean, displays the Korean year as a four-digit Arabic numeral.

E_c

Year placeholder. For Traditional Chinese, displays a string representing the republic year. Independent of user locale.

ee

Year placeholder. Locale-specific. For Traditional Chinese, displays string representing the Julian year. For Japanese, displays Gengo year as a two-digit Arabic numeral with leading zero if needed. For Korean, displays the Korean year as a four-digit Arabic numeral.

ee_j

Year placeholder. For Japanese, displays Gengo year as a two-digit Arabic numeral. Independent of user locale.

EE

Year placeholder. Locale-specific. For Traditional Chinese, displays a string representing the republic year. For Japanese, displays Gengo year as a two-digit Arabic numeral with leading zero if needed. For Korean, displays the Korean year as a four-digit Arabic numeral.

n or N

Year placeholder. Locale-specific. For Traditional Chinese, displays the republic year as an Arabic numeral. For Japanese, displays Gengo year as one or two digits and no leading zero. For Korean, displays the Korean year as a four-digit Arabic numeral.

n_c

Year placeholder. For Traditional Chinese, displays the republic year as an Arabic numeral. Independent of user locale.

nn or NN

Year placeholder. Locale-specific. For Traditional Chinese, displays the republic year as an Arabic numeral. For Japanese, displays Gengo year as a two-digit Arabic numeral with leading zero if needed. For Korean, displays the Korean year as a four-digit Arabic numeral.

Time values

Character | Description
: | Time separator. Displays the time defined for the system's Region and Language settings (Control Panel).
[ ] | Elapsed time placeholder. Used with the h, hh, m, mm, s, and ss placeholders to display duration units. For example, [h] or [hh] is elapsed hours, [m] or [mm] is elapsed minutes, and [s] or [ss] is elapsed seconds.
h | Hour placeholder. Displays the hour without a leading zero in 12-hour form (0-12).
hh | Hour placeholder. Displays the hour with a leading zero in 12-hour form (00-12).
H | Hour placeholder. Displays the hour without a leading zero in 24-hour form (0-24).
HH | Hour placeholder. Displays the hour with a leading zero in 24-hour form (00-24).
m | Minute placeholder. Displays the minutes without a leading zero (0-59).
mm | Minute placeholder. Displays the minutes with a leading zero (00-59).
s | Second placeholder. Displays the seconds without a leading zero (0-59).
ss | Second placeholder. Displays the seconds with a leading zero (00-59).
t | AM/PM abbreviation. Displays the abbreviation defined for the system's Region and Language settings (Control Panel).
tt | AM/PM designator. Displays the full designator defined for the system's Region and Language settings (Control Panel).
t_c or tt_c | Traditional Chinese AM/PM designator. Displays the designator. Independent of user locale.
t_k or tt_k | Korean AM/PM designator. Displays the designator. Independent of user locale.
t_j or tt_j | Japanese AM/PM designator. Displays the designator. Independent of user locale.
t_e | English AM/PM designator. Displays the short designator. Independent of user locale.
tt_e | English AM/PM designator. Displays the full designator. Independent of user locale.
t_s or tt_s | Simplified Chinese AM/PM designator. Displays the designator. Independent of user locale.
T | General time format.


About Formulas

 Copy code hover
[image]

About Formulas
Send feedback

The key to controlling shape actions is to write formulas that define the behavior you want. You can edit a cell's formula to change the value of the cell and, as a result, change a particular shape's behavior. For example, the Height cell in the Shape Transform section contains a formula that you can change to alter the shape's height.

Microsoft Visio formulas are similar to typical spreadsheet formulas in many ways. Visio regards anything in a cell, even if it is a numeric value or simple cell reference, as a formula.

A formula in a cell can be inherited from the equivalent cell of a master or a style or defined locally. Visio evaluates the formula and then converts the results to an appropriate value and appropriate units for the cell. In a ShapeSheet window, you can display cell contents as either formulas or values.

Elements of a formula

A formula always starts with an equal sign, which is inserted automatically. A formula can include any of the following elements:

  • Numbers

  • Coordinates

  • Boolean values

  • Operators

  • Functions

  • Strings

  • Cell references

  • Units of measure

Default formulas

When you create a shape, Visio creates formulas for it by default. To see what the default formulas are, draw a simple shape (such as a rectangle, ellipse, or straight line) and open its ShapeSheet window (on the Developer tab, click Show ShapeSheet).

Inherited formulas

Visio inherits formulas whenever possible. Rather than make a local copy of every formula in the instance, an instance inherits formulas from its master on the document stencil and inherits formatting from the style definition stored with the drawing. This behavior results in smaller files, but also allows changes to the master's formulas or the style definition to be propagated to all instances.

Black text in a cell indicates an inherited formula.

Local formulas

When you write a local formula for an instance, you are replacing the inherited formula in the cell with a local override. Future changes to that cell in the master or style do not affect this instance because it has blocked inheritance for the cell with the local override.

Applying a style deletes all local formulas in the related cells unless you use the GUARD function to protect them.

Blue text indicates a local formula, either the result of editing the formula in a ShapeSheet window or some change to the shape that caused Visio to reset the formula for that cell.

Automatic updates to formulas

Visio automatically updates certain cells whenever you change a shape in a drawing. This means that under some circumstances formulas you enter can be replaced. For example, if you drag a corner handle to resize a shape, Visio resets formulas in the PinX, PinY, Width, and Height cells.

If necessary, you can protect formulas against changes by using the GUARD function.


About Functions

 Copy code hover
[image]

About Functions
Send feedback

Published: July 16, 2012

A function performs a single well-defined task. Most functions take a number of arguments as input. Although the type and number of arguments depend on the function, all functions have the same general syntax:

FUNCTION(argument1, argument2, … argumentN [,argumentA | argument])

Syntax element | Description
( ) | If a function takes no arguments, it must be followed by an empty set of parentheses ( ).
, | Arguments are separated by a comma.
... | Used for notation only; do not include in a function.
[ ] | Optional argument. Used for notation only; do not include in a function.
| | A choice; you can include argumentA or argument. Used for notation only; do not include in a function.

Many functions that you can use in formulas resemble those you have seen in spreadsheet programs: mathematical, such as SUM or SQRT; trigonometric, such as SIN or COS; or logical, such as IF or NOT. Many other functions are unique to Microsoft Office Visio, such as GUARD, GRAVITY, and RUNADDON.

For more information on specific functions, see this ShapeSheet Reference.

Note Note

Certain functions appear in formulas generated by Visio, but are not shown in the Edit Formula dialog box or described in this reference because they are reserved for internal use and should not be used in other formulas. Following are examples: ELLIPSE_THETA, _ELLIPSE_ECC, _UCON_C1, and _SHAPEMIN.


About Operators

 Copy code hover
[image]

About Operators
Send feedback

You can use operators in formulas to perform arithmetic operations (addition, subtraction, multiplication, and so on) or logical comparisons (greater than, less than, equal to, and so on). You also can control the order of evaluation in a formula by enclosing expressions in parentheses. Use the ampersand operator to combine (concatenate) character strings.

Microsoft Visio automatically attempts to convert data types when an operation or function requires a specific type of data. For example, the multiplication operator requires numeric arguments, and the ampersand (string concatenation) operator requires string arguments. If the argument cannot be converted to the required data type, a default value is provided. The default value is the typed equivalent of nothing: zero for numbers, FALSE for Boolean values, "" for strings, and so on.

The following table shows examples of expressions and their results.

Expression | Result | Description
2 * 5 & " cents" | "10 cents" | The & operator (string concatenation) requires string arguments, so the numeric result of 2 * 5 is automatically converted to the string "10".
5 * "2" | 10 | The * operator (multiplication) requires numeric arguments, so the string "2" is automatically converted to the equivalent number 2.
5 * "sheep" | 0 | The * operator (multiplication) requires numeric arguments, so because the string "sheep" cannot be converted to a number, zero is used as its numeric equivalent.

Arithmetic operators

Arithmetic operators perform operations on numbers. The plus (+) and minus (-) operators can be used alone as unary operators to establish the sign of a number. The percent (%) operator is also a unary operator and identifies the number as a percentage.

Operator | Action | Example | Result
+ | Unary plus | +37 | 37
- | Unary minus | -37 | -37
% | Unary percentage | 37% | .37
^ | Exponentiation | 5 ^ 2 | 25
* | Multiplication | 5 * 2 | 10
/ | Division | 5 / 2 | 2.5
+ | Addition | 5 + 2 | 7
- | Subtraction | 5 - 2 | 3

Comparison operators

Comparison operators are used to construct logical expressions. A logical expression evaluates to either TRUE or FALSE.

Operator | Alternative | Action | Example | Result
> | _GT_ | Greater than | 5 > 2 | TRUE
< | _LT_ | Less than | 5 < 2 | FALSE
>= | _GE_ | Greater than or equal to | 5 >= 2 | TRUE
<= | _LE_ | Less than or equal to | 5 <= 2 | FALSE
= | _EQ_ | Equal to | 5 = 2 | FALSE
<> | _NE_ | Not equal to | 5 <> 2 | TRUE

The symbolic comparison operators (>, <, and so forth) are the best choice for most comparisons. The alternative operators (_GT_, _LT_, and so forth) perform an exact comparison to the full 15 digits of precision that Visio uses to store values internally.

When you compare rounded or calculated values by using the alternative operators, FALSE might be returned, when for all practical purposes the expression should evaluate to TRUE.

When you use comparison operators to compare text strings, the strings are first converted into numeric values. Text strings that cannot be converted return a value of 0; therefore, comparisons vary and might not produce the results you expect. To do a standard string comparison, use the function STRSAME or STRSAMEEX.

Order of evaluation

When a formula contains more than one expression, the expressions are evaluated in order according to the operation being performed. This table shows the order of evaluation of operators in Visio.

Order | Action | Operator
First | Positive | + (unary)
 | Negative | - (unary)
 | Percent | % (unary)
Second | Exponentiation | ^
Third | Multiplication | *
 | Division | /
Fourth | Addition | +
 | Subtraction | -
Fifth | String concatenation | &
Sixth | Greater than | > or GT
 | Greater than or equal to | >= or GE
 | Less than | < or LT
 | Less than or equal to | <= or LE
Seventh | Equal | = or EQ
 | Not equal | <> or NE

You can change the order of evaluation by enclosing expressions in parentheses. Visio evaluates expressions within parentheses first, from left to right. For example:

4 + 5 * 6 = 4 + 30 = 34

(4 + 5) * 6 = 9 * 6 = 54

If expressions in parentheses are nested, the expression in the innermost set of parentheses is evaluated first.

Ampersand operator

The ampersand operator returns a new character string. You can create compound words and phrases using the ampersand operator. Use the following syntax:

"string1" & "string2"

Example

"dog" & "house" returns "doghouse"


About Security Settings and Running Code in Visio (ShapeSheet)

 Copy code hover
[image]

About Security Settings and Running Code in Visio (ShapeSheet)
Send feedback

Creating secure applications is one of the primary challenges facing solution developers. Users, administrators, and developers are increasingly aware of the potential of unknowingly running code that can be harmful to their computers. It is more important than ever that you help to ensure the integrity of your applications.

All security settings are Office-wide and are set in the Trust Center (click the File tab, click Options, and then click Trust Center). Affected settings include the following:

  • Specifying trusted publishers

  • Specifying trusted locations

  • Loading COM add-ins

  • Loading published and path-discovered add-ons

  • Loading VBA macros

In previous versions of Visio, settings were made in the Security dialog box and the Security tab of the Options dialog box (Tools menu). As of Office Visio 2007, these dialog boxes have been eliminated, and as of Microsoft Visio 2010, Visio toolbars and menus have been replaced by the ribbon.

For more information about settings in the Office Trust Center, see Security Notes for Microsoft Office Solution Developers.

For information about digitally signing code and trusted sources and publishers, search for "code signing" on MSDN, the Microsoft Developer Network Web site.

For more information about good security design practices and technologies, search for "security" on MSDN.

Additional Visio resources

  • To learn more about Visio add-ons and COM add-ins, see the MSDN article, Overview of Add-ons and COM Add-ins in Visio 2007.

  • To learn more about the RUNADDON function and the AddonName property, see the MSDN article Changes in the RUNADDON Function and the AddOnName Property for Visio 2002.


About Strings

 Copy code hover
[image]

About Strings
Send feedback

Formulas can contain strings. To format string output, such as in a prompt cell, a shape data item value, or a text field, you specify a format picture. Output can be formatted as a number-unit pair, string, date-time, duration, or currency. For example, the format picture "0 #/10 uu" formats the number-unit pair 10.9cm as "10 9/10 centimeters".

You can use format pictures in the Format cell of the Shape Data section and as an argument to the FORMAT or FORMATEX function. When you insert a text field, format pictures appear in the list of formats in the Field dialog box (Insert tab).

Using functions to format strings

In any formula that resolves to a string, including custom text field formulas, you can use the FORMAT or FORMATEX function. The FORMAT function returns a string of the formatted output. The FORMATEX function converts untyped input to the units you choose for the formatted result.

Displaying formatted shape data

You can format the displayed value of a shape data item by entering a format picture in the Format cell.

For example, a project timeline shape can have a shape data item that measures the cost of a process. By default, a shape data item value is a string. To format the string "1200", you can enter "$###,###.00" in the Format cell so that the user sees a currency.

Microsoft Visio uses the settings on the Currency tab in the Customize Format dialog box in the Region and Language item in Control Panel to determine the currency symbol and thousands separator to display. (In Control Panel, click Region and Language, and then click Additional Settings.)

To convert a string to a currency value so that you can perform calculations with the value, use the CY function.

Using functions to manipulate text strings

You can use functions to manipulate text strings, for example, to locate or replace certain characters in a text string. You can also get information about the position of a character in a string, or identify beginning and ending characters in a text string.


About the Formula Tracing Window

 Copy code hover
[image]

About the Formula Tracing Window
Send feedback

The Formula Tracing window is designed to provide shape developers with information about cell interdependencies—both dependent cells (cells that have a dependency on a given cell), and precedent cells (cells that a given cell depends on).

The cells in a Microsoft Visio ShapeSheet contain values and formulas. Formulas can, in turn, have references to other cells, giving you the power to calculate a value in one cell based on another cell's value. When creating or maintaining complex shapes, however, it can be difficult to identify all these interdependencies because a formula can reference any cell in the drawing, whether it's a cell in the same ShapeSheet, or a cell belonging to another object in the drawing, for example, a page, style, master, or another shape.

The Formula Tracing window provides information to help you understand the implications of changes you make to cells.

Displaying the Formula Tracing Window

To view the Formula Tracing window, with the ShapeSheet window active, under ShapeSheet Tools on the Design tab, in the Formula Tracing group, click Show Window. The Formula Tracing window appears docked in the ShapeSheet window by default, but is an anchored window that can be docked, floated or merged with other available anchored ShapeSheet windows, for example, the Style Explorer window.

Tracing dependent cells

To see a list of cells that are dependent on a particular cell, select that cell in the ShapeSheet window. In this example, the Width cell is selected.

To view its dependent cells, in the Formula Tracinggroup, click Trace Dependents.

A list of all the cells with a dependency on the Width cell appears in the Formula Tracing window. You can navigate to any cell in the list by double-clicking its entry in the Formula Tracing window.

Tracing precendent cells

To see a list of cells that a particular cell is dependent upon, first select the cell in the ShapeSheet window. In this example, the Geometry1.X2 cell is selected.

To view its precedent cells, in the Formula Tracinggroup, click Trace Precedents.

A list of all the cells that the Geometry1.X2 cell is dependent upon appears in the Formula Tracing window. You can navigate to any cell in the list by double-clicking its entry in the Formula Tracing window.


About the ShapeSheet Spreadsheet

 Copy code hover
[image]

About the ShapeSheet Spreadsheet
Send feedback

Everything in Microsoft Visio, every document, page, style, shape, group, shape or object within a group, master, object from another program, guide, and guide point, has a ShapeSheet spreadsheet where information about that object is stored. This spreadsheet contains information such as height, width, angle, color, and other attributes that determine the shape's appearance and behavior.

As a shape developer, you need precise control over the appearance and behavior of the shapes you create. You can change a shape's default behavior and enhance what it can do by editing it in its ShapeSheet, which you can access in a ShapeSheet window or programmatically.

Viewing an object in a ShapeSheet window

The Visio drawing window and ShapeSheet window are simply different views of the same shape.

  • When you view a shape in a drawing window, you see it rendered graphically and behaving according to the formulas in its ShapeSheet.

  • When you view a shape in a ShapeSheet window, you see the underlying formulas that determine how it looks and behaves on the drawing page.

You can view a ShapeSheet window and a drawing window simultaneously and see the shape change in the drawing window as you manipulate cells in its ShapeSheet window or vice versa. For example, when you move the shape with the pointer, the shape's PinX and PinY formulas in the Shape Transform section change to reflect its new position on the drawing page.

Structure of the ShapeSheet window

A ShapeSheet is divided into sections that control a particular aspect of a shape's behavior or appearance, for example, its geometry or its formatting. Each section contains one or more rows that contain cells. Each cell can contain a formula, its result (commonly called the cell value), and optional error information. A formula may be required or optional, depending on the particular cell. A cell's data (for example, its formula or value) may be locally defined or, more often, inherited from the equivalent cell in the shape's master or style.

The following example shows the formula bar [image], a section [image], a cell [image], and a row [image] in the ShapeSheet window.

When you draw a shape, Visio records the shape as a collection of horizontal and vertical locations connected with line segments. These locations (called vertices) are recorded in the X and Y cells of the shape's Geometry section. As shown in the following example, when you click the X and Y cells in the Geometry section of a shape's ShapeSheet window, you will see a black-bordered box highlighting the vertex on the shape in the drawing window.

Editing an object in the ShapeSheet window

When a ShapeSheet window is active, the ribbon changes to display options specific to working in this window. When you select a ShapeSheet cell, a formula bar appears, which you can use to enter and edit an object's formulas. Or, you can work directly in the cell.

In a ShapeSheet window, you can add sections to a shape's sheet to add new characteristics to the shape on the drawing page. For example, you can add a Connection Points section to create a connection. When you no longer need a section, you can delete it.

You also can add rows to sections to hold additional formulas or to change a shape's appearance. For example, you can add a row to a Geometry section to add a segment to a shape. Similarly, you can delete rows you no longer need.

You can display either formulas or values in cells. Display formulas when you are entering new formulas, editing existing formulas, or to see how formulas in cells relate to each other. A value is the result you get when Visio evaluates a cell's formula. You can display values in cells to see the result of an evaluation.

Additional ShapeSheet references

For details on a particular section, row, or cell in the ShapeSheet, view the corresponding article in this ShapeSheet Reference.

For details on programmatically accessing the ShapeSheet spreadsheet, see the Microsoft Visio Automation Reference.


About the Style Explorer Window

 Copy code hover
[image]

About the Style Explorer Window
Send feedback

The Style Explorer window provides shape developers with a quick way to determine which shape cells inherit from a given style, or the style from which a given cell inherits its value.

Styles are named collections of formatting attributes that you can apply to a shape. In Microsoft Visio, a single style can define text, line, and fill attributes as an efficient way to ensure consistency in your shapes. Additionally, you can also define a style for any one class of attribute (text, line, or fill) or any combination of attributes.

Unlike shapes to which you've applied formatting attributes individually, shapes that derive their formatting from a style not only ensure consistency but also respond better when they are created, moved, scaled, or rotated.

The Style Explorer window provides the information you need to understand better the implications of changes you make to shapes.

Note Note

Cell values that appear black in the ShapeSheet window are inherited; those that appear blue are local.

Using the Style Explorer window

To view the Style Explorer window, with the ShapeSheet window active, on the ShapeSheet Tools Design tab, in the View group, select Style Explorer. The Style Explorer window appears docked in the ShapeSheet window by default, but is an anchored window that can be docked, floated, or merged with other available anchored ShapeSheet windows, for example, the Formula Tracing window. The Style Explorer window contains a treeview display of all the styles defined in the current drawing.

Note Note

To get information about a style, you can right-click the style in the Style Explorer window to view its ShapeSheet.

The Style Explorer window provides the following information:

  • The cells that inherit their values from a selected style.When you select a style in the Style Explorer window, all cells in the ShapeSheet window that inherit from that style appear without hatching, while cells that do not inherit from that style appear lightly hatched.

  • The style from which a selected cell inherits its value.When you select a ShapeSheet cell, the style from which it inherits its value is displayed on the taskbar under the ShapeSheet window.


About Units of Measure (Visio ShapeSheet Reference)

 Copy code hover
[image]

About Units of Measure (Visio ShapeSheet Reference)
Send feedback

When you insert fields into text or build formulas, you often specify units of measure for the values you type.

Microsoft Visio evaluates the result of a formula differently depending on the cell in which you enter the formula. In general, cells that represent shape position, a dimension, or an angle require a number-unit pair that consists of a number and the qualifying units needed to interpret the number. Many other cells don't require units and evaluate to a string, to TRUE or FALSE, or to an index. For example, the same formula that in the FillForegnd cell means color 5 from the drawing's color palette means TRUE (and locks the shape's width) in the LockWidth cell.

Always specify a unit of measure when you enter a formula in a cell that expects a dimensional value. If you don't specify a unit of measure, Visio uses the default unit for that cell, which can be page units, drawing units, type units, duration units, or angular units.

Units of measure

When indicating units of measure in ShapeSheet formulas, use the abbreviations listed in the following table.

To specify these units of measure | Use | Automation constant
Centimeters | cm | visCentimeters (69)
Ciceros | c | visCiceros (54)
Date or time | date | visDate (40)
Degrees | deg | visDegrees (81)
Didots | d | visDidots (53)
Elapsed weeks | ew | visElapsedWeek (43)
Elapsed days | ed | visElapsedDay (44)
Elapsed hours | eh | visElapsedHour (45)
Elapsed minutes | em | visElapsedMin (46)
Elapsed seconds | es | visElapsedSec (47)
Feet | ft | visFeet (66)
Inches | in | visInches (65)
Kilometers | km | visKilometers (72)
Meters | m | visMeters (71)
Miles | mi | visMiles (68)
Millimeters | mm | visMillimeters (70)
Minutes | ' | visMin (84)
Nautical miles | nm | visNautMiles (76)
Percent | % | visPercent (33)
Picas | p | visPicas (51)
Points | pt | visPoints (50)
Radians | rad | visRadians (83)
Seconds | " | visSec (85)
Yards | yd | visYards (75)

Compound units of measure

In formulas, you can express units of measure for compound numbers using the abbreviations in the following table. Visio simplifies the results and displays them in the compound units.

For example, if you enter 45.635°, Visio displays the equivalent value as 45° 38' 6".

To specify units | Use this abbreviation | Automation constant
Ciceros and didots | CICERO/DIDOT | visCicerosAndDidots (52)
Degrees, minutes, and seconds | ° | visDegreeMinSec (82)
Feet and inches | FEET/INCH | visFeetAndInches (67)
Picas and points | PICAPOINTS | visPicasAndPoints (49)

Fractional units of measure

You can specify fractional units of measure in the DrawingScale cell to affect the number of ruler subdivisions that Visio displays in the drawing window. By default, Visio divides distances into tenths when drawing its rulers. If you use fractional units of measure in the DrawingScale cell, Visio divides distance into the following:

  • Eighths for visInchFrac and visMileFrac

  • Twelfths for visFeetAndInches

Fractional units of measure have no effect in cells other than in the DrawingScale cell.

To specify fractional units | Use this abbreviation | Automation constant
Inches in fractions | IN_F | visInchFrac (73)
Miles in fractions | MI_F | visMileFrac (74)
Feet and inches | FEET/INCH | visFeetAndInches (67)

Multidimensional units of measure

In formulas, you can express units of measure for multidimensional numbers using the abbreviations in the following table. Visio simplifies the results and displays them in the multidimensional units.

To specify multidimensional units | Use this abbreviation | Automation constant
Acre | ACRES | visAcre (36)
Centimeters | SQ. CM., SQ CM, CM.^2, CM^2 | visCentimeters (69)
Feet | SQ. FT., SQ FT, FT.^2, FT^2 | visFeet (66)
Hectare | HECTARES, HECTARE, HA., HA | visHectare (37)
Inches | SQ. IN., SQ IN, IN.^2, IN^2 | visInches (65)
Kilometers | SQ. KM., SQ KM, KM.^2, KM ^2 | visKilometers (72)
Meters | SQ. M., SQ M, M.^2, M ^2 | visMeters (71)
Miles | SQ. MI., SQ MI, MI.^2, MI ^2 | visMiles (68)
Millimeters | SQ. MM., SQ MM, MM.^2, MM ^2 | visMillimeters (70)
Yards | SQ. YD., SQ YD, YD.^2, YD^2 | visYards (75)

Universal strings

In localized versions of Visio, the set of recognized strings changes with the language. If you want your program to work with multiple languages, use the universal strings for units of measure.

For | Use
Centimeters | CM
Ciceros | C
Ciceros and didots | CICERO/DIDOT
Date or time | DATE
Degrees | DEG
Degrees, minutes, seconds | °
Didots | D
Elapsed week | EW
Elapsed day | ED
Elapsed hour | EH
Elapsed minute | EM
Elapsed second | ES
Feet | FT
Feet and inches | FEET/INCH
Inches | IN
Inches in fractions | IN_F
Kilometers | KM
Meters | M
Miles | MI
Miles in fractions | MI_F
Millimeters | MM
Minutes | '
Nautical miles | NM
Percent | %
Picas | P
Picas and points | PICAPOINTS
Points | PT
Radians | RAD
Seconds | "
Yards | YD

Implicit units of measure

When Visio parses and stores a number-unit pair, it can use explicit units or implicit units. A number expressed in explicit units always is displayed in the units of measure that were originally entered. A number expressed in implicit units always converts to the equivalent value in the drawing, page, or angular units appropriate for the cell.

For example, suppose you enter the equivalent of 1 inch in cell A using explicit units and in cell B using implicit units, and that both cell A and cell B use drawing units. Next, you change the default units for the page to centimeters. Cell A still displays 1 in., because it uses explicit units that don't change with the defaults. Cell B now displays 2.54 cm, the equivalent value in the default units.

To enter units implicitly, use the following syntax.

VBA Copy code Copy code
                      number [unit, flag]

number | The original value, such as 3.7, 1.7E-4, or 5 1/2.
unit | The units in which number originally is expressed.
flag | The measurement system to use when the implicit-value unit is displayed. See below for values.

The parameter flag is one of the following letters (either uppercase or lowercase) indicating the measurement system that should be used when the implicit-value unit is displayed.

Flag | Measurement system | Example
a, A | Angular | =5[deg,A]
d, D | Drawing | =5[in,D]
e, E | Duration | =5[eh,E]
p, P | Page | =5[in,P]
t, T | Type | =5[pt,T]

Additionally, you can use the implicit units DL, DP, DT, DA, DE for implicit drawing-, page-, text-, angular-, and time-units, respectively. These units assume the associated value is internal units. For example, if the current measurement system is centimeters, =2 DL would be interpreted as 2 internal units (inches) and displayed as 5.08 cm.

Using the implicit syntax described above, this expression (=2 DL) is equivalent to 2[in,d]. The implicit syntax gives you the choice of how to interpret the value, so you could also specify 2[ft,d], which would be interpreted as 2 feet, and displayed as 60.96 cm. The implicit units DL, DP, DT, DA, and DE are universal, and do not have localized counterparts.

Default units of measure

Following are the default units of measure along with their equivalent settings in the user interface.

Default unit of measure | User interface equivalent
visDrawingUnits | The units in the DrawingScale cell of the page or master containing the cell.
visPageUnits | The units selected in the Measurement units box on the Page Properties tab of the Page Setup dialog box (on the Design tab, click the Page Setup arrow).
visTypeUnits | The units selected in the Text box under Display on the Advanced tab of the Visio Options dialog box (click the File tab, and then click Options).
visAngleUnits | The units selected in the Angle box under Display on the Advanced tab of the Visio Options dialog box.
visDurationUnits | The units selected in the Duration box under Display on the Advanced tab of the Visio Options dialog box.


Common Tasks (Visio 2013 ShapeSheet)

 Copy code hover
[image]

Common Tasks (Visio 2013 ShapeSheet)
Send feedback

This navigation page contains links to overview topics about programmability in Visio. Click the links below or use the TOC to navigate to the following topics:

  • Add, Change, or Delete Rows in the ShapeSheet

  • Add, Show, Hide, or Delete a Section

  • Change the Name and View the ID of a Shape

  • Copy and Paste a Formula from One Cell into Another

  • Display Formulas or Values in Cells

  • Edit a Part of a Formula

  • Enter an Empty Formula

  • Move Around a ShapeSheet Window

  • Open Each ShapeSheet in the Same Window

  • Open the ShapeSheet for a Shape, Page, or Document

  • Reference a Cell in a Formula

  • Run in Developer Mode (Display the Developer Tab)

  • Show an Object in the ShapeSheet Window

  • Type a New Formula for a Cell


Add, Change, or Delete Rows in the ShapeSheet

 Copy code hover
[image]

Add, Change, or Delete Rows in the ShapeSheet
Send feedback

Published: July 16, 2012

You can add new rows, change the type for existing rows, or delete rows in the ShapeSheet in Microsoft Visio.

To add a new row to a section in the ShapeSheet

  1. Select a cell in the existing row.

  2. In the Rows group on the Design tab under ShapeSheet Tools, click Insert to insert the row after the existing row.

    Or right-click the cell, and then click Insert Row or Insert Row After (Geometry section only) on the shortcut menu.

To change a row's type in the ShapeSheet

  • Right-click a row label or cell, and then click Change Row Type on the shortcut menu.

    Note Note

    If Change Row Type is unavailable, the ShapeSheet section may not allow other row types.

To delete a row in the ShapeSheet

  1. Select a cell in the row you want to delete.

  2. In the Rows group on the Design tab under ShapeSheet Tools, click Delete. Or right-click the cell, and then click Delete Row on the shortcut menu. The following rows move up one row in the section.


Add, Show, Hide, or Delete a Section

 Copy code hover
[image]

Add, Show, Hide, or Delete a Section
Send feedback

Published: July 16, 2012

You can add, show, hide, and delete sections in the ShapeSheet.

Note Note

If you want to add your own custom section to the ShapeSheet, use the User-defined Cells or Scratch sections to define your ShapeSheet logic.

To add a section

  1. Click in the ShapeSheet window to make it active.

  2. Do one of the following:

    • Under ShapeSheet Tools on the Design tab, in the Sections group, click Insert.

    • Or right-click in the ShapeSheet window, and then click Insert Section on the shortcut menu.

  3. Select the check box for the section you want to add, and then click OK.

    Note Note

    If you don't see the new section in the ShapeSheet window, make sure the section is set to appear. In the View group on the ShapeSheet Tools tab, click Sections, and then select the check boxes for the sections you want to appear.

To show or hide sections

  • Select any cell in the section you want to delete, and then in the Sections group on the ShapeSheet Tools tab, click Delete.

  • You can also right-click a cell, and then click Delete Section on the shortcut menu.

    Note Note

    Certain sections cannot be deleted. For example, you cannot delete the Shape Transform section because it specifies a shape's position. If you cannot delete a section, Delete Section is unavailable.

To collapse or expand a section

  1. Click in the ShapeSheet window to make it active.

  2. Point to the section title.

    If the pointer changes to a minus sign [image], you can collapse the section.

    If the pointer changes to a plus sign [image], you can expand the section.

  3. Click the section title.

    The display changes to either hide or show the section's cells.

To delete a section

  1. Click in the ShapeSheet window to make it active.

  2. Under ShapeSheet Tools on the Design tab, in the View section, click Sections. Or right-click in the ShapeSheet window, and then click View Sections.

  3. Select the sections you want to show, or clear the sections you want to hide.

  4. Click OK.


Change the Name and View the ID of a Shape

 Copy code hover
[image]

Change the Name and View the ID of a Shape
Send feedback

  1. Select a shape in a drawing window.

  2. On the Developer tab, in the Shape Design group, click Shape Name.

  3. In the Shape Name dialog box, enter a name.

    The ID of the shape is listed at the top of the Shape Name dialog box.

  4. Click OK.


Copy and Paste a Formula from One Cell into Another

 Copy code hover
[image]

Copy and Paste a Formula from One Cell into Another
Send feedback

Published: July 16, 2012

  1. Select the cell that contains the formula you want.

  2. Press CTRL+C.

    To replace the entire formula, select the cell whose formula you want to replace.

    To paste the formula into an existing formula, double-click the cell, and then click an insertion point where you want to paste the formula.

  3. Press CTRL+V

  4. Press ENTER to accept the formula.


Display Formulas or Values in Cells

 Copy code hover
[image]

Display Formulas or Values in Cells
Send feedback

Published: July 16, 2012

  1. Click in the ShapeSheet window to make it active.

  2. On the ShapeSheet Tools tab, in the View group, click Formulas to view formulas, or click Values to view values.

    Note Note

    You can also right-click in the ShapeSheet window and then click Formulas or Values on the shortcut menu.


Edit a Part of a Formula

 Copy code hover
[image]

Edit a Part of a Formula
Send feedback

  1. Double-click the cell. Or select the cell and press F2.

  2. In the cell or the formula bar, edit the formula using the techniques in the following table.

To | Do this
Place the insertion point | Click where you want the insertion point to appear.
Move the insertion point | Press the left or right arrow key.
Delete the character to the left | Press BACKSPACE.
Delete the character to the right | Press DELETE.
Select text | Drag the pointer over the text.
Extend the selection to the left | Press SHIFT+left arrow.
Extend the selection to the right | Press SHIFT+right arrow.
Select a word | Press CTRL+SHIFT+right arrow or double-click.
Select to the end | Press SHIFT+END.
Select to the beginning | Press SHIFT+HOME.
Replace selected text | Type the new text.
Delete selected text | Press DELETE. Or on the Home tab, click Cut.


Enter an Empty Formula

 Copy code hover
[image]

Enter an Empty Formula
Send feedback

  1. Select the cell that will contain the formula.

  2. Press DELETE, and then press ENTER.

Note Note

Try this in a Scratch cell after inserting a local formula. The cell reverts to 'No Formula', because there is no formula to inherit from the master.


Move Around a ShapeSheet Window

 Copy code hover
[image]

Move Around a ShapeSheet Window
Send feedback

To move from cell to cell in a ShapeSheet window, use the arrow and TAB keys. Click a cell to activate it or scroll through the ShapeSheet cells without changing the active cell.

You also can use the techniques in the following table.

To | Do this
Activate a cell | Click the cell with the pointer.
Select a numbered row of cells | Click the row number.
Move left one cell | Press the LEFT ARROW key or SHIFT+TAB.
Move right one cell | Press the RIGHT ARROW key or TAB.
Move up one cell | Press the UP ARROW key.
Move down one cell | Press the DOWN ARROW key.
Move to the last cell in a row | Press END.
Move to the first cell in a row | Press HOME.
Scroll down one screen | Press PAGEDOWN.
Scroll up one screen | Press PAGEUP.
Scroll right one screen | Press CTRL+PAGEDOWN.
Scroll left one screen | Press CTRL+PAGEUP.
Scroll to the window's lower-right corner | Press CTRL+END.
Scroll to the window's upper-right corner | Press CTRL+HOME.


Open Each ShapeSheet in the Same Window

 Copy code hover
[image]

Open Each ShapeSheet in the Same Window
Send feedback

  1. Click the File tab, click Options, and then click Advanced.

  2. Under General, select Open each ShapeSheet in the same window.

  3. Click OK.


Open the ShapeSheet for a Shape, Page, or Document

 Copy code hover
[image]

Open the ShapeSheet for a Shape, Page, or Document
Send feedback

The ShapeSheet window is hidden by default in Microsoft Visio. To access the ShapeSheet, you need to run Visio in developer mode (display the developer tab).

To run Visio in developer mode

  1. Click the File tab and then click Options.

  2. In the Visio Options dialog box, click Advanced, and then, under General, select Run in developer mode.

To view the ShapeSheet for a shape

  • Right-click the shape on the drawing canvas and click Show ShapeSheet.

  • Select the shape on the drawing canvas, and then on the Developer tab, in the Shape Design group, click Show ShapeSheet, and then click Shape.

To view the sheet for a page

  • On the Developer tab, in the Shape Design group, click Show ShapeSheet, and then click Page.

To view the sheet for a document

  • On the Developer tab, in the Shape Design group, click Show ShapeSheet, and then click Document.


Reference a Cell in a Formula

 Copy code hover
[image]

Reference a Cell in a Formula
Send feedback

Published: July 16, 2012

  1. Double-click the cell in which you want to place the reference, and then place the insertion point at the location you want in the formula.

  2. Click the cell you want to reference.

  3. Press ENTER to accept the formula. Or press ESC to cancel the changes.


Run in Developer Mode (Display the Developer Tab)

 Copy code hover
[image]

Run in Developer Mode (Display the Developer Tab)
Send feedback

  • Click the File tab and then click Options.

  • In the Visio Options dialog box, click Advanced, and then under General, select Run in developer mode.

You then can select an object and click Show ShapeSheet for quicker access to the ShapeSheet window.


Show an Object in the ShapeSheet Window

 Copy code hover
[image]

Show an Object in the ShapeSheet Window
Send feedback

Microsoft Visio objects are stored internally as a set of formulas. You can view a Visio object in the ShapeSheet window to see and edit the underlying formulas that determine its appearance and behavior.

For details on how to show a specific object in the ShapeSheet window, click an element in the following list.

Show a shape, group, guide, guide point, or foreign object

  1. Select the object.

  2. On the Developer tab, click Show ShapeSheet.

Show a master

You can access the ShapeSheet window and edit formulas only for masters on a custom or document stencil. Beginning with Microsoft Office Visio 2003, you cannot edit masters on stencils that ship with the Visio product.

  1. In the Shapes window, click More Shapes, and then click Open Stencil.

  2. Locate and select the stencil that contains the master, click the arrow next to the Open button, select an opening option from the drop-down list, and then click Open.

    If the stencil is already open, right-click the stencil title bar, and then click Edit Stencil on the shortcut menu.

  3. Right-click the master on the stencil, click Edit Master on the shortcut menu, and then click Edit Master Shape.

  4. In the master editing window, right-click the master and then click Show ShapeSheet.

Show a page

  1. Make sure nothing on the page is selected.

  2. Right-click the page and then click Show ShapeSheet.

Show a document

  1. On the Developer tab, in the Show/Hide group, select Drawing Explorer Window.

  2. In the Drawing Explorer, right-click the document, and then click Show ShapeSheet on the shortcut menu.

Show a style

  1. On the Developer tab, in the Show/Hide group, select Drawing Explorer Window.

  2. In the Drawing Explorer, expand the Styles folder.

  3. Right-click the style, and then click Show ShapeSheet on the shortcut menu.


Type a New Formula for a Cell

 Copy code hover
[image]

Type a New Formula for a Cell
Send feedback

Published: July 16, 2012

  1. Select the cell.

    The cell's formula appears in the cell and in the formula bar.

  2. Type the new formula.

    The formula you type replaces the cell's previous formula.

    If you type a number but don't supply units of measure, Microsoft Visio uses the units from the cell's previous value if there was one. Otherwise, if the cell requires units, Visio uses the default units for the cell.

  3. To accept the formula, press ENTER.

    If the number or formula contains an error, Visio displays a message and then highlights the error in the formula bar or cell. Correct the error, and press ENTER to accept the correction.


Reference (Visio 2013 ShapeSheet)

 Copy code hover
[image]

Reference (Visio 2013 ShapeSheet)
Send feedback

This part of the Visio 2013 ShapeSheet reference contains the following sections:

  • Cells

  • Functions

  • Rows

  • Sections


Cells (Visio 2013 ShapeSheet Reference)

 Copy code hover
[image]

Cells (Visio 2013 ShapeSheet Reference)
Send feedback

Published: July 16, 2012

In this section

  • A Cell (Geometry Section)

  • Action Cell (Actions Section)

  • Active Cell (Layers Section)

  • AddMarkup Cell (Document Properties Section)

  • Address Cell (Hyperlinks Section)

  • AlignBottom Cell (Alignment Section)

  • AlignCenter Cell (Alignment Section)

  • AlignLeft Cell (Alignment Section)

  • Alignment Cell (Tabs Section)

  • AlignMiddle Cell (Alignment Section)

  • AlignRight Cell (Alignment Section)

  • AlignTop Cell (Alignment Section)

  • Angle Cell (Shape Transform Section)

  • AsianFont Cell (Character Section)

  • Ask Cell (Shape Data Section)

  • AvenueSizeX Cell (Page Layout Section)

  • AvenueSizeY Cell (Page Layout Section)

  • AvoidPageBreaks Cell (Page Layout Section)

  • B Cell (Geometry Section)

  • BeginArrow Cell (Line Format Section)

  • BeginArrowSize Cell (Line Format Section)

  • BeginGroup Cell (Actions Section)

  • BeginX Cell (1-D Endpoints Section)

  • BeginY Cell (1-D Endpoints Section)

  • BegTrigger Cell (Glue Info Section)

  • BevelBottomHeight Cell (Bevel Properties Section)

  • BevelBottomType Cell (Bevel Properties Section)

  • BevelBottomWidth Cell (Bevel Properties Section)

  • BevelContourColor Cell (Bevel Properties Section)

  • BevelContourSize Cell (Bevel Properties Section)

  • BevelDepthColor Cell (Bevel Properties Section)

  • BevelDepthSize Cell (Bevel Properties Section)

  • BevelLightingAngle Cell (Bevel Properties Section)

  • BevelLightingType Cell (Bevel Properties Section)

  • BevelMaterialType Cell (Bevel Properties Section)

  • BevelTopHeight Cell (Bevel Properties Section)

  • BevelTopType Cell (Bevel Properties Section)

  • BevelTopWidth Cell (Bevel Properties Section)

  • BlockSizeX Cell (Page Layout Section)

  • BlockSizeY Cell (Page Layout Section)

  • Blur Cell (Image Properties Section)

  • BottomMargin Cell (Text Block Format Section)

  • Brightness Cell (Image Properties Section)

  • Bullet Cell (Paragraph Section)

  • BulletFont Cell (Paragraph Section)

  • BulletSize Cell (Paragraph Section)

  • BulletString Cell (Paragraph Section)

  • ButtonFace Cell (Action Tags Section)

  • ButtonFace Cell (Actions Section)

  • C Cell (Geometry Section)

  • Calendar Cell (Miscellaneous Section)

  • Calendar Cell (Shape Data Section)

  • Calendar Cell (Text Fields Section)

  • Can Glue Cell (Controls Section)

  • Case Cell (Character Section)

  • CenterX Cell (Print Properties Section)

  • CenterY Cell (Print Properties Section)

  • Checked Cell (Actions Section)

  • ClippingPath Cell (Foreign Image Info Section)

  • Color Cell (Character Section)

  • Color Cell (Layers Section)

  • Color Cell (Reviewer Section)

  • ColorSchemeIndex Cell (Theme Properties Section)

  • Comment Cell (Annotation Section)

  • Comment Cell (Miscellaneous Section)

  • ComplexScriptFont Cell (Character Section)

  • ComplexScriptSize Cell (Character Section)

  • CompoundType Cell (Line Format Section)

  • ConFixedCode Cell (Shape Layout Section)

  • ConLineJumpCode Cell (Shape Layout Section)

  • ConLineJumpDirX Cell (Shape Layout Section)

  • ConLineJumpDirY Cell (Shape Layout Section)

  • ConLineJumpStyle Cell (Shape Layout Section)

  • ConLineRouteExt Cell (Shape Layout Section)

  • ConnectorSchemeIndex Cell (Theme Properties Section)

  • Contrast Cell (Image Properties Section)

  • CtrlAsInput Cell (Page Layout Section)

  • D Cell (Connection Points Section)

  • D Cell (Geometry Section)

  • Date Cell (Annotation Section)

  • Default Cell (Hyperlinks Section)

  • DefaultTabstop Cell (Text Block Format Section)

  • Denoise Cell (Image Properties Section)

  • Description Cell (Action Tags Section)

  • Description Cell (Hyperlinks Section)

  • DirX / A Cell (Connection Points Section)

  • DirY / B Cell (Connection Points Section)

  • Disabled Cell (Action Tags Section)

  • Disabled Cell (Actions Section)

  • DisplayLevel Cell (Shape Layout Section)

  • DisplayMode Cell (Group Properties Section)

  • DisplayMode Cell (Action Tags Section)

  • DistanceFromGround Cell (3-D Rotation Properties)

  • DocLangID Cell (Document Properties Section)

  • DocLockDuplicatePage Cell (Document Properties Section)

  • DocLockReplace Cell (Document Properties Section)

  • DontMoveChildren Cell (Group Properties Section)

  • DoubleStrikethrough Cell (Character Section)

  • DoubleULine Cell (Character Section)

  • DrawingResizeType Cell (Page Properties Section)

  • DrawingScale Cell (Page Properties Section)

  • DrawingScaleType Cell (Page Properties Section)

  • DrawingSizeType Cell (Page Properties Section)

  • DropOnPageScale Cell (Miscellaneous Section)

  • DynamicsOff Cell (Page Layout Section)

  • DynFeedback Cell (Miscellaneous Section)

  • E Cell (Geometry Section)

  • EffectSchemeIndex Cell (Theme Properties Section)

  • EmbellishmentIndex Cell (Theme Properties Section)

  • EnableFillProps Cell (Style Properties Section)

  • EnableGrid Cell (Page Layout Section)

  • EnableLineProps Cell (Style Properties Section)

  • EnableTextProps Cell (Style Properties Section)

  • EndArrow Cell (Line Format Section)

  • EndArrowSize Cell (Line Format Section)

  • EndTrigger Cell (Glue Info Section)

  • EndX Cell (1-D Endpoints Section)

  • EndY Cell (1-D Endpoints Section)

  • EventDblClick Cell (Events Section)

  • EventDrop Cell (Events Section)

  • EventMultiDrop Cell (Events Section)

  • EventXFMod Cell (Events Section)

  • ExtraInfo Cell (Hyperlinks Section)

  • FillBkgnd Cell (Fill Format Section)

  • FillBkgndTrans Cell (Fill Format Section)

  • FillForegnd Cell (Fill Format Section)

  • FillForegndTrans Cell (Fill Format Section)

  • FillGradientAngle Cell (Gradient Properties Section)

  • FillGradientDir Cell (Gradient Properties Section)

  • FillGradientEnabled Cell (Gradient Properties Section)

  • FillPattern Cell (Fill Format Section)

  • Flags Cell (Paragraph Section)

  • FlipX Cell (Shape Transform Section)

  • FlipY Cell (Shape Transform Section)

  • FlyoutChild Cell (Actions Section)

  • Font Cell (Character Section)

  • FontSchemeIndex Cell (Theme Properties Section

  • Format Cell (Shape Data Section)

  • Format Cell (Text Fields Section)

  • Frame Cell (Hyperlinks Section)

  • Gamma Cell (Image Properties Section)

  • GlowColor Cell (Additional Effect Properties Section)

  • GlowColorTrans Cell (Additional Effect Properties Section)

  • GlowSize Cell (Additional Effect Properties Section)

  • Glue Cell (Layers Section)

  • GlueType Cell (Glue Info Section)

  • HAlign Cell (Paragraph Section)

  • Height Cell (Shape Transform Section)

  • HideForApply Cell (Style Properties Section)

  • HideText Cell (Miscellaneous Section)

  • ImgHeight Cell (Foreign Image Info Section)

  • ImgOffsetX Cell (Foreign Image Info Section)

  • ImgOffsetY Cell (Foreign Image Info Section)

  • ImgWidth Cell (Foreign Image Info Section)

  • IndFirst Cell (Paragraph Section)

  • IndLeft Cell (Paragraph Section)

  • IndRight Cell (Paragraph Section)

  • InhibitSnap Cell (Page Properties Section)

  • Initials Cell (Reviewer Section)

  • Invisible Cell (Actions Section)

  • Invisible Cell (Hyperlinks Section)

  • Invisible Cell (Shape Data Section)

  • IsDropSource Cell (Miscellaneous Section)

  • IsDropTarget Cell (Group Properties Section)

  • IsSnapTarget Cell (Group Properties Section)

  • IsTextEditTarget Cell (Group Properties Section)

  • KeepTextFlat Cell (3-D Rotation Properties Section)

  • Label Cell (Shape Data Section)

  • LangID Cell (Shape Data Section)

  • LangID Cell (Miscellaneous Section)

  • LangID Cell (Character Section)

  • LangID Cell (Annotation Section)

  • LeftMargin Cell (Text Block Format Section)

  • LineAdjustFrom Cell (Page Layout Section)

  • LineAdjustTo Cell (Page Layout Section)

  • LineCap Cell (Line Format Section)

  • LineColor Cell (Line Format Section)

  • LineColorTrans Cell (Line Format Section)

  • LineGradientAngle Cell (Gradient Properties Section)

  • LineGradientDir Cell (Gradient Properties Section)

  • LineGradientEnabled Cell (Gradient Properties Section)

  • LineJumpCode Cell (Page Layout Section)

  • LineJumpFactorX Cell (Page Layout Section)

  • LineJumpFactorY Cell (Page Layout Section)

  • LineJumpStyle Cell (Page Layout Section)

  • LinePattern Cell (Line Format Section)

  • LineRouteExt Cell (Page Layout Section)

  • LineToLineX Cell (Page Layout Section)

  • LineToLineY Cell (Page Layout Section)

  • LineToNodeX Cell (Page Layout Section)

  • LineToNodeY Cell (Page Layout Section)

  • LineWeight Cell (Line Format Section)

  • LocalizeMerge Cell (Miscellaneous Section)

  • Lock Cell (Layers Section)

  • LockAspect Cell (Protection Section)

  • LockBegin Cell (Protection Section)

  • LockCalcWH Cell (Protection Section)

  • LockCrop Cell (Protection Section)

  • LockCustProp Cell (Protection Section)

  • LockDelete Cell (Protection Section)

  • LockEnd Cell (Protection Section)

  • LockFormat Cell (Protection Section)

  • LockFromGroupFormat Cell (Protection Section)

  • LockGroup Cell (Protection Section)

  • LockHeight Cell (Protection Section)

  • LockMoveX Cell (Protection Section)

  • LockMoveY Cell (Protection Section)

  • LockPreview Cell (Document Properties Section)

  • LockReplace Cell (Protection Section)

  • LockRotate Cell (Protection Section)

  • LockSelect Cell (Protection Section)

  • LockTextEdit Cell (Protection Section)

  • LockThemeColors Cell (Protection Section)

  • LockThemeConnectors Cell (Protection Section)

  • LockThemeFonts Cell (Protection Section)

  • LockThemeIndex Cell (Protection Section)

  • LockThemeEffects Cell (Protection Section)

  • LockVariation Cell (Protection Section)

  • LockVtxEdit Cell (Protection Section)

  • LockWidth Cell (Protection Section)

  • LocPinX Cell (Shape Transform Section)

  • LocPinY Cell (Shape Transform Section)

  • Menu Cell (Actions Section)

  • Name Cell (Reviewer Section)

  • NewWindow Cell (Hyperlinks Section)

  • NoAlignBox Cell (Miscellaneous Section)

  • NoCoauth Cell (Document Properties Section)

  • NoCtlHandles Cell (Miscellaneous Section)

  • NoFill Cell (Geometry Section)

  • NoLine Cell (Geometry Section)

  • NoLiveDynamics Cell (Miscellaneous Section)

  • NonPrinting Cell (Miscellaneous Section)

  • NoObjHandles Cell (Miscellaneous Section)

  • NoProofing Cell (Miscellaneous Section)

  • NoQuickDrag Cell (Geometry Section)

  • NoShow Cell (Geometry Section)

  • NoSnap Cell (Geometry Section)

  • ObjectKind Cell (Text Fields Section)

  • ObjType Cell (Miscellaneous Section)

  • OnPage Cell (Print Properties Section)

  • OutputFormat Cell (Document Properties Section)

  • Overline Cell (Character Section)

  • PageBottomMargin Cell (Print Properties Section)

  • PageHeight Cell (Page Properties Section)

  • PageLeftMargin Cell (Print Properties Section)

  • PageLineJumpDirX Cell (Page Layout Section)

  • PageLineJumpDirY Cell (Page Layout Section)

  • PageLockDuplicate Cell (Page Properties Section)

  • PageLockReplace Cell (Page Properties Section)

  • PageRightMargin Cell (Print Properties Section)

  • PageScale Cell (Page Properties Section)

  • PageShapeSplit Cell (Page Layout Section)

  • PagesX Cell (Print Properties Section)

  • PagesY Cell (Print Properties Section)

  • PageTopMargin Cell (Print Properties Section)

  • PageWidth Cell (Page Properties Section)

  • PaperKind Cell (Print Properties Section)

  • PaperSource Cell (PrintProperties Section)

  • Perspective Cell (3-D Rotation Properties Section)

  • PinX Cell (Shape Transform Section)

  • PinY Cell (Shape Transform Section)

  • PlaceDepth Cell (Page Layout Section)

  • PlaceFlip Cell (Page Layout Section)

  • PlaceStyle Cell (Page Layout Section)

  • PlowCode Cell (Page Layout Section)

  • Pos Cell (Character Section)

  • Position Cell (Tabs Section)

  • PreviewQuality Cell (Document Properties Section)

  • PreviewScope Cell (Document Properties Section)

  • Print Cell (Layers Section)

  • PrintGrid Cell (Print Properties Section)

  • PrintPageOrientation Cell (Print Properties Section)

  • Prompt Cell (Actions Section)

  • Prompt Cell (Shape Data Section)

  • Prompt Cell (User-Defined Cells Section)

  • QuickStyleEffectsMatrix Cell (Quick Style Section)

  • QuickStyleFillColor Cell (Quick Style Section)

  • QuickStyleFillMatrix Cell (Quick Style Section)

  • QuickStyleFontColor Cell (Quick Style Section)

  • QuickStyleFontMatrix Cell (Quick Style Section)

  • QuickStyleLineColor Cell (Quick Style Section)

  • QuickStyleLineMatrix Cell (Quick Style Section)

  • QuickStyleShadowColor Cell (Quick Style Section)

  • QuickStyleType Cell (Quick Style Section)

  • QuickStyleVariation Cell (Quick Style Section)

  • ReadOnly Cell (Actions Section)

  • ReflectionBlur Cell (Additional Effect Properties Section)

  • ReflectionDist Cell (Additional Effect Properties Section)

  • ReflectionSize Cell (Additional Effect Properties Section)

  • ReflectionTrans Cell (Additional Effect Properties Section)

  • Relationships Cell (Shape Layout Section)

  • ReplaceCopyCells Cell (Change Shape Behavior Section)

  • ReplaceLockFormat Cell (Change Shape Behavior Section)

  • ReplaceLockShapeData Cell (Change Shape Behavior Section)

  • ReplaceLockText Cell (Change Shape Behavior Section)

  • ResizeMode Cell (Shape Transform Section)

  • ResizePage Cell (Page Layout Section)

  • RightMargin Cell (Text Block Format Section)

  • RotateGradientWithShape Cell (Gradient Properties Section)

  • RotationType Cell (3-D Rotation Properties Section)

  • RotationXAngle Cell (3-D Rotation Properties Section)

  • RotationYAngle Cell (3-D Rotation Properties Section)

  • RotationZAngle Cell (3-D Rotation Properties Section)

  • Rounding Cell (Line Format Section)

  • RouteStyle Cell (Page Layout Section)

  • Scale Cell (Character Section)

  • ScaleX Cell (Print Properties Section)

  • ScaleY Cell (Print Properties Section)

  • SelectMode Cell (Group Properties Section)

  • ShapeFixedCode Cell (Shape Layout Section)

  • ShapePermeablePlace Cell (Shape Layout Section)

  • ShapePermeableX Cell (Shape Layout Section)

  • ShapePermeableY Cell (Shape Layout Section)

  • ShapePlaceFlip Cell (Shape Layout Section)

  • ShapePlaceStyle Cell (Shape Layout Section)

  • ShapePlowCode Cell (Shape Layout Section)

  • ShapeRouteStyle Cell (Shape Layout Section)

  • ShapeShdwBlur Cell (Fill Format Section)

  • ShapeShdwObliqueAngle Cell (Fill Format Section)

  • ShapeShdwOffsetX Cell (Fill Format Section)

  • ShapeShdwOffsetY Cell (Fill Format Section)

  • ShapeShdwScaleFactor Cell (Fill Format Section)

  • ShapeShdwShow Cell (Fill Format Section)

  • ShapeShdwType Cell (Fill Format Section)

  • ShapeSplit Cell (Shape Layout Section)

  • ShapeSplittable Cell (Shape Layout Section)

  • Sharpen Cell (Image Properties Section)

  • ShdwForegnd Cell (Fill Format Section)

  • ShdwForegndTrans Cell (Fill Format Section)

  • ShdwObliqueAngle Cell (Page Properties Section)

  • ShdwOffsetX Cell (Page Properties Section)

  • ShdwOffsetY Cell (Page Properties Section)

  • ShdwPattern Cell (Fill Format Section)

  • ShdwScaleFactor Cell (Page Properties Section)

  • ShdwType Cell (Page Properties Section)

  • Size Cell (Character Section)

  • SketchAmount Cell (Additional Effect Properties Section)

  • SketchEnabled Cell (Additional Effect Properties Section)

  • SketchFillChange Cell (Additional Effect Properties Section)

  • SketchLineChange Cell (Additional Effect Properties Section)

  • SketchLineWeight Cell (Additional Effect Properties Section)

  • SketchSeed Cell (Additional Effect Properties Section)

  • Snap Cell (Layers Section)

  • SoftEdgesSize Cell (Additional Effect Properties Section)

  • SortKey Cell (Actions Section)

  • SortKey Cell (Hyperlinks Section)

  • SortKey Cell (Shape Data Section)

  • Spacing Cell (Character Section)

  • SpAfter Cell (Paragraph Section)

  • SpBefore Cell (Paragraph Section)

  • SpLine Cell (Paragraph Section)

  • Strikethru Cell (Character Section)

  • Style Cell (Character Section)

  • SubAddress Cell (Hyperlinks Section)

  • TagName Cell (Action Tags Section)

  • TagName Cell (Actions Section)

  • TextBkgnd Cell (Text Block Format Section)

  • TextBkgndTrans Cell (Text Block Format Section)

  • TextDirection Cell (Text Block Format Section)

  • TextPosAfterBullet Cell (Paragraph Section)

  • TheData Cell (Events Section)

  • ThemeIndex Cell (Theme Properties Section)

  • TheText Cell (Events Section)

  • Tip Cell (Controls Section)

  • TopMargin Cell (Text Block Format Section)

  • Transparency Cell (Character Section)

  • Transparency Cell (Image Properties Section)

  • Transparency Cell (Layers Section)

  • TxtAngle Cell (Text Transform Section)

  • TxtHeight Cell (Text Transform Section)

  • TxtLocPinX Cell (Text Transform Section)

  • TxtLocPinY Cell (Text Transform Section)

  • TxtPinX Cell (Text Transform Section)

  • TxtPinY Cell (Text Transform Section)

  • TxtWidth Cell (Text Transform Section)

  • Type / C Cell (Connection Points Section)

  • Type Cell (Shape Data Section)

  • Type Cell (Text Fields Section)

  • UICategory Cell (Text Fields Section)

  • UICode Cell (Text Fields Section)

  • UIFormat Cell (Text Fields Section)

  • UIVisibility Cell (Page Properties Section)

  • UpdateAlignBox Cell (Miscellaneous Section)

  • UseGroupGradient Cell (Gradient Properties Section)

  • Value Cell (Shape Data Section)

  • Value Cell (Text Fields Section)

  • Value Cell (User-Defined Cells Section)

  • VariationColorIndex Cell (Theme Properties Section)

  • VariationStyleIndex Cell (Theme Properties Section)

  • VerticalAlign Cell (Text Block Format Section)

  • ViewMarkup Cell (Document Properties Section)

  • Visible Cell (Layers Section)

  • WalkPreference Cell (Glue Info Section)

  • Width Cell (Shape Transform Section)

  • X Behavior Cell (Controls Section)

  • X Cell (Action Tags Section)

  • X Cell (Annotation Section)

  • X Cell (Connection Points Section)

  • X Cell (Controls Section)

  • X Cell (Geometry Section)

  • X Dynamics Cell (Controls Section)

  • X Justify Cell (Action Tags Section)

  • XGridDensity Cell (Ruler & Grid Section)

  • XGridOrigin Cell (Ruler & Grid Section)

  • XGridSpacing Cell (Ruler & Grid Section)

  • XRulerDensity Cell (Ruler & Grid Section)

  • XRulerOrigin Cell (Ruler & Grid Section)

  • Y Behavior Cell (Controls Section)

  • Y Cell (Action Tags Section)

  • Y Cell (Annotation Section)

  • Y Cell (Connection Points Section)

  • Y Cell (Controls Section)

  • Y Cell (Geometry Section)

  • Y Dynamics Cell (Controls Section)

  • Y Justify Cell (Action Tags Section)

  • YGridDensity Cell (Ruler & Grid Section)

  • YGridOrigin Cell (Ruler & Grid Section)

  • YGridSpacing Cell (Ruler & Grid Section)

  • YRulerDensity Cell (Ruler & Grid Section)

  • YRulerOrigin Cell (Ruler & Grid Section)


A Cell (Geometry Section)

 Copy code hover
[image]

A Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Represents different information in different rows. This table describes the A cell based on the row in which it's located.

Row | Description
ArcTo | The distance from the arc's midpoint to the midpoint of its chord.
EllipticalArcTo | The x-coordinate of the arc's control point, a point on the arc. The control point is best located about halfway between the beginning and ending vertices of the arc. Otherwise, the arc may grow to an extreme size in order to pass through the control point, with unpredictable results.
PolylineTo | The polyline formula.
NURBSTo | The second to the last knot of the nonuniform rational B-spline (NURBS).
SplineStart | The second knot of the spline.
SplineKnot | One of the spline's knots (other than the last one or the first two).
InfiniteLine | An x-coordinate of a point on the infinite line; paired with y-coordinate represented by the B cell.
Ellipse | An x-coordinate of a point on the ellipse; paired with y-coordinate represented by the B cell.

Remarks

To get a reference to the A cell by name from another formula, or from a program, using the CellsU property, use:

Cell name: | Geometryi.Aj where i and j = <1>, 2, 3...
 | Geometryi.A1 (InfiniteLine and Ellipse rows) where i = <1>, 2, 3...

To get a reference to the A cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowVertex + j where j = 0, 1, 2...
 | visRowVertex (InfiniteLine and Ellipse rows)
Cell index: | visBow (ArcTo row)
 | visControlX (EllipticalArcTo row)
 | visControlY (EllipticalArcTo row)
 | visPolylineData (Polyline row)
 | visNURBSKnot (NURBSTo row)
 | visSplineKnot (SplineStart and SplineKnot rows)
 | visInfiniteLineX2 (InfiniteLine row)
 | visEllipseMajorX (Ellipse row)


Action Cell (Actions Section)

 Copy code hover
[image]

Action Cell (Actions Section)
Send feedback

Published: July 16, 2012

Contains the formula to be executed when a user chooses a command on a shortcut or action tag menu.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

An Action cell is evaluated only when the action occurs, not when the formula is entered.

To get a reference to the the Action cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Actions.name.Action
where Actions.name is the name of the actions row

To get a reference to thethe Action cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2...
Cell index: | visActionAction


Active Cell (Layers Section)

 Copy code hover
[image]

Active Cell (Layers Section)
Send feedback

Published: July 16, 2012

Specifies whether the layer is active. Shapes without pre-assigned layers are assigned to the active layer(s) when you drag them onto the drawing page.

Value | Description
TRUE | Layer is active.
FALSE | Layer is not active.

Remarks

The value in this cell corresponds to the Active setting in the Layer Properties dialog box (in the Editing group on the Home tab, click Layers, and then click Layer Properties).

To get a reference to the Active cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Layers.Active[i]
where i = <1>, 2, 3...

To get a reference to the Active cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionLayer
Row index: | visRowLayer + i where i = 0, 1, 2...
Cell index: | visLayerActive


AddMarkup Cell (Document Properties Section)

 Copy code hover
[image]

AddMarkup Cell (Document Properties Section)
Send feedback

Published: July 16, 2012

Indicates whether the document is being reviewed for markup.

Value | Description
TRUE | Document is being reviewed.
FALSE | Document is not being reviewed (the default).

Remarks

When the AddMarkup cell is set to TRUE, the reviewer is adding markup and changes are applied to markup overlay pages, not to original drawing pages. When the AddMarkup cell is FALSE, markup tracking is off and changes are applied to the original drawing pages.

Note Note

You can prevent markup on your documents by using the GUARD function. If the AddMarkup cell contains the formula =GUARD(FALSE), the Track Markup command is disabled.

This setting corresponds to the Track Markup command setting in the Markup group on the Review tab.

To get a reference to the AddMarkup cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

AddMarkup

To get a reference to the AddMarkup cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowDoc
Cell index: | visDocAddMarkup


Address Cell (Hyperlinks Section)

 Copy code hover
[image]

Address Cell (Hyperlinks Section)
Send feedback

Published: July 16, 2012

Specifies a URL address, file name, or UNC path to which to jump.

You can specify Address as a relative path based on the base path defined for the document in the Hyperlink base box on the Summary tab of the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties). If the document has no base path, the application navigates based on the document path. If the document has not been saved, the hyperlink is undefined.

Remarks

You can also set the value of the Address cell in the Hyperlinks dialog box (click Hyperlink on the Insert tab).

To get a reference to the Address cell by index from a program, use the CellsSRC property with the following arguments:

Cell name:

Hyperlink.name.Address
where Hyperlink.name is the name of the hyperlink row

To get a reference to the Address cell by name from another formula, or from a program, by using the CellsU property, use:

Section index: | visSectionHyperlink
Row index: | visRow1stHyperlink + i where i = 0, 1, 2...
Cell index: | visHLinkAddress


AlignBottom Cell (Alignment Section)

 Copy code hover
[image]

AlignBottom Cell (Alignment Section)
Send feedback

Published: July 16, 2012

Determines the vertical position, relative to the origin of its parent, of a horizontal guide or guide point to which the shape's bottom border is aligned.

Remarks

To get a reference to the AlignBottom cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

AlignBottom

To get a reference to the AlignBottom cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowAlign
Cell index: | visAlignBottom


AlignCenter Cell (Alignment Section)

 Copy code hover
[image]

AlignCenter Cell (Alignment Section)
Send feedback

Published: July 16, 2012

Determines the horizontal position, relative to the origin of its parent, of a vertical guide or guide point to which the shape's horizontal center is aligned.

Remarks

To get a reference to the AlignCenter cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

AlignCenter

To get a reference to the AlignCenter cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowAlign
Cell index: | visAlignCenter


AlignLeft Cell (Alignment Section)

 Copy code hover
[image]

AlignLeft Cell (Alignment Section)
Send feedback

Published: July 16, 2012

Determines the horizontal position, relative to the origin of its parent, of a vertical guide or guide point to which the shape's left border is aligned.

Remarks

To get a reference to the AlignLeft cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

AlignLeft

To get a reference to the AlignLeft cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowAlign
Cell index: | visAlignLeft


Alignment Cell (Tabs Section)

 Copy code hover
[image]

Alignment Cell (Tabs Section)
Send feedback

Published: July 16, 2012

Specifies the tab alignment.

Value | Alignment | Automation constant
0 | Left | visTabStopLeft
1 | Center | visTabStopCenter
2 | Right | visTabStopRight
3 | Decimal | visTabStopDecimal
4 | Comma | visTabStopComma

Remarks

To get a reference to the Alignment cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Tabs.ij
where i and j = <1>, 2, 3

To get a reference to the Alignment cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionTab
Row index: | visRowTab + i where i = 0, 1, 2...
Cell index: | (j*3) + visTabAlign


AlignMiddle Cell (Alignment Section)

 Copy code hover
[image]

AlignMiddle Cell (Alignment Section)
Send feedback

Published: July 16, 2012

Determines the vertical position, relative to the origin of its parent, of a horizontal guide or guide point to which the shape's vertical center is aligned.

Remarks

To get a reference to the AlignMiddle cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

AlignMiddle

To get a reference to the AlignMiddle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowAlign
Cell index: | visAlignMiddle


AlignRight Cell (Alignment Section)

 Copy code hover
[image]

AlignRight Cell (Alignment Section)
Send feedback

Published: July 16, 2012

Determines the horizontal position, relative to the origin of its parent, of a vertical guide or guide point to which the shape's right border is aligned.

Remarks

To get a reference to the AlignRight cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

AlignRight

To get a reference to the AlignRight cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowAlign
Cell index: | visAlignRight


AlignTop Cell (Alignment Section)

 Copy code hover
[image]

AlignTop Cell (Alignment Section)
Send feedback

Published: July 16, 2012

Determines the vertical position, relative to the origin of its parent, of a horizontal guide or guide point to which the shape's top border is aligned.

Remarks

To get a reference to the AlignTop cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

AlignTop

To get a reference to the AlignTop cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowAlign
Cell index: | visAlignTop


Angle Cell (Shape Transform Section)

 Copy code hover
[image]

Angle Cell (Shape Transform Section)
Send feedback

Published: July 16, 2012

Represents the shape's current angle of rotation in relation to its parent. The default formula for determining the rotation angle of a 1-D shape is: =ATAN2(EndY-BeginY,EndX-BeginX).

Remarks

To get a reference to the Angle cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Angle

To get a reference to the Angle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXFormOut
Cell index: | visXFormAngle


AsianFont Cell (Character Section)

 Copy code hover
[image]

AsianFont Cell (Character Section)
Send feedback

Published: July 16, 2012

Contains the number of the font used to format the text containing Asian characters. Font numbers vary according to the fonts installed on your system.

Remarks

Asian fonts are listed on the Font tab in the Text dialog box (click the arrow in the Font group on the Home tab). This list appears only if you have added a language that contains Asian or complex script characters, in the Microsoft Office Language Preferences dialog box. (Click Start, click All Programs, click Microsoft Office, click Microsoft Office Tools, and then click Microsoft Office Language Preferences.

The number 0 means no font is specified. The Latin font or default fonts are used if they contain the necessary characters.

To get a reference to the AsianFont cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Char.AsianFont[i]
where i = <1>, 2, 3...

To get a reference to the AsianFont cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterAsianFont


Ask Cell (Shape Data Section)

 Copy code hover
[image]

Ask Cell (Shape Data Section)
Send feedback

Published: July 16, 2012

Determines whether a user is queried to enter shape data for a shape when an instance is created or the shape is duplicated or copied.

Value | Description
TRUE | Ask user to enter shape data in the Define Shape Data dialog box.
FALSE | Do not ask user to enter data.

Remarks

The value in this cell corresponds to the Ask on drop check box in the Define Shape Data dialog box (right-click the shape, point to Data, and then click Define Shape Data).

To get a reference to the Ask cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Prop.name.Ask
where Prop.name is the name of the custom property row

To get a reference to the Ask cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionProp
Row index: | visRowProp + i where i = 0, 1, 2,...
Cell index: | visCustPropsAsk


AvenueSizeX Cell (Page Layout Section)

 Copy code hover
[image]

AvenueSizeX Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the amount of horizontal space between shapes on the drawing page when you lay out shapes by using the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options).

Remarks

You can also set this value in the Layout and Routing Spacing dialog box (on the Design tab, click the arrow in the Page Setup group, click the Layout and Routing tab, and then click Spacing).

The dynamic grid uses the setting in the AvenueSizeX cell when only one shape is available for calculating horizontal spacing. To use the dynamic grid, on the View tab, in the Visual Aids group, select Dynamic Grid.

To get a reference to the AvenueSizeX cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

AvenueSizeY

To get a reference to the AvenueSizeX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOAvenueSizeX


AvenueSizeY Cell (Page Layout Section)

 Copy code hover
[image]

AvenueSizeY Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the amount of vertical space between shapes on the drawing page when you lay out shapes by using the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options).

Remarks

You can also set this value in the Layout and Routing Spacing dialog box (on the Design tab, click the arrow in the Page Setup group, click the Layout and Routing tab, and then click Spacing).

The dynamic grid uses the setting in the AvenueSizeY cell when only one shape is available for calculating vertical spacing. To use the dynamic grid, on the View tab, in the Visual Aids group, select Dynamic Grid.

To get a reference to the AvenueSizeY cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

AvenueSizeY

To get a reference to the AvenueSizeY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOAvenueSizeY


AvoidPageBreaks Cell (Page Layout Section)

 Copy code hover
[image]

AvoidPageBreaks Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines whether shapes can be placed over page breaks when the shapes are incrementally aligned, incrementally spaced, or both.

Remarks

To get a reference to the AvoidPageBreaks cell by name from another formula, or from a program by using the CellsU property, use the following.

Cell name:

AvoidPageBreaks

To get a reference to the AvoidPageBreaks cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOAvoidPageBreaks


B Cell (Geometry Section)

 Copy code hover
[image]

B Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Represents different information in different rows. This table describes the B cell based on the row in which it's located.

Row | Description
EllipticalArcTo | The y-coordinate of an arc's control point.
NURBSTo | The last weight of the nonuniform rational B-spline (NURBS).
SplineStart | The first knot of a spline.
InfiniteLine | A y-coordinate of a point on an infinite line; paired with x-coordinate represented by the A cell.
Ellipse | A y-coordinate of a point on an ellipse; paired with x-coordinate represented by the A cell.

Remarks

To get a reference to the B cell by name from another formula, or from a program, using the CellsU property, use:

Cell name: | Geometryi.Bj where i and j = <1>, 2, 3...
 | Geometryi.B1 (InfiniteLine and Ellipse rows)

To get a reference to the B cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowVertex + j where j = 0, 1, 2...
 | visRowVertex (InfiniteLine and Ellipse rows)
Cell index: | visControlX (EllipticalArcTo row)
 | visControlY (EllipticalArcTo row)
 | visNURBSWeight (NURBSTo row)
 | visSplineKnot2 (SplineStart row)
 | visInfiniteLineY2 (InfiniteLine row)
 | visEllipseMajorY (Ellipse row)


BeginArrow Cell (Line Format Section)

 Copy code hover
[image]

BeginArrow Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Indicates whether a line has an arrowhead or other line end format at its first vertex. Enter a number from 0 to 45 or the USE function with the name of a custom line end, or use the Line dialog box.

Value | Description
0 | No arrowhead.
1 - 45 | Assorted arrowhead styles that correspond to indexed entries in the Line dialog box.

Remarks

The size of the arrowhead is set in the BeginArrowSize cell.

To get a reference to the BeginArrow cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

BeginArrow

To get a reference to the BeginArrow cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visLineBeginArrow


BeginArrowSize Cell (Line Format Section)

 Copy code hover
[image]

BeginArrowSize Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Determines the size of the arrowhead at the beginning of the line.

Value | Size | Automation constant
0 | Very small | visArrowSizeVerySmall
1 | Small | visArrowSizeSmall
2 | Medium | visArrowSizeMedium
3 | Large | visArrowSizeLarge
4 | Very large | visArrowSizeVeryLarge
5 | Jumbo | visArrowSizeJumbo
6 | Colossal | visArrowSizeColossal

Remarks

You can also set the size of the arrowhead in the Line dialog box.

To get a reference to the BeginArrowSize cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

BeginArrowSize

To get a reference to the BeginArrowSize cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visLineBeginArrowSize


BeginGroup Cell (Actions Section)

 Copy code hover
[image]

BeginGroup Cell (Actions Section)
Send feedback

Published: July 16, 2012

Indicates whether a separator is inserted into the menu above this action.

Note Note

Value | Description
TRUE | A separator is inserted into the menu above this action.
FALSE | A separator is not inserted into the menu above this action (the default).

Remarks

To get a reference to the BeginGroup cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Actions. name .BeginGroup
where Actions. name is the name of the Actions row

To get a reference to the BeginGroup cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2...
Cell index: | visActionBeginGroup


BeginX Cell (1-D Endpoints Section)

 Copy code hover
[image]

BeginX Cell (1-D Endpoints Section)
Send feedback

Published: July 16, 2012

Represents the x-coordinate of the begin point of the 1-D shape, in relation to the origin of its parent.

Remarks

To get a reference to the BeginX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

BeginX

To get a reference to the BeginX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXForm1D
Cell index: | vis1DBeginX


BeginY Cell (1-D Endpoints Section)

 Copy code hover
[image]

BeginY Cell (1-D Endpoints Section)
Send feedback

Published: July 16, 2012

Represents the y-coordinate of the begin point of the 1-D shape, in relation to the origin of its parent.

Remarks

To get a reference to the BeginY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

BeginY

To get a reference to the BeginY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXForm1D
Cell index: | vis1DBeginY


BegTrigger Cell (Glue Info Section)

 Copy code hover
[image]

BegTrigger Cell (Glue Info Section)
Send feedback

Published: July 16, 2012

Contains a trigger formula generated by the application that determines whether to move the begin point of a 1-D shape to maintain its connection to another shape.

Remarks

When you glue a 1-D shape to another shape using dynamic glue, the application generates a formula that refers to the EventXFMod cell of the other shape. When that shape is changed, Visio recalculates any formula that refers to its EventXFMod cell, including the formula in the BegTrigger cell. Other formulas for the 1-D shape refer to the BegTrigger cell and move the begin point of the 1-D shape or alter the shape as needed.

To get a reference to the BegTrigger cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

BegTrigger

To get a reference to the BegTrigger cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGroup
Cell index: | visBegTrigger


BevelBottomHeight Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelBottomHeight Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the height of a shape's bottom bevel in points.

Remarks

To get a reference to the BevelBottomHeight cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelBottomHeight

To get a reference to the BevelBottomHeight cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelBottomHeight


BevelBottomType Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelBottomType Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Specifies the bottom bevel type of a shape's bevel.

Value | Description
0 | No bevel
1 | Circle bevel
2 | Relaxed Inset bevel
3 | Cross bevel
4 | Cool Slant bevel
5 | Angle bevel
6 | Soft Round bevel
7 | Convex bevel
8 | Slope bevel
9 | Divot bevel
10 | Riblet bevel
11 | Hard Edge bevel
12 | Art Deco bevel

Remarks

To get a reference to the BevelBottomType cell by name from another formula, by value of the N attribute of a Cell element in the .vsdx file format, or from a program using the CellsU property, use:

Cell name:

BevelBottomType

To get a reference to the BevelBottomType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelBottomType


BevelBottomWidth Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelBottomWidth Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the width of the bottom bevel in points.

Remarks

To get a reference to the BevelBottomWidth cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelBottomWidth

To get a reference to the BevelBottomWidth cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelBottomWidth


BevelContourColor Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelContourColor Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the color of the bevel's contour in RGB value or as determined by the active theme.

Remarks

To get a reference to the BevelContourColor cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelContourColor

To get a reference to the BevelContourColor cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | vis BevelContourColor


BevelContourSize Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelContourSize Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the size of the bevel's contour in points.

Remarks

To get a reference to the BevelContourSize cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelContourSize

To get a reference to the BevelContourSize cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelContourSize


BevelDepthColor Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelDepthColor Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the color of the bevel's depth, as an RGB value or as determined by the active theme.

Remarks

To get a reference to the BevelDepthColor cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelDepthColor

To get a reference to the BevelDepthColor cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelDepthColor


BevelDepthSize Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelDepthSize Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the size of the bevel's depth in points.

Remarks

To get a reference to the BevelDepthSize cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelDepthSize

To get a reference to the BevelDepthSize cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelDepthSize


BevelLightingAngle Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelLightingAngle Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the angle of lightning in relation to the bevel in degrees.

Remarks

To get a reference to the BevelLightingAngle cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelLightingAngle

To get a reference to the BevelLightingAngle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelLightingAngle


BevelLightingType Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelLightingType Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the type of lighting used by the bevel effect.

Value | Description
0 | No lighting
1 | Three Point
2 | Balance
3 | Soft
4 | Harsh
5 | Flood
6 | Contrasting
7 | Morning
8 | Sunrise
9 | Sunset
10 | Chilly
11 | Freezing
12 | Flat
13 | Two Point
14 | Glow
15 | Bright Room

Remarks

To get a reference to the BevelAngleType cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelAngleType

To get a reference to the BevelAngleType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelAngleType


BevelMaterialType Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelMaterialType Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the type of material the bevel is composed of.

Description | Value
0 | No special material
1 | Matte
2 | Warm Matte
3 | Plastic
4 | Metal
5 | Dark Edge
6 | Soft Edge
7 | Flat
8 | Wireframe
9 | Powder
10 | Translucent Powder
11 | Clear

Remarks

To get a reference to the BevelMaterialType cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelMaterialType

To get a reference to the BevelMaterialType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelMaterialType


BevelTopHeight Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelTopHeight Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the height of a shape's top bevel in points.

Remarks

To get a reference to the BevelTopHeight cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelTopHeight

To get a reference to the BevelTopHeight cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelTopHeight


BevelTopType Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelTopType Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the type of bevel on a shape's top edge.

Value | Description
0 | No bevel
1 | Circle bevel
2 | Relaxed Inset bevel
3 | Cross bevel
4 | Cool Slant bevel
5 | Angle bevel
6 | Soft Round bevel
7 | Convex bevel
8 | Slope bevel
9 | Divot bevel
10 | Riblet bevel
11 | Hard Edge bevel
12 | Art Deco bevel

Remarks

To get a reference to the BevelTopType cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelTopType

To get a reference to the BevelTopType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | BevelTopType


BevelTopWidth Cell (Bevel Properties Section)

 Copy code hover
[image]

BevelTopWidth Cell (Bevel Properties Section)
Send feedback

Published: July 16, 2012

Determines the width of the top bevel in points.

Remarks

To get a reference to the BevelTopWidth cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

BevelTopWidth

To get a reference to the BevelTopWidth cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowBevelProperties
Cell index: | visBevelTopWidth


BlockSizeX Cell (Page Layout Section)

 Copy code hover
[image]

BlockSizeX Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the horizontal block size, the area in which each of your shapes must fit on the drawing page when you lay out shapes by using the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options).

Remarks

You can also set this value in the Layout and Routing Spacing dialog box (on the Design tab, click the arrow in the Page Setup group, click the Layout and Routing tab, and then click Spacing).

To get a reference to the BlockSizeX cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

BlockSizeX

To get a reference to the BlockSizeX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOBlockSizeX


BlockSizeY Cell (Page Layout Section)

 Copy code hover
[image]

BlockSizeY Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the vertical block size, the area in which each of your shapes must fit on the drawing page when you lay out shapes by using the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options).

Remarks

You can also set this value in the Layout and Routing Spacing dialog box (on the Design tab, click the arrow in the Page Setup group, click the Layout and Routing tab, and then click Spacing).

To get a reference to the BlockSizeY cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

BlockSizeY

To get a reference to the BlockSizeY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOBlockSizeY


Blur Cell (Image Properties Section)

 Copy code hover
[image]

Blur Cell (Image Properties Section)
Send feedback

Published: July 16, 2012

Blurs or softens a bitmap image. The default value is 0%.

Remarks

To get a reference to the Blur cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Blur

To get a reference to the Blur cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowImage
Cell index: | visImageBlur


BottomMargin Cell (Text Block Format Section)

 Copy code hover
[image]

BottomMargin Cell (Text Block Format Section)
Send feedback

Published: July 16, 2012

Determines the distance between the bottom border of the text block and the last line of text it contains. The default is 0.1 inch. This value is independent of the scale of the drawing. If the drawing is scaled, the bottom margin remains the same.

Remarks

To get a reference to the BottomMargin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

BottomMargin

To get a reference to the BottomMargin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowText
Cell index: | visTxtBlkBottomMargin


Brightness Cell (Image Properties Section)

 Copy code hover
[image]

Brightness Cell (Image Properties Section)
Send feedback

Published: July 16, 2012

Adjusts the brightness of a bitmap image. Decrease brightness of an image by entering a value between 0% and 49%, or increase brightness by entering a value between 51% and 100%. The default value is 50%.

Remarks

To get a reference to the Brightness cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Brightness

To get a reference to the Brightness cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowImage
Cell index: | visImageBrightness


Bullet Cell (Paragraph Section)

 Copy code hover
[image]

Bullet Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Determines the bullet style.

Value | Bullet style
0 | None
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2, ...
Cell index: | visBulletIndex

Remarks

You can also set the value of this cell by right-clicking a shape, pointing to Format, clicking Text, and then clicking the Bullets tab.

To get a reference to the Bullet cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Para.Bullet[i]
where i = <1>, 2, 3, ...

To get a reference to the Bullet cell by index from a program, use the CellsSRC property with the following arguments:


BulletFont Cell (Paragraph Section)

 Copy code hover
[image]

BulletFont Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Represents the number of the font used to format the text when a custom bullet string is specified and the value in the Bullet cell is non-zero.

Remarks

Font numbers vary according to the fonts installed on your system. If the value is 0 and there is a custom bullet string, the font used is the same as the font of the first character of the paragraph.

To get a reference to the BulletFont cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para.BulletFont[i]
where i = <1>, 2, 3...

To get a reference to the BulletFont cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visBulletFont


BulletSize Cell (Paragraph Section)

 Copy code hover
[image]

BulletSize Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Specifies the size of a bullet.

Remarks

This value can be specified for either predefined or custom bullets, as either a percentage or a specific value.

If the value is zero (0), the bullet is the same font size as that of the first character in the paragraph. If the value is a percentage, the bullet is sized as a percentage of the font size of the first character in the paragraph. Negative numbers are treated as percentages.

To get a reference to the BulletSize cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para.BulletFontSize[i]
where i = <1>, 2, 3...

To get a reference to the BulletSize cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visBulletFontSize


BulletString Cell (Paragraph Section)

 Copy code hover
[image]

BulletString Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Allows you to create a custom bullet style.

Remarks

Enter the style as a string (within quotation marks). For example, you could enter the string, "ooo."

You can also set the value of this cell by right-clicking a shape, pointing to Format, clicking Text, and then clicking the Bullets tab.

To get a reference to the BulletString cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Para.BulletStr[i]
where i = <1>, 2, 3, ...

To get a reference to the BulletString cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2, ...
Cell index: | visBulletString


ButtonFace Cell (Action Tags Section)

 Copy code hover
[image]

ButtonFace Cell (Action Tags Section)
Send feedback

Published: July 16, 2012

Contains the ID of the button face image that appears on the action tag button.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

The string contained in the ButtonFace cell represents the ID of a Microsoft Office button face image. A value of 0 (zero) or blank defaults to the standard action tag "i" info button [image].

The IDs that can be used in the ButtonFace cell are the same as the IDs used with the FaceID property of a CommandBarButton object. For more details about these IDs, search for "working with command bar button images" on MSDN.

To get a reference to the ButtonFace cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

SmartTags.name.ButtonFace
where SmartTags.name is the name of the action tag row

To get a reference to the ButtonFace cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionSmartTag
Row index: | visRowSmartTag + i where i = 0, 1, 2...
Cell index: | visSmartTagButtonFace


ButtonFace Cell (Actions Section)

 Copy code hover
[image]

ButtonFace Cell (Actions Section)
Send feedback

Published: July 16, 2012

Identifies the icon that appears next to an item on a shortcut or action tag menu.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

The string contained in the ButtonFace cell represents the ID of a Microsoft Office button face image. A value of zero (0) or blank means no icon appears.

The IDs that can be used in the ButtonFace cell are the same as the IDs used with the FaceID property of a CommandBarButton object. For more details about these IDs, search for "working with command bar button images" on MSDN.

To get a reference to the ButtonFace cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Actions.name.ButtonFace
where Actions.name is the name of the actions row

To get a reference to the ButtonFace cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2...
Cell index: | visActionButtonFace


C Cell (Geometry Section)

 Copy code hover
[image]

C Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Represents different information in different rows. This table describes the C cell based on the row in which it's located.

Row | Description
EllipticalArcTo | The angle of an arc's major axis relative to the x-axis of its parent.
NURBSTo | The first knot of the nonuniform rational B-spline (NURBS).
SplineStart | The last knot of a spline.
Ellipse | An x-coordinate of a point on an ellipse; paired with the y-coordinate represented by the D cell.

Remarks

To get a reference to the C cell by name from another formula, or from a program using the CellsU property, use:

Cell name: | Geometryi.Cj where i and j = <1>, 2, 3...
 | Geometryi.C1 (Ellipse row)

To get a reference to the C cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowVertex + j where j = 0, 1, 2...
 | visRowVertex (Ellipse row)
Cell index: | visEccentricityAngle (EllipticalArcTo row)
 | visNURBSKnotPrev (NURBSTo row)
 | visSplineKnot3 (SplineStart row)
 | visEllipseMinorX (Ellipse row)


Calendar Cell (Miscellaneous Section)

 Copy code hover
[image]

Calendar Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Determines the calendar that is used when a cell formula contains Date information.

Remarks

The possible values are: 0 (Western), 1 (Arabic Hijri), 2 (Hebrew Lunar), 3 (Taiwan Calendar), 4 (Japanese Emperor Reign), 5 (Thai Buddhist), 6 (Korean Danki), 7 (Saka Era), 8 (English transliterated), and 9 (French transliterated ).

To get a reference to the Calendar cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Calendar

To get a reference to the Calendar cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visObjCalendar


Calendar Cell (Shape Data Section)

 Copy code hover
[image]

Calendar Cell (Shape Data Section)
Send feedback

Published: July 16, 2012

Determines the calendar that is used for shape data when the data type is Date.

Remarks

The possible values are: 0 (Western), 1 (Arabic Hijri), 2 (Hebrew Lunar), 3 (Taiwan Calendar), 4 (Japanese Emperor Reign), 5 (Thai Buddhist), 6 (Korean Danki), 7 (Saka Era), 8 (English transliterated), and 9 (French transliterated ).

To get a reference to the Calendar cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Prop.name.Calendar
where Prop.name is the row name

To get a reference to the Calendar cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionProp
Row index: | visRowProp + i where i = 0, 1, 2...
Cell index: | visCustPropsCalendar


Calendar Cell (Text Fields Section)

 Copy code hover
[image]

Calendar Cell (Text Fields Section)
Send feedback

Published: July 16, 2012

Determines the calendar that is used for a text field when the data type is Date.

Remarks

The possible values are: 0 (Western), 1 (Arabic Hijri), 2 (Hebrew Lunar), 3 (Taiwan Calendar), 4 (Japanese Emperor Reign), 5 (Thai Buddhist), 6 (Korean Danki), 7 (Saka Era), 8 (English transliterated), and 9 (French transliterated ).

To get a reference to the Calendar cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Fields.Calendar[i]
where i = <1>, 2, 3...

To get a reference to the Calendar cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionTextField
Row index: | visRowField + i where i = 0, 1, 2...
Cell index: | visFieldCalendar


Can Glue Cell (Controls Section)

 Copy code hover
[image]

Can Glue Cell (Controls Section)
Send feedback

Published: July 16, 2012

Determines whether a control handle can be glued to other shapes.

Value | Description
TRUE | Control handle can be glued.
FALSE | Control handle cannot be glued.

Remarks

To get a reference to the Can Glue cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Controls.name.CanGluewhere Controls.name is the name of the controls row.

To get a reference to the Can Glue cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionControls
Row index: | visRowControl + i where i = 0, 1, 2, ...
Cell index: | visCtlGlue


Case Cell (Character Section)

 Copy code hover
[image]

Case Cell (Character Section)
Send feedback

Published: July 16, 2012

Determines the case of a shape's text. All capital (uppercase) letters (1) and initial capital letters (2) do not change the appearance of text that was entered in all capital letters. The text must be entered in lowercase letters for these options to show an effect.

Value | Description | Automation constant
0 | Normal case | visCaseNormal
1 | All capital (uppercase) letters | visCaseAllCaps
2 | Initial capital letters only | visCaseInitialCaps

Remarks

To get a reference to the Case cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.Case[i]
where i = <1>, 2, 3, ...

To get a reference to the Case cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2, ...
Cell index: | visCharacterCase


CenterX Cell (Print Properties Section)

 Copy code hover
[image]

CenterX Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the drawing page is centered horizontally on the printer page.

Value | Description
TRUE | Center the drawing page horizontally on the printer page.
FALSE | Do not center the drawing page horizontally on the printer page (the default).

Remarks

By default, drawing pages are justified to the top and left of the printer page. Setting the CenterX and CenterY cells to TRUE places the drawing page in the center of the printer page (or pages when tiling is necessary).

To get a reference to the CenterX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

CenterX

To get a reference to the CenterX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesCenterX


CenterY Cell (Print Properties Section)

 Copy code hover
[image]

CenterY Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the drawing page is centered vertically on the printer page.

Value | Description
TRUE | Center the drawing page vertically on the printer page.
FALSE | Do not center the drawing page vertically on the printer page (the default).

Remarks

By default, drawing pages are justified to the top and left of the printer page. Setting the CenterX and CenterY cells to TRUE places the drawing page in the center of the printer page (or pages when tiling is necessary).

To get a reference to the CenterY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

CenterY

To get a reference to the CenterY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesCenterY


Checked Cell (Actions Section)

 Copy code hover
[image]

Checked Cell (Actions Section)
Send feedback

Published: July 16, 2012

Indicates whether an item is checked on the shortcut or action tag menu.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Value | Description
TRUE | Check mark is displayed.
FALSE | Check mark is not displayed (the default).

Remarks

To get a reference to the Checked cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Actions.name.Checked
where Actions.name is the name of the Actions row

To get a reference to the Checked cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2, ...
Cell index: | visActionChecked


ClippingPath Cell (Foreign Image Info Section)

 Copy code hover
[image]

ClippingPath Cell (Foreign Image Info Section)
Send feedback

Published: July 16, 2012

Contains a reference to the geometry of the path that an image is bounded by.

Remarks

If the ClippingPath cell points to a valid path, the image is clipped so that the image is rendered inside of the path. If the ClippingPath cell is empty or contains an invalid entry, then the image will be rendered with a rectangular clip, using the scale and offset values.

Note Note

Only paths defined by a Geometry section in the image's ShapeSheet are valid entries for the ClippingPath cell. Cross-sheet references cannot be used to define an image clipping path.

To get a reference to the ClippingPath cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ClippingPath

To get a reference to the ClippingPath cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowForeign
Cell index: | visFrgnImgClippingPath

Example

You can change the bounding shape of an image to an oval by doing the following:

  • Insert the picture onto the drawing canvas.

  • Right-click the picture and then select Show ShapeSheet.

  • Right-click anywhere in the ShapeSheet and select Insert Section.

  • In the Insert Section dialog box, select Geometry and then click OK.

  • In the new Geometry section (e.g. "Geometry2"), delete all but one row.

  • Right-click the remaining row and then click Change Row Type.

  • In the Change Row Type dialog box, select Ellipse and then click OK.

  • In the Foreign Image section, set the formula for the ClippingPath cell to ="Geometry2.Path" and then accept the formula.


Color Cell (Character Section)

 Copy code hover
[image]

Color Cell (Character Section)
Send feedback

Published: July 16, 2012

Determines the color used for the shape's text.

Remarks

To set the color, enter a number from 0 to 23.

To enter a custom color, use the RGB or HSL function. The value of a custom color is its RGB color, and RGB(r, g, b), rather than a number, will be shown in the ShapeSheet window. When used in numeric operations, custom colors have values of 24 and above.

You can set the transparency of the text color in the Transparency cell.

To get a reference to the Color cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.Color[i]
where i = <1>, 2, 3, ...

To get a reference to the Color cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2, ...
Cell index: | visCharacterColor


Color Cell (Layers Section)

 Copy code hover
[image]

Color Cell (Layers Section)
Send feedback

Published: July 16, 2012

Specifies the color used to display the layer.

Remarks

To set the color, enter a number from 0 to 23.

This cell value corresponds to the Layer color setting in the Layer Properties dialog box (in the Editing group on the Home tab, click Layers and then click Layer Properties).

To enter a custom color, use the RGB or HSL function. The value of a custom color is its RGB color, and RGB(r, g, b), rather than a number, will be shown in the ShapeSheet window. When used in numeric operations, custom colors have values of 24 and above. A value of 255 indicates that the layer has no color.

You can set the transparency of the layer color in the Transparency cell.

To get a reference to the Color cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Layers.Color[i]
where i = <1>, 2, 3, ...

To get a reference to the Color cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionLayer
Row index: | visRowLayer + i where i = 0, 1, 2, ...
Cell index: | visLayerColor


Color Cell (Reviewer Section)

 Copy code hover
[image]

Color Cell (Reviewer Section)
Send feedback

Published: July 16, 2012

An RGB value that represents the color assigned to a document reviewer's markup.

Remarks

Colors are assigned to reviewers in the following sequence: red, blue, green, violet, orange, turquoise, gray. These colors are cycled through again for any remaining reviewers.

Comments entered on the original drawing page are always colored yellow, regardless of the color assigned to a reviewer in the Color cell.

To get a reference to the Color cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Reviewer.Color [i]
where i = <1>, 2, 3...

To get a reference to the Color cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionReviewer
Row index: | visRowReviewer + i where i = 0, 1, 2...
Cell index: | visReviewerColor


ColorSchemeIndex Cell (Theme Properties Section)

 Copy code hover
[image]

ColorSchemeIndex Cell (Theme Properties Section)
Send feedback

Published: July 16, 2012

Determines the index of the theme that the shape's color scheme takes after, as an integer.

Remarks

To get a reference to the ColorSchemeIndex cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ColorSchemeIndex

To get a reference to the ColorSchemeIndex cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowThemeProperties
Cell index: | visColorSchemeIndex


Comment Cell (Annotation Section)

 Copy code hover
[image]

Comment Cell (Annotation Section)
Send feedback

Published: July 16, 2012

Contains the text that appears in a comment.

Note Note

This cell is used for tracking comments only when opening a .vsd file in Microsoft Visio 2013 or when saving a .vsdx file in the .vsd file format. It is not used for tracking comments in .vsdx documents in Visio 2013.

Remarks

To get a reference to the Comment cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Annotation.Comment[i]
where i = <1>, 2, 3...

To get a reference to the Comment cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAnnotation
Row index: | visRowAnnotation + i where i = 0, 1, 2...
Cell index: | visAnnotationComment


Comment Cell (Miscellaneous Section)

 Copy code hover
[image]

Comment Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Contains the comment text in string format for a shape.

Remarks

You can also insert a comment by clicking New Comment on the Review tab.

To get a reference to the Comment cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Comment

To get a reference to the Comment cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visComment


ComplexScriptFont Cell (Character Section)

 Copy code hover
[image]

ComplexScriptFont Cell (Character Section)
Send feedback

Published: July 16, 2012

Contains the number of the font used to format text composed of complex script characters. Font numbers vary according to the fonts installed on your system.

Remarks

Complex script font sizes are listed on the Font tab in the Text dialog box (click the arrow in the Font group on the Home tab). This list appears only if you have added a language that contains Asian or complex script characters, in the Microsoft Office Language Preferences dialog box. (Click Start, click All Programs, click Microsoft Office, click Microsoft Office Tools, and then click Microsoft Office Language Preferences.

The number 0 (zero) means no font is specified. The Latin font or default fonts are used.

To get a reference to the ComplexScriptSize cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Char.ComplexScriptFont[i]
where i = <1>, 2, 3...

To get a reference to the ComplexScriptFont cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterComplexScriptFont


ComplexScriptSize Cell (Character Section)

 Copy code hover
[image]

ComplexScriptSize Cell (Character Section)
Send feedback

Published: July 16, 2012

The size of the font used to format text composed of complex script characters.

Remarks

Complex script font sizes are listed on the Font tab in the Text dialog box (click the arrow in the Font group on the Home tab). This list appears only if you have added a language that contains Asian or complex script characters, in the Microsoft Office Language Preferences dialog box. (Click Start, click All Programs, click Microsoft Office, click Microsoft Office Tools, and then click Microsoft Office Language Preferences.

You can enter this value as an explicit point size or as a percentage. If you specify a percentage, the value is based on the value in the Size cell. A default value of 0 (zero) means 100%.

To get a reference to the ComplexScriptSize cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Char.ComplexScriptSize[i]
where i = <1>, 2, 3...

To get a reference to the ComplexScriptSize cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterComplexScriptSize


CompoundType Cell (Line Format Section)

 Copy code hover
[image]

CompoundType Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Determines the compound type of the line of a shape.

Value | Description
0 | Simple
1 | Double
2 | Thick thin
3 | Thin thick
4 | Triple

Remarks

To get a reference to the CompoundType cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

CompoundType

To get a reference to the CompoundType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visCompoundTy


ConFixedCode Cell (Shape Layout Section)

 Copy code hover
[image]

ConFixedCode Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines when a connector reroutes.

Value | Description | Automation constant
0 | Reroute freely | visSLOConFixedRerouteFreely
1 | Reroute as needed (manual reroute) | visSLOConFixedRerouteAsNeeded
2 | Never reroute | visSLOConFixedRerouteNever
3 | Reroute on crossover | visSLOConFixedRerouteOnCrossover
4 | For internal use only | visSLOConFixedByAlgFrom
5 | For internal use only | visSLOConFixedByAlgTo
6 | For internal use only | visSLOConFixedByAlgFromTo

Remarks

You can also set the value of this cell by selecting a dynamic connector, clicking Behavior in the Shape Design group on the Developer tab, and then clicking the Connector tab.

To get a reference to the ConFixedCode cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ConFixedCode

To get a reference to the ConFixedCode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOConFixedCode


ConLineJumpCode Cell (Shape Layout Section)

 Copy code hover
[image]

ConLineJumpCode Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines when a connector jumps.

Value | Description | Automation constant
0 | As page specifies; on the Design tab, click the arrow in the Page Setup group, and then click the Layout and Routing tab to see the page specifications | visSLOJumpDefault
1 | Never | visSLOJumpNever
2 | Always | visSLOJumpAlways
3 | Other connector jumps | visSLOJumpOther
4 | Neither connector jumps | visSLOJumpNeither

Remarks

You can also set the value of this cell by selecting a dynamic connector, clicking Behavior in the Shape Design group on the Developer tab, and then clicking the Connector tab.

To get a reference to the ConLineJumpCode cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

ConLineJumpCode

To get a reference to the ConLineJumpCode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOJumpCode


ConLineJumpDirX Cell (Shape Layout Section)

 Copy code hover
[image]

ConLineJumpDirX Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines the line jump direction for line jumps occurring on a horizontal dynamic connector for a shape.

Value | Line jump direction | Automation constant
0 | Page default | visLOJumpDirXDefault
1 | Up | visLOJumpDirXUp
2 | Down | visLOJumpDirXDown

Remarks

To set the default horizontal direction for all connector jumps on a page, use the PageLineJumpDirX cell in the Page Layout section.

To get a reference to the ConLineJumpDirX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ConLineJumpDirX

To get a reference to the ConLineJumpDirX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOJumpDirX


ConLineJumpDirY Cell (Shape Layout Section)

 Copy code hover
[image]

ConLineJumpDirY Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines the line jump direction for line jumps occurring on a vertical dynamic connector for a shape.

Value | Line Jump Direction | Automation constant
0 | Page default | visLOJumpDirYDefault
1 | Left | visLOJumpDirYLeft
2 | Right | visLOJumpDirYRight

Remarks

To set the default vertical direction for all connector jumps on a page, use the PageLineJumpDirY cell in the Page Layout section.

To get a reference to the ConLineJumpDirY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ConLineJumpDirY

To get a reference to the ConLineJumpDirY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOJumpDirY


ConLineJumpStyle Cell (Shape Layout Section)

 Copy code hover
[image]

ConLineJumpStyle Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines the line jump style for line jumps on a dynamic connector.

Value | Line Jump Style | Automation constant
0 | Page default | visLOJumpStyleDefault
1 | Arc | visLOJumpStyleArc
2 | Gap | visLOJumpStyleGap
3 | Square | visLOJumpStyleSquare
4 | Triangle | visLOJumpStyleTriangle
5 | 3 sides | visLOJumpStyle2Point
6 | 4 sides | visLOJumpStyle3Point
7 | 5 sides | visLOJumpStyle4Point
8 | 6 sides | visLOJumpStyle5Point
9 | 7 sides | visLOJumpStyle6Point
Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOJumpStyle

Remarks

You can also set the value of this cell by selecting a dynamic connector, clicking Behavior in the Shape Design group on the Developer tab, and then clicking the Connector tab.

To get a reference to the ConLineJumpStyle cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

ConLineJumpStyle

To get a reference to the ConLineJumpStyle cell by index from a program, use the CellsSRC property with the following arguments:


ConLineRouteExt Cell (Shape Layout Section)

 Copy code hover
[image]

ConLineRouteExt Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines the appearance of a connector.

Value | Description | Automation constant
0 | Default; use page setting | visLORouteExtDefault
1 | Straight | visLORouteExtStraight
2 | Curved | visLORouteExtNURBS

Remarks

To get a reference to the ConLineRouteExt cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ConLineRouteExt

To get a reference to the ConLineRouteExt cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOLineRouteExt


ConnectorSchemeIndex Cell (Theme Properties Section)

 Copy code hover
[image]

ConnectorSchemeIndex Cell (Theme Properties Section)
Send feedback

Determines the connector scheme of a theme that is applied to the shape, as an integer.

Remarks

To get a reference to the ConnectorSchemeIndex cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ConnectorSchemeIndex

To get a reference to the ConnectorSchemeIndex cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowThemeProperties
Cell index: | visConnectorSchemeIndex


Contrast Cell (Image Properties Section)

 Copy code hover
[image]

Contrast Cell (Image Properties Section)
Send feedback

Published: July 16, 2012

Adjusts the contrast of a bitmap image. Decrease the contrast of an image by entering a value between 0% and 49%, or increase the contrast by entering a value between 51% and 100%. The default value is 50%.

Remarks

To get a reference to the Contrast cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Contrast

To get a reference to the Contrast cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowImage
Cell index: | visImageContrast


CtrlAsInput Cell (Page Layout Section)

 Copy code hover
[image]

CtrlAsInput Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines which shape is the parent when using shapes with control handles. This cell sets the behavior for all the shapes on the drawing page.

Value | Description
TRUE | Set the shape that the control handle is connected to as the parent.
FALSE | The default. Set shape that contains the control handle as the parent.

Remarks

To get a reference to the CtrlAsInput cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

CtrlAsInput

To get a reference to the CtrlAsInput cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOCtrlAsInput


D Cell (Connection Points Section)

 Copy code hover
[image]

D Cell (Connection Points Section)
Send feedback

Published: July 16, 2012

A scratch cell that you can use for entering or testing formulas.

Remarks

To access the D cell, right-click a row, and then click Change Row Type on the shortcut menu.

To get a reference to the D cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Connections.D[i]
where i = <1>, 2, 3...

To get a reference to the D cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionConnectionPts
Row index: | visRowConnectionPts + i where i = 0, 1, 2...
Cell index: | visCnnctD


D Cell (Geometry Section)

 Copy code hover
[image]

D Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Represents different information in different rows. This table describes the D cell based on the row in which it's located.

Row | Description
EllipticalArcTo | The ratio of an arc's major axis to its minor axis. Despite the usual meaning of these words, the "major" axis does not have to be greater than the "minor" axis, so this ratio does not have to be greater than 1. Setting this cell to a value less than or equal to 0 or greater than 1000 can lead to unpredictable results.
NURBSTo | The first weight of the nonuniform rational B-spline (NURBS).
SplineStart | The degree of a spline (an integer from 1 to 25).
Ellipse | A y-coordinate of a point on an ellipse; paired with the x-coordinate represented by the C cell.

Remarks

To get a reference to the D cell by name from another formula, or from a program using the CellsU property, use:

Cell name: | Geometryi.Dj where i and j = <1>, 2, 3...
 | Geometryi.D1 (Ellipse row) where i = <1>, 2, 3...

To get a reference to the D cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowVertex + j where j = 0, 1, 2...
 | visRowVertex (Ellipse row)
Cell index | visAspectRatio (EllipticalArcTo row)
 | visNURBSWeightPrev (NURBSTo row)
 | visSplineDegree (SplineStart row)
 | visEllipseMinorY (Ellipse row)


Date Cell (Annotation Section)

 Copy code hover
[image]

Date Cell (Annotation Section)
Send feedback

Published: July 16, 2012

Contains the date and time the comment was last edited.

Note Note

This cell is used for tracking comments only when opening a .vsd file in Microsoft Visio 2013 or when saving a .vsdx file in the .vsd file format. It is not used for tracking comments in .vsdx documents in Visio 2013.

Remarks

Only the date appears in the comment box in the user interface.

To get a reference to the Date cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Annotation.Date[i]
where i = <1>, 2, 3...

To get a reference to the Date cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAnnotation
Row index: | visRowAnnotation + i where i = 0, 1, 2...
Cell index: | visAnnotationDate


Default Cell (Hyperlinks Section)

 Copy code hover
[image]

Default Cell (Hyperlinks Section)
Send feedback

Published: July 16, 2012

Determines the default hyperlink for a shape or page. Set the value of this cell to TRUE to set a hyperlink as the default.

Remarks

You can also set the default hyperlink by selecting a shape, clicking Hyperlink on the Insert tab, selecting a hyperlink, and then clicking Default. The default hyperlink appears in bold text.

To get a reference to the Default cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Hyperlink.Name.Default
where Hyperlink.Name is the row name

To get a reference to the Default cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionHyperlink
Row index: | visRow1stHyperlink + i where i = 0, 1, 2...
Cell index: | visHLinkDefault


DefaultTabstop Cell (Text Block Format Section)

 Copy code hover
[image]

DefaultTabstop Cell (Text Block Format Section)
Send feedback

Published: July 16, 2012

Determines the interval of the default tab stops in a text block.

Remarks

The default value is 0.5 inches for documents created in imperial units and 1.5 centimeters for documents created in metric units.

To get a reference to the DefaultTabstop cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

DefaultTabstop

To get a reference to the DefaultTabstop cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowText
Cell index: | visTxtBlkDefaultTabStop


Denoise Cell (Image Properties Section)

 Copy code hover
[image]

Denoise Cell (Image Properties Section)
Send feedback

Published: July 16, 2012

Removes noise (pixels with randomly distributed color levels) from a bitmap image. The default value is 0%.

Remarks

To get a reference to the Denoise cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Denoise

To get a reference to the Denoise cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowImage
Cell index: | visImageDenoise


Description Cell (Action Tags Section)

 Copy code hover
[image]

Description Cell (Action Tags Section)
Send feedback

Published: July 16, 2012

Contains a string that describes the action tag, which appears as a tool tip when users place their pointer over the tag.

Remarks

To get a reference to the Description cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

SmartTags.name.Description
where SmartTags.name is the name of the action tag row

To get a reference to the Description cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionSmartTag
Row index: | visRowSmartTag + i where i = 0, 1, 2...
Cell index: | visSmartTagDescription


Description Cell (Hyperlinks Section)

 Copy code hover
[image]

Description Cell (Hyperlinks Section)
Send feedback

Published: July 16, 2012

Represents a descriptive text string for a hyperlink.

Remarks

Use this cell to store comments about the hyperlink; for example, "Link to our pricing Web site."

You can also set the value of this cell in the Hyperlinks dialog box (click Hyperlink on the Insert tab).

To get a reference to the Description cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Hyperlink.Name.Description where Hyperlink.Name is the name of the hyperlink row

To get a reference to the Description cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRow1stHyperlink + i where i = 0, 1, 2...
Cell index: | visHLinkDescription


DirX / A Cell (Connection Points Section)

 Copy code hover
[image]

DirX / A Cell (Connection Points Section)
Send feedback

Published: July 16, 2012

Determines the x-component for the required alignment vector of a matching connection point. The DirX / A cell is also used to orient the attached leg of a dynamic connector. This cell takes a floating point value.

Remarks

To get a reference to the DirX / A cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Connections.DirX[i]
where i = <1>, 2, 3...

To get a reference to the DirX / A cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionConnectionPts
Row index: | visRowConnectionPts + i where i = 0, 1, 2
Cell index: | visCnnctDirX (non-extended rows) visCnnctA (extended rows)

For information about non-extended and extended rows, see Connection Points row.


DirY / B Cell (Connection Points Section)

 Copy code hover
[image]

DirY / B Cell (Connection Points Section)
Send feedback

Published: July 16, 2012

Determines the y-component for the required alignment vector of a matching connection point. It is also used to orient the attached leg of a dynamic connector. This cell takes a floating point value.

Remarks

To get a reference to the DirY / B cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

DirY[i]
where i = <1>, 2, 3...

To get a reference to the DirY / B cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionConnectionPts
Row index: | visRowConnectionPts+ i where i = 0, 1, 2...
Cell index: | visCnnctDirY (non-extended rows) visCnnctB (extended rows)

For information about non-extended and extended rows, see Connection Points row.


Disabled Cell (Action Tags Section)

 Copy code hover
[image]

Disabled Cell (Action Tags Section)
Send feedback

Published: July 16, 2012

Indicates whether the action tag appears in the drawing window.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Value | Description
TRUE | The action tag is disabled.
FALSE | The action tag is enabled (the default).

Remarks

When an action tag is disabled, it does not appear at all until it is re-enabled.

To get a reference to the Disabled cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

SmartTags.name.Disabled
where SmartTags.name is the name of the action tag row

To get a reference to the Disabled cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionSmartTag
Row index: | visRowSmartTag + i where i = 0, 1, 2...
Cell index: | visSmartTagDisabled


Disabled Cell (Actions Section)

 Copy code hover
[image]

Disabled Cell (Actions Section)
Send feedback

Published: July 16, 2012

Indicates whether an item on a shortcut or action tag menu is disabled.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Value | Description
TRUE | Disable (dim) command name.
FALSE | Enable the command name (the default).

Remarks

To get a reference to the Disabled cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Actions.name.Disabled
where Actions.name is the name of the Actions row

To get a reference to the Disabled cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2...
Cell index: | visActionDisabled


DisplayLevel Cell (Shape Layout Section)

 Copy code hover
[image]

DisplayLevel Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines the display level band (the relative range of Z-order grouping) for the shape.

Remarks

Z-order is the display order for shapes on the drawing page. A shape that is higher in the Z-order appears in front of a shape that is lower in the Z-order when one of the shapes overlays the other one.

The display level divides shapes into groupings, or bands. All shapes in a given band have a higher Z-order than the shapes in a lower band. By default, most shapes have a display level of zero (0).

The range of display levels is from -32,767 to +32,767. Shapes that have the same display level are combined into a single band, within which they are also ranked relative to one another by Z-order.

You can change the Z-order of shapes within a band by using the commands Bring Forward, Send Backward, Bring to Front, and Send to Back. If those commands move a shape out of its given band, Microsoft Visio displays the reserved value -32768 in the shape's DisplayLevel cell, unless the cell is guarded. In that case, the shape cannot be moved to a different band, and Visio displays the warning "Shape protection and/or layer properties prevent complete execution of this command."

To get a reference to the DisplayLevel cell by name from another formula or from a program by using the CellsU property, use the following.

Cell name:

DisplayLevel

To get a reference to the DisplayLevel cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLODisplayLevel


DisplayMode Cell (Group Properties Section)

 Copy code hover
[image]

DisplayMode Cell (Group Properties Section)
Send feedback

Published: July 16, 2012

Determines how the group shape and its members are displayed.

Value | Display Mode | Automation constant
0 | Hides the group shape and text. | visGrpDispModeNone
1 | Displays the group shape behind member shapes. | visGrpDispModeBack
2 | Displays the group shape in front of member shapes. | visGrpDispModeFront

Remarks

You can also set this value by selecting the group, clicking Behavior on the Shape Design group on the Developer tab, and then selecting a display mode from the Group data list.

To get a reference to the DisplayMode cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

DisplayMode

To get a reference to the DisplayMode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGroup
Cell index: | visGroupDisplayMode


DisplayMode Cell (Action Tags Section)

 Copy code hover
[image]

DisplayMode Cell (Action Tags Section)
Send feedback

Published: July 16, 2012

Determines whether the action tag appears when the user moves the pointer over the tag, when the shape is selected, or all the time.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Value | Display Mode | Automation constant
0 | Appears when the mouse is paused over the tag (the default). | visSmartTagDispModeMouseOver
1 | Appears while the shape is selected. | visSmartTagDispModeShapeSelected
2 | Appears all the time. | visSmartTagDispModeAlways

Remarks

Action tags do not appear on printed or published output.

If an action tag is defined for a page, and this cell contains a value of 1, the tag never appears because a page cannot be selected.

To get a reference to the DisplayMode cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

SmartTags.name.DisplayMode
where SmartTags.name is the name of the action tag row

To get a reference to the DisplayMode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionSmartTag
Row index: | visRowSmartTag + i where i = 0, 1, 2...
Cell index: | visSmartTagDisplayMode


DistanceFromGround Cell (3-D Rotation Properties)

 Copy code hover
[image]

DistanceFromGround Cell (3-D Rotation Properties)
Send feedback

Published: July 16, 2012

Determines the distance the object is raised from the ground in points when rotated in 3-D.

Remarks

To get a reference to the DistanceFromGround cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

DistanceFromGround

To get a reference to the DistanceFromGround cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRow3DProperties
Cell index: | visDistanceFromGround


DocLangID Cell (Document Properties Section)

 Copy code hover
[image]

DocLangID Cell (Document Properties Section)
Send feedback

Published: July 16, 2012

Indicates the default language for the document.

Remarks

The document language is based on the language defined in the Microsoft Office Language Preferences dialog box. (Click Start, click All Programs, click Microsoft Office, click Microsoft Office Tools, and then click Microsoft Office Language Preferences.)

If you want to change the language for a document, instead of editing this cell directly it is best to change this value in the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties) or programmatically, by using the Language property of the Document object.

The following table contains a list of languages and their corresponding LCIDs.

Language | LCID
Afrikaans | 1078
Albanian | 1052
Amharic | 1118
Arabic | 1025
Armenian | 1067
Assamese | 1101
Azeri (Cyrillic) | 2092
Azeri (Latin) | 1068
Basque | 1069
Belarusian | 1059
Bengali | 1093
Bulgarian | 1026
Catalan | 1027
Cherokee | 1116
Chinese (Simplified) | 2052
Chinese (Traditional) | 1028
Croatian | 1050
Czech | 1029
Danish | 1030
Dhivehi | 1125
Dutch | 1043
Edo | 1126
English (Australian) | 3081
English (Canadian) | 4105
English ( U.K.) | 2057
English (U.S.) | 1033
Estonian | 1061
Faeroese | 1080
Filipino | 1124
Finnish | 1035
French | 1036
French (Canadian) | 3084
Frisian | 1122
Fulfulde | 1127
Galician | 1110
Georgian | 1079
German | 1031
German (Austrian) | 3079
German (Swiss) | 2055
Greek | 1032
Gujarati | 1095
Hausa | 1128
Hawaiian | 1141
Hebrew | 1037
Hindi | 1081
Hungarian | 1038
Ibibio | 1129
Icelandic | 1039
Igbo | 1136
Indonesian | 1057
Inuktitut | 1117
Italian | 1040
Japanese | 1041
Kannada | 1099
Kanuri | 1137
Kashmiri | 2144
Kashmiri (Arabic) | 1120
Kazakh | 1087
Kyrgyz | 1088
Konkani | 1111
Korean | 1042
Latin | 1142
Latvian | 1062
Lithuanian | 1063
Macedonian (F.Y.R.O. Macedonia) | 1071
Malay | 1086
Malayalam | 1100
Maltese | 1082
Manipuri | 1112
Marathi | 1102
Mongolian | 1104
Nepali | 1121
Norwegian Bokmal | 1044
Norwegian Nynorsk | 2068
Odia | 1096
Oromo | 1138
Pashto | 1123
Persian | 1065
Polish | 1045
Portuguese (Brazil) | 1046
Portuguese (Portugal) | 2070
Punjabi | 1094
Romanian | 1048
Russian | 1049
Sanskrit | 1103
Serbian (Cyrillic) | 3098
Serbian (Latin) | 2074
Sindhi | 1113
Sinhalese | 1115
Slovak | 1051
Slovenian | 1060
Somali | 1143
Spanish | 3082
Swahili | 1089
Swedish | 1053
Syriac | 1114
Tajik | 1064
Tamazight (Arabic, Morocco) | 1119
Tamazight (Latin) | 2143
Tamil | 1097
Tatar | 1092
Telugu | 1098
Thai | 1054
Tigrigna (Ethiopia) | 1139
Tigrigna (Eritrea) | 2163
Turkish | 1055
Turkmen | 1090
Ukrainian | 1058
Urdu | 1056
Uzbek (Cyrillic) | 2115
Uzbek (Latin) | 1091
Vietnamese | 1066
Yi | 1144
Yiddish | 1085
Yoruba | 1130

To get a reference to the DocLangID cell by name from another formula or from a program by using the CellsU property, use:

Cell name:

DocLangID

To get a reference to the DocLangID cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowDoc
Cell index: | visDocLangID


DocLockDuplicatePage Cell (Document Properties Section)

 Copy code hover
[image]

DocLockDuplicatePage Cell (Document Properties Section)
Send feedback

Published: July 16, 2012

Determines whether pages in the document can be duplicated, as a Boolean.

TRUE | Duplicate in the page shortcut menu and the Page.Duplicate automation method are both disabled.
FALSE | The page can be duplicated.

Remarks

To get a reference to the DocLockDuplicatePage cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

DocLockDuplicatePage

To get a reference to the DocLockDuplicatePage cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowDoc
Cell index: | visDocLockDuplicatePage


DocLockReplace Cell (Document Properties Section)

 Copy code hover
[image]

DocLockReplace Cell (Document Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the replace shape UI should be disabled for this document.

TRUE | The Replace Shape button is grayed out in the UI.
FALSE | The Replace Shape button is active in the UI. Users can use the Replace Shape feature in this document.

Remarks

To get a reference to the DocLockReplace cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

DocLocReplace

To get a reference to the DocLocReplace cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowDoc
Cell index: | visDocLockReplace


DontMoveChildren Cell (Group Properties Section)

 Copy code hover
[image]

DontMoveChildren Cell (Group Properties Section)
Send feedback

Published: July 16, 2012

Determines whether you can drag shapes in a group using the mouse.

Value | Description
TRUE | Don't allow shapes in a group to be dragged using the mouse.
FALSE | Allow shapes in a group to be dragged using the mouse.

Remarks

When the value of this cell is TRUE, you can still flip, rotate, resize, or reposition shapes in groups using other methods.

The value of this cell is TRUE for groups in masters and groups in instances of masters that were created in versions of Visio earlier than version 2000.

To get a reference to the DontMoveChildren cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

DontMoveChildren

To get a reference to the DontMoveChildren cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGroup
Cell index: | visGroupDontMoveChildren


DoubleStrikethrough Cell (Character Section)

 Copy code hover
[image]

DoubleStrikethrough Cell (Character Section)
Send feedback

Published: July 16, 2012

Determines whether text is formatted as double strikethrough.

Remarks

To get a reference to the DoubleStrikethrough cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.DoubleStrikethrough[i]
where i = <1>, 2, 3...

To get a reference to the DoubleStrikethrough cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterDoubleStrikethrough


DoubleULine Cell (Character Section)

 Copy code hover
[image]

DoubleULine Cell (Character Section)
Send feedback

Published: July 16, 2012

Determines whether the range of text has a double underline below it.

Value | Description
TRUE | Text has a double underline below it.
FALSE | Text does not have a double underline below it.

Remarks

The DoubleULine cell contains formatting information applied to a sub-range of a shape's text if the Characters section contains multiple rows. Otherwise, it contains formatting information for all of the shape's text.

You can also set the value of this cell by using the Text dialog box (click the Font arrow on the Home tab).

To get a reference to the DoubleULine cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.DblUnderline[i]
where i = <1>, 2, 3...

To get a reference to the DoubleULine cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterDblUnderline


DrawingResizeType Cell (Page Properties Section)

 Copy code hover
[image]

DrawingResizeType Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the drawing page resizes automatically to fit the diagram.

Remarks

To get a reference to the DrawingResizeType cell by name from another formula, or from a program by using the CellsU property, use the following.

Cell name:

DrawingResizeType

To get a reference to the DrawingResizeType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageDrawResizeType


DrawingScale Cell (Page Properties Section)

 Copy code hover
[image]

DrawingScale Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Represents the value of the drawing unit in the current drawing scale. The drawing scale for the page is the ratio of the page unit shown in the PageScale cell to the drawing unit shown in the DrawingScale cell.

You can set the DrawingScale cell to change the units of a page's rulers from a program. Here is an example of changing the measurement units from inches to centimeters from a program. In this case, we use the ConvertResult method to keep the distance the same but express it in different units.

VBA Copy code Copy code

Public Sub SetActivePageMeasurementToCM()
Dim dsCell As Visio.Cell
Set dsCell = ActivePage.PageSheet.Cells("DrawingScale")
 dsCell.Result(visCentimeters) = _
 Application.ConvertResult _
 (dsCell.ResultIU,visInches,visCentimeters)
End Sub

You can determine the measurement system in a drawing by examining the Units property of the DrawingScale cell. After running the above macro the following statement executed in the Visual Basic Editor Immediate window will return True.

VBA Copy code Copy code

debug.print ActivePage.PageSheet.Cells("DrawingScale").Units = _
 visCentimeters

Remarks

This cell corresponds to the settings in the Page Setup dialog box (click the Page Setup arrow on the Home tab).

The units of the formula in the DrawingScale cell determine the measurement units used by the rulers in the drawing window. If you do not want to also change the drawing's scale, you can do one of the following:

  • Keep the distance expressed in the DrawingScale cell the same but express it in different units.

  • Change the distance expressed in the PageScale cell by the same factor that you change DrawingScale.

To get a reference to the DrawingScale cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

DrawingScale

To get a reference to the DrawingScale cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageDrawingScale


DrawingScaleType Cell (Page Properties Section)

 Copy code hover
[image]

DrawingScaleType Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Determines the drawing scale selected in the Page Setup dialog box (click the Page Setup arrow on the Home tab).

Value | Description | Automation constant
0 | No Scale | visNoScale
1 | Architectural Scale | visArchitectural
2 | Civil Engineering Scale | visEngineering
3 | Custom Scale | visScaleCustom
4 | Metric | visScaleMetric
5 | Mechanical Engineering Scale | visScaleMechanical

Remarks

To get a reference to the DrawingScaleType cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

DrawingScaleType

To get a reference to the DrawingScaleType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageDrawScaleType


DrawingSizeType Cell (Page Properties Section)

 Copy code hover
[image]

DrawingSizeType Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Determines the drawing size.

Value | Description | Automation constant
0 | Same as printer | visPrintSetup
1 | Fit page to drawing contents | visTight
2 | Standard | visStandard
3 | Custom page size | visCustom
4 | Custom scaled drawing size | visLogical
5 | Metric (ISO) | visDSMetric
6 | ANSI Engineering | visDSEngr
7 | ANSI Architectural | visDSArch

Remarks

To set the drawing size, use the Page Setup dialog box (click the Page Setup arrow on the Design tab) or manually resize the page with the mouse.

To get a reference to the DrawingSizeType cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

DrawingSizeType

To get a reference to the DrawingSizeType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageDrawSizeType


DropOnPageScale Cell (Miscellaneous Section)

 Copy code hover
[image]

DropOnPageScale Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Contains the percentage by which a shape is scaled when dropped on the drawing page.

Remarks

In the following two cases, Visio scales shapes so that they appear appropriately on the drawing page:

  • When unmeasured shapes are dropped onto scaled drawings.

  • When measured shapes are dropped onto unscaled drawings.

The percentage in the DropOnPageScale cell indicates the factor by which Visio scaled the shape, either up (>100) or down (<100). You can use this number as a factor when calculating hard-coded values.

This value is 100% for measured shapes on scaled drawings or unmeasured shapes on unscaled drawings.

To get a reference to the DropOnPageScale cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

DropOnPageScale

To get a reference to the DropOnPageScale cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visObjDropOnPageScale


DynamicsOff Cell (Page Layout Section)

 Copy code hover
[image]

DynamicsOff Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines whether placeable shapes move and connectors reroute around other shapes and connectors on the drawing page.

Value | Description
TRUE | Disable dynamics.
FALSE | Enable dynamics.

Remarks

You can disable dynamics to increase your solution's performance. For example, if your solution adds placeable shapes to a drawing and you don't want the application to reroute connectors and reposition shapes each time you add a shape, you can disable dynamics. After your solution adds the shapes, re-enable dynamics.

To get a reference to the DynamicsOff cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

DynamicsOff

To get a reference to the DynamicsOff cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLODynamicsOff


DynFeedback Cell (Miscellaneous Section)

 Copy code hover
[image]

DynFeedback Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Changes the type of visual feedback provided to users when they drag a connector. When the mouse button is released, the resulting connector shape is not affected by this setting. This setting does not apply to routable connectors.

Value | Description | Automation constant
0 | Remains straight (no legs). | visDynFBDefault
1 | Shows three legs when dragged. | visDynFBUCon3Leg
2 | Shows five legs when dragged. | visDynFBUCon5Leg

Remarks

To get a reference to the DynFeedback cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

DynFeedback

To get a reference to the DynFeedback cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visDynFeedback


E Cell (Geometry Section)

 Copy code hover
[image]

E Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Contains a nonuniform rational B-spline (NURBS) formula.

Remarks

To get a reference to the E cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Geometryi.Ej
where i and j = <1>, 2, 3...

To get a reference to the E cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowVertex + j where j = 0, 1, 2...
Cell index: | visNURBSData


EffectSchemeIndex Cell (Theme Properties Section)

 Copy code hover
[image]

EffectSchemeIndex Cell (Theme Properties Section)
Send feedback

Published: July 16, 2012

Determines the effect scheme of the theme applied to a shape, as an integer.

Remarks

To get a reference to the EffectSchemeIndex cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

EffectSchemeIndex

To get a reference to the EffectSchemeIndex cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowThemeProperties
Cell index: | visEffectSchemeIndex


EmbellishmentIndex Cell (Theme Properties Section)

 Copy code hover
[image]

EmbellishmentIndex Cell (Theme Properties Section)
Send feedback

Published: July 16, 2012

Changes the look and feel (embellishment) of callouts, containers, timelines, and organization chart shapes.

Remarks

To get a reference to the EmbellishmentIndex cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

EmbellishmentIndex

To get a reference to the EmbellishmentIndex cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowThemeProperties
Cell index: | visEmbellishmentIndex


EnableFillProps Cell (Style Properties Section)

 Copy code hover
[image]

EnableFillProps Cell (Style Properties Section)
Send feedback

Published: July 16, 2012

Determines whether a style includes fill properties.

Value | Description
TRUE | Include fill properties.
FALSE | Exclude fill properties.

Remarks

To get a reference to the EnableFillProps cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EnableFillProps

To get a reference to the EnableFillProps cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowStyle
Cell index: | visStyleIncludesFill


EnableGrid Cell (Page Layout Section)

 Copy code hover
[image]

EnableGrid Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines whether the application lays out shapes based on an internal, invisible page grid when you configure the layout in the Configure Layout dialog box. (On the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options.)

Value | Description
TRUE | Use the internal page grid.
FALSE | Do not use the internal page grid.

Remarks

You create this page grid by using the Space between shapes and the Average shape size values in the Layout and Routing Spacing dialog box. (On the Design tab, click the Page Setup arrow, click Layout and Routing , and then click Spacing .)

When you enable this feature, the application aligns each placeable shape's center point with the center of a block on the internal page grid.

To get a reference to the EnableGrid cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EnableGrid

To get a reference to the EnableGrid cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOEnableGrid


EnableLineProps Cell (Style Properties Section)

 Copy code hover
[image]

EnableLineProps Cell (Style Properties Section)
Send feedback

Published: July 16, 2012

Determines whether a style includes line properties.

Value | Description
TRUE | Include line properties.
FALSE | Exclude line properties.

Remarks

To get a reference to the EnableLineProps cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EnableLineProps

To get a reference to the EnableLineProps cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowStyle
Cell index: | visStyleIncludesLine


EnableTextProps Cell (Style Properties Section)

 Copy code hover
[image]

EnableTextProps Cell (Style Properties Section)
Send feedback

Published: July 16, 2012

Determines whether a style includes text properties.

Value | Description
TRUE | Include text properties.
FALSE | Exclude text properties.

Remarks

To get a reference to the EnableTextProps cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EnableTextProps

To get a reference to the EnableTextProps cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowStyle
Cell index: | visStyleIncludesText


EndArrow Cell (Line Format Section)

 Copy code hover
[image]

EndArrow Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Indicates whether a line has an arrowhead or other line end format at its last vertex.

Value | Description
0 | No arrowhead.
1 - 45 | Assorted arrowhead styles that correspond to indexed entries in the Line dialog box.

Remarks

You can also set this value in the Line dialog box (on the Home tab, in the Shape group, click Line, point to Arrows, and then click More Arrows ). The size of the arrowhead is set in the EndArrowSize cell.

You can specify a custom line end using the USE function in this cell.

To get a reference to the EndArrow cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EndArrow

To get a reference to the EndArrow cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visLineEndArrow


EndArrowSize Cell (Line Format Section)

 Copy code hover
[image]

EndArrowSize Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Determines the size of the arrowhead at the end of the line.

Value | Size | Automation constant
0 | Very small | visArrowSizeVerySmall
1 | Small | visArrowSizeSmall
2 | Medium | visArrowSizeMedium
3 | Large | visArrowSizeLarge
4 | Extra large | visArrowSizeVeryLarge
5 | Jumbo | visArrowSizeJumbo
6 | Colossal | visArrowSizeColossal

Remarks

You can also set this value in the Line dialog box (on the Home tab, in the Shape group, click Line, point to Arrows, and then click More Arrows).

To get a reference to the EndArrowSize cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EndArrowSize

To get a reference to the EndArrowSize cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visLineEndArrowSize


EndTrigger Cell (Glue Info Section)

 Copy code hover
[image]

EndTrigger Cell (Glue Info Section)
Send feedback

Published: July 16, 2012

Contains a trigger formula generated by the application that determines whether to move the endpoint of a 1-D shape to maintain its connection to another shape.

Remarks

When you glue a 1-D shape to another shape using dynamic glue, Visio generates a formula that refers to the EventXFMod cell of the other shape. When that shape is changed, Visio recalculates any formula that refers to its EventXFMod cell, including the formula in the EndTrigger cell. Other formulas of the 1-D shape refer to the EndTrigger cell and move the endpoint of the 1-D shape or alter the shape as needed.

To get a reference to the EndTrigger cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EndTrigger

To get a reference to the EndTrigger cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visEndTrigger


EndX Cell (1-D Endpoints Section)

 Copy code hover
[image]

EndX Cell (1-D Endpoints Section)
Send feedback

Published: July 16, 2012

Represents the x-coordinate of the endpoint of the 1-D shape, in relation to the origin of its parent.

Remarks

To get a reference to the EndX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EndX

To get a reference to the EndX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXForm1D
Cell index: | vis1DEndX


EndY Cell (1-D Endpoints Section)

 Copy code hover
[image]

EndY Cell (1-D Endpoints Section)
Send feedback

Published: July 16, 2012

Represents the y-coordinate of the endpoint of the 1-D shape, in relation to the origin of its parent.

Remarks

To get a reference to the EndY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EndY

To get a reference to the EndY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXForm1D
Cell index: | vis1DEndY


EventDblClick Cell (Events Section)

 Copy code hover
[image]

EventDblClick Cell (Events Section)
Send feedback

Published: July 16, 2012

An event cell that is evaluated when a shape is double-clicked.

Remarks

Event cells are evaluated only when the event occurs, not upon formula entry.

To get a reference to the EventDblClick cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EventDblClick

To get a reference to the EventDblClick cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowEvent
Cell index: | visEvtCellDblClick


EventDrop Cell (Events Section)

 Copy code hover
[image]

EventDrop Cell (Events Section)
Send feedback

Published: July 16, 2012

An event cell that is evaluated when a shape is dropped on the drawing page, either as an instance or when the shape is duplicated or pasted.

Remarks

Event cells are evaluated only when the event occurs, not upon formula entry.

To get a reference to the EventDrop cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EventDrop

To get a reference to the EventDrop cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowEvent
Cell index: | visEvtCellDrop


EventMultiDrop Cell (Events Section)

 Copy code hover
[image]

EventMultiDrop Cell (Events Section)
Send feedback

Published: July 16, 2012

An event cell that is evaluated when multiple shapes are dropped on the drawing page, either as instances or when shapes are duplicated or pasted.

Event cells are evaluated only when the event occurs, not upon formula entry.

To refer to the EventMultiDrop cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EventMultiDrop

To refer to the EventMultiDrop cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowEvent
Cell index: | visEvtCellMultiDrop


EventXFMod Cell (Events Section)

 Copy code hover
[image]

EventXFMod Cell (Events Section)
Send feedback

Published: July 16, 2012

An event cell that is evaluated when a shape's position or orientation on the page is transformed ("XF").

Remarks

Event cells are evaluated only when the event occurs, not upon formula entry.

To get a reference to the EventXFMod cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

EventXFMod

To get a reference to the EventXFMod cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowEvent
Cell index: | visEvtCellXFMod


ExtraInfo Cell (Hyperlinks Section)

 Copy code hover
[image]

ExtraInfo Cell (Hyperlinks Section)
Send feedback

Published: July 16, 2012

Represents a string that passes information to be used in resolving a URL, such as the coordinates of an image map. For example, in the ExtraInfo cell, "x=41&y=7" specifies the coordinates of an image map.

Remarks

Event cells are evaluated only when the event occurs, not upon formula entry.

To get a reference to the ExtraInfo cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Hyperlink.name.ExtraInfo
where Hyperlink.name is the row name

To get a reference to the ExtraInfo cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionHyperlink
Row index: | visRow1stHyperlink + i where i = 0, 1, 2...
Cell index: | visHLinkExtraInfo


FillBkgnd Cell (Fill Format Section)

 Copy code hover
[image]

FillBkgnd Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the color used for the background (fill) of the shape's fill pattern.

Remarks

To set the color, enter a number from 0 to 23.

To enter a custom color, use the RGB or HSL function. The value of a custom color is its RGB color, and RGB( r, g, b ), rather than a number, will be shown in the ShapeSheet window. When used in numeric operations, custom colors have values of 24 and above.

You can set the transparency of the background fill in the FillBkgndTrans cell.

To get a reference to the FillBkgnd cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

FillBkgnd

To get a reference to the FillBkgnd cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillBkgnd


FillBkgndTrans Cell (Fill Format Section)

 Copy code hover
[image]

FillBkgndTrans Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the transparency level for the background (fill) color of the shape's fill pattern.

Value | Description
0 - 100 | Represents the percentage of transparency. The default is 0% (completely opaque).

Remarks

Values are rounded to the nearest half percent. A value of 100% is completely transparent. Although a shape with a completely transparent fill appears the same as a shape with no fill on the drawing page, it will interact with other objects on the page in the same ways as if its transparency is 0%.

You can also set this value using the slider control in the Fill dialog box (on the Home tab, in the Shape group, click Fill, and then click Fill Options). This value controls the value of both the background and foreground fill transparencies. To set these values independently, you must enter them in the ShapeSheet window.

To get a reference to the FillBkgndTrans cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

FillBkgndTrans

To get a reference to the FillBkgndTrans cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillBkgndTrans


FillForegnd Cell (Fill Format Section)

 Copy code hover
[image]

FillForegnd Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the color used for the foreground (stroke) of the shape's fill pattern.

Remarks

To set the color, enter a number from 0 to 23.

To enter a custom color, use the RGB or HSL function. The value of a custom color is its RGB color, and RGB(r, g, b), rather than a number, will be shown in the ShapeSheet window. When used in numeric operations, custom colors have values of 24 and above.

You can set the transparency of the foreground fill in the FillForegndTrans cell.

To get a reference to the FillForegnd cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

FillForegnd

To get a reference to the FillForegnd cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillForegnd


FillForegndTrans Cell (Fill Format Section)

 Copy code hover
[image]

FillForegndTrans Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the transparency level for the foreground (fill) color of the shape's fill pattern.

Value | Description
0 - 100 | Represents the percentage of transparency. The default is 0% (completely opaque).

Remarks

Values are rounded to the nearest half percent. A value of 100% is completely transparent. Although a shape with a completely transparent fill appears the same as a shape with no fill on the drawing page, it will interact with other objects on the page in the same ways as if its transparency is 0%.

You can also set this value using the slider control in the Fill dialog box (on the Home tab, in the Shape group, click Fill, and then click Fill Options). This value controls the value of both the background and foreground fill transparencies. To set these values independently, you must enter them in the ShapeSheet window.

To get a reference to the FillForegndTrans cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

FillForegndTrans

To get a reference to the FillForegndTrans cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillForegndTrans


FillGradientAngle Cell (Gradient Properties Section)

 Copy code hover
[image]

FillGradientAngle Cell (Gradient Properties Section)
Send feedback

Published: July 16, 2012

Determines the angle of the fill gradient for gradients with a linear direction, in degrees.

Remarks

To get a reference to the FillGradientAngle cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

FillGradientAngle

To get a reference to the FillGradientAngle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGradientProperties
Cell index: | visFillGradientAngle


FillGradientDir Cell (Gradient Properties Section)

 Copy code hover
[image]

FillGradientDir Cell (Gradient Properties Section)
Send feedback

Published: July 16, 2012

Determines the direction of the fill gradient. A gradient can be linear, radial, rectangular, or follow a path.

Note Note

A linear gradient is the only gradient that takes an additional angle value (as determined by FillGradientDir cell). All other gradient directions have preset enumerations.

Value | Description
0 | Linear gradient. The FillGradientAngle cell determines the direction of the gradient.
1-7 | Radial gradients. The gradient extends outwards in a circle from a central point.
8-12 | Rectangular gradients. The gradient extends as a directional line from an origin with a rectangular-shaped fade.
13 | Path gradient.

Remarks

To get a reference to the FillGradientDir cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

FillGradientDir

To get a reference to the FillGradientDir cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGradientProperties
Cell index: | visFillGradientDir


FillGradientEnabled Cell (Gradient Properties Section)

 Copy code hover
[image]

FillGradientEnabled Cell (Gradient Properties Section)
Send feedback

Published: July 16, 2012

Determines whether a fill gradient is enabled for this shape.

Value | Description
TRUE | Gradient fill is displayed on the shape.
FALSE | Gradient fills are not displayed on the shape.

Remarks

To get a reference to the FillGradientEnabled cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

FillGradientEnabled

To get a reference to the FillGradientEnabled cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGradientProperties
Cell index: | visFillGradientEnabled


FillPattern Cell (Fill Format Section)

 Copy code hover
[image]

FillPattern Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the fill pattern for the shape. To specify a custom fill pattern, use the USE function in this cell.

Value | Description
0 | None (transparent fill).
1 | Solid foreground color.
2 - 40 | Assorted fill patterns that correspond to indexed entries in the Fill dialog box.

Remarks

You can also set this value using the Fill dialog box (on the Home tab, in the Shape group, click Fill and then click Fill Options).

To get a reference to the FillPattern cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

FillPattern

To get a reference to the FillPattern cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillPattern


Flags Cell (Paragraph Section)

 Copy code hover
[image]

Flags Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Indicates whether the text direction is left to right or right to left.

Value | Description
0 | The text direction is left to right (the default).
1 | The text direction is right to left.

Remarks

The value in this cell corresponds to the Direction setting on the Paragraph tab in the Text dialog box (on the Home tab, click the Font arrow), which appears only if a language that uses complex scripts text has been added in the Microsoft Office Language Preferences dialog box. (Click Start, click All Programs, click Microsoft Office, click Microsoft Office Tools, and then click Microsoft Office Language Preferences.)

To get a reference to the Flags cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para.Flags[i] where i = <1>, 2, 3...

To get a reference to the Flags cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visFlags


FlipX Cell (Shape Transform Section)

 Copy code hover
[image]

FlipX Cell (Shape Transform Section)
Send feedback

Published: July 16, 2012

Indicates whether the shape has been flipped horizontally.

Value | Description
TRUE | The shape has been flipped horizontally.
FALSE | The shape has not been flipped horizontally.

Remarks

To get a reference to the FlipX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

FlipX

To get a reference to the FlipX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXFormOut
Cell index: | visXFormFlipX


FlipY Cell (Shape Transform Section)

 Copy code hover
[image]

FlipY Cell (Shape Transform Section)
Send feedback

Published: July 16, 2012

Indicates whether the shape has been flipped vertically.

Value | Description
TRUE | The shape has been flipped vertically.
FALSE | The shape has not been flipped vertically.

Remarks

To get a reference to the FlipY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

FlipY

To get a reference to the FlipY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXFormOut
Cell index: | visXFormFlipY


FlyoutChild Cell (Actions Section)

 Copy code hover
[image]

FlyoutChild Cell (Actions Section)
Send feedback

Published: July 16, 2012

Determines whether the row is a child flyout menu of the last row above it that is not a flyout child.

Remarks

To get a reference to the FlyoutChild cell by name from another formula, or from a program by using the CellsU property, use the following.

Cell name:

Actions.name.FlyoutChildwhere Actions.name is the name of the Actions row

To get a reference to the FlyoutChild cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2...
Cell index: | visActionFlyoutChild


Font Cell (Character Section)

 Copy code hover
[image]

Font Cell (Character Section)
Send feedback

Published: July 16, 2012

Represents the number of the font used to format the text. Font numbers vary according to the fonts installed on your system. The number 0 represents the default font, which is typically Arial.

Remarks

To get a reference to the Font cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.Font[i]
where i = <1>, 2, 3...

To get a reference to the Font cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterFont


FontSchemeIndex Cell (Theme Properties Section

 Copy code hover
[image]

FontSchemeIndex Cell (Theme Properties Section
Send feedback

Published: July 16, 2012

Determines the font scheme of a theme that is applied to the shape, as an integer.

Remarks

To get a reference to the FontSchemeIndex cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

FontSchemeIndex

To get a reference to the FontSchemeIndex cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowThemeProperties
Cell index: | visFontSchemeIndex


Format Cell (Shape Data Section)

 Copy code hover
[image]

Format Cell (Shape Data Section)
Send feedback

Published: July 16, 2012

Specifies the formatting of a shape data item that is a string, a fixed list, a number, a variable list, a date or time, a duration, or a currency.

Remarks

Shape data item type | Value | Format cell contents
String | 0 | A format picture appropriate for the data type.
Fixed list | 1 | The items to appear in the list, separated by semicolons.
Number | 2 | A format picture appropriate for the data type.
Variable list | 4 | The items to appear in the list, separated by semicolons.
Date or time | 5 | A format picture appropriate for the data type.
Duration | 6 | A format picture appropriate for the data type.
Currency | 7 | A format picture appropriate for the data type.

As an example of specifying a format picture appropriate for the data type, the format picture "# #/4 UU" formats the number 12.43 in. as 12 2/4 INCHES. For more information about specifying a format picture, see About format pictures.

An example of specifying items for a list is "Engineering;Human Resources;Sales;Marketing".

Date values (type = 5) are displayed in the short date format. Currency values (type = 7) are displayed using the user's current setting for Currency on the Regional Options tab in the Regional and Language Options item in Control Panel.

A number (type = 2) can represent a dimension, scalar, angle, date, time, or currency. To ensure that an input number is always evaluated as a date, time, or currency, use the DATETIME or CY function in the Format cell instead of a format picture.

To get a reference to the Format cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Prop.name.Format
where Prop.name is the row name

To get a reference to the Format cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionProp
Row index: | visRowProp + i where i = 0, 1, 2...
Cell index: | visCustPropsFormat


Format Cell (Text Fields Section)

 Copy code hover
[image]

Format Cell (Text Fields Section)
Send feedback

Published: July 16, 2012

Specifies the formatting of a text field that is a string, a number, a date or time, a duration, or a currency.

Remarks

If the value of the Type cell is 0, 2, 5, 6, or 7 (string, number, date or time, duration, or currency, respectively), specify a format picture appropriate for the data type. For example, the format picture "# #/4 UU" formats the number 12.43 in. as 12 2/4 INCHES. For more information about specifying a format picture, see About format pictures.

A number (Type = 2) can represent a dimension, scalar, angle, date, time, or currency. To ensure that an input number is always evaluated as a date, time, or currency, use the DATETIME or CY function in the Format cell instead of a format picture.

To get a reference to the Format cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Fields.Format[i]
where i = <1>, 2, 3...

To get a reference to the Format cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionTextField
Row index: | visRowField + i where i = 0, 1, 2...
Cell index: | visFieldFormat


Frame Cell (Hyperlinks Section)

 Copy code hover
[image]

Frame Cell (Hyperlinks Section)
Send feedback

Published: July 16, 2012

Represents the name of a frame to target when the application is open as an Active document in a container application. The default is an empty string.

Remarks

To get a reference to the Frame cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Hyperlink.name.Frame
where Hyperlink.name is the row name

To get a reference to the Frame cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionHyperlink
Row index: | visRow1stHyperlink + i where i = 0, 1, 2...
Cell index: | visHLinkFrame


Gamma Cell (Image Properties Section)

 Copy code hover
[image]

Gamma Cell (Image Properties Section)
Send feedback

Published: July 16, 2012

Adjusts or corrects the intensity of an image for a particular output device, such as a monitor or scanner. The default value is 1 (no correction).

Remarks

To get a reference to the Gamma cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Gamma

To get a reference to the Gamma cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowImage
Cell index: | visImageGamma


GlowColor Cell (Additional Effect Properties Section)

 Copy code hover
[image]

GlowColor Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the color used for the stroke of the external glow applied to a shape, as an RGB or theme value.

Remarks

To get a reference to the GlowColor cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

GlowColor

To get a reference to the GlowColor cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visGlowColor


GlowColorTrans Cell (Additional Effect Properties Section)

 Copy code hover
[image]

GlowColorTrans Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the transparency level for the color used for the stroke of the shape's glow, as a percentage.

Remarks

To get a reference to the GlowColorTrans cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

GlowColorTrans

To get a reference to the GlowColorTrans cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visGlowColorTrans


GlowSize Cell (Additional Effect Properties Section)

 Copy code hover
[image]

GlowSize Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the size of the external glow of a shape in points.

Remarks

To get a reference to the GlowSize cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

GlowSize

To get a reference to the GlowSize cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visGlowSize


Glue Cell (Layers Section)

 Copy code hover
[image]

Glue Cell (Layers Section)
Send feedback

Published: July 16, 2012

Specifies whether shapes belonging to the layer can be glued.

Value | Description
TRUE | Glue is enabled.
FALSE | Glue is disabled.

Remarks

This cell corresponds to the Glue option in the Layer Properties dialog box (on the Home tab, in the Editing group, click Layers , and then click Layer Properties ).

To get a reference to the Glue cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Layers.Glue[ i ] where i = <1>, 2, 3...

To get a reference to the Glue cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionLayer
Row index: | visRowLayer + i where i = 0, 1, 2...
Cell index: | visLayerGlue


GlueType Cell (Glue Info Section)

 Copy code hover
[image]

GlueType Cell (Glue Info Section)
Send feedback

Published: July 16, 2012

Determines whether a 1-D shape uses static (point-to-point) or dynamic (shape-to-shape) glue when it is glued to another shape.

Value | Description | Automation constant
&H0 | Default. Allow dynamic glue for the dynamic connector only; otherwise, use static glue. | visGlueTypeDefault
&H1 | Allow dynamic glue. | Obsolete in Visio 2002
&H2 | Allow dynamic glue. | visGlueTypeWalking
&H4 | Do not allow dynamic glue. | visGlueTypeNoWalking
&H8 | Do not allow this 2-D shape to be connected to with dynamic glue. | visGlueTypeNoWalkingTo

Remarks

If this cell contains a value of 1, 2 or 3, dynamic glue will be established when either of the following occurs:

  • Shapes are dynamically glued in the user interface.

  • Shapes are glued to the PinX or PinY cell of another shape from a program.

If shapes are glued to shape cells other than PinX or PinY from a program, then static glue is used.

Changing this value from allowing to not allowing dynamic glue does not sever or change existing dynamic glue. Programs can establish dynamic glue even if dynamic glue is disabled in the GlueType cell.

To get a reference to the GlueType cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

GlueType

To get a reference to the GlueType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visGlueType


HAlign Cell (Paragraph Section)

 Copy code hover
[image]

HAlign Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Determines the horizontal alignment of text in the shape's text block.

Value | Description | Automation constant
0 | Left align | visHorzLeft
1 | Center | visHorzCenter
2 | Right align | visHorzRight
3 | Justify | visHorzJustify
4 | Force justify | visHorzForce

Remarks

Justify adds space between words in every line except the last line of the paragraph to align both the left and right sides of text with the margins.

Force justify justifies every line in the paragraph, including the last.

To get a reference to the HAlign cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para.HorzAlign[i]
where i = <1>, 2, 3...

To get a reference to the HAlign cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visHorzAlign


Height Cell (Shape Transform Section)

 Copy code hover
[image]

Height Cell (Shape Transform Section)
Send feedback

Published: July 16, 2012

Determines the height of the shape in drawing units.

Remarks

To get a reference to the Height cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Height

To get a reference to the Height cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXFormOut
Cell index: | visXFormHeight


HideForApply Cell (Style Properties Section)

 Copy code hover
[image]

HideForApply Cell (Style Properties Section)
Send feedback

Published: July 16, 2012

Determines where a style is shown in the Microsoft Visio user interface.

Value | Description
TRUE | Show the style only in the Drawing Explorer.
FALSE | Show the style in the Drawing Explorer.

Remarks

When you base a new style on a style that is hidden, the new style does not inherit this attribute.

To get a reference to the HideForApply cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

HideForApply

To get a reference to the HideForApply cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowStyle
Cell index: | visStyleHidden


HideText Cell (Miscellaneous Section)

 Copy code hover
[image]

HideText Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Hides the text for a shape. You can view text, edit properties, and apply styles to the text in the text block, although the changes will not appear until you reset HideText to FALSE (0).

Value | Description
TRUE | Text is hidden and does not print.
FALSE | Text is not hidden.

Remarks

To get a reference to the HideText cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

HideText

To get a reference to the HideText cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visHideText


ImgHeight Cell (Foreign Image Info Section)

 Copy code hover
[image]

ImgHeight Cell (Foreign Image Info Section)
Send feedback

Published: July 16, 2012

Determines the height of the object's image within its border. The default formula is:

= Height * 1

Remarks

To get a reference to the ImgHeight cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ImgHeight

To get a reference to the ImgHeight cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowForeign
Cell index: | visFrgnImgHeight


ImgOffsetX Cell (Foreign Image Info Section)

 Copy code hover
[image]

ImgOffsetX Cell (Foreign Image Info Section)
Send feedback

Published: July 16, 2012

Determines the distance the object is offset horizontally from the origin of the object's border. The default is 0. Panning the object with the Crop tool changes this value.

Remarks

To get a reference to the ImgOffsetX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ImgOffsetX

To get a reference to the ImgOffsetX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowForeign
Cell index: | visFrgnImgOffsetX


ImgOffsetY Cell (Foreign Image Info Section)

 Copy code hover
[image]

ImgOffsetY Cell (Foreign Image Info Section)
Send feedback

Published: July 16, 2012

Determines the distance the object is offset vertically from the origin of the object's border. The default is 0. Panning the object with the Crop tool changes this value.

Remarks

To get a reference to the ImgOffsetY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ImgOffsetY

To get a reference to the ImgOffsetY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowForeign
Cell index: | visFrgnImgOffsetY


ImgWidth Cell (Foreign Image Info Section)

 Copy code hover
[image]

ImgWidth Cell (Foreign Image Info Section)
Send feedback

Published: July 16, 2012

Determines the width of the object's image within its border. The default formula is:

= Width * 1

Cropping the object changes the factor by which Width is multiplied.

Remarks

To get a reference to the ImgWidth cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ImgWidth

To get a reference to the ImgWidth cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowForeign
Cell index: | visFrgnImgWidth


IndFirst Cell (Paragraph Section)

 Copy code hover
[image]

IndFirst Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Represents the distance the first line of each paragraph in the shape's text block is indented from the left indent of the paragraph. This value is independent of the scale of the drawing. If the drawing is scaled, the first line indent remains the same.

Remarks

To get a reference to the IndFirst cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para.IndFirst[i]
where i = <1>, 2, 3...

To get a reference to the IndFirst cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visIndentFirst


IndLeft Cell (Paragraph Section)

 Copy code hover
[image]

IndLeft Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Represents the distance all lines of text in a paragraph are indented from the left margin of the text block. This value is independent of the scale of the drawing. If the drawing is scaled, the left indent remains the same.

Remarks

To get a reference to the IndLeft cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para.IndLeft[i]
where i = <1>, 2, 3...

To get a reference to the IndLeft cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visIndentLeft


IndRight Cell (Paragraph Section)

 Copy code hover
[image]

IndRight Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Represents the distance all lines of text in a paragraph are indented from the right margin of the text block. This value is independent of the scale of the drawing. If the drawing is scaled, the right indent remains the same.

Remarks

To get a reference to the IndRight cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para.IndRight[i]
where i = <1>, 2, 3...

To get a reference to the IndRight cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visIndentRight


InhibitSnap Cell (Page Properties Section)

 Copy code hover
[image]

InhibitSnap Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the shapes on a foreground page snap to other objects on the page and shapes on the background page.

Value | Description
TRUE | Inhibit all snapping on the page, except for snapping to the ruler and grid.
FALSE | Enable snapping.

Remarks

To get a reference to the InhibitSnap cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

InhibitSnap

To get a reference to the InhibitSnap cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageInhibitSnapIndentRight


Initials Cell (Reviewer Section)

 Copy code hover
[image]

Initials Cell (Reviewer Section)
Send feedback

Published: July 16, 2012

Contains the initials of a document reviewer.

Remarks

This value defaults to the initials in the Initials box on the General tab in the Visio Options dialog box (click the File tab, click Options, and then click General ).

To get a reference to the Initials cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Reviewer.Initials [i] where i = <1>, 2, 3...

To get a reference to the Initials cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionReviewer
Row index: | visRowReviewer + i where i = 0, 1, 2...
Cell index: | visReviewerInitials


Invisible Cell (Actions Section)

 Copy code hover
[image]

Invisible Cell (Actions Section)
Send feedback

Published: July 16, 2012

Indicates whether the action is visible on the action tag or shortcut menu.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Value | Description
TRUE | The action is not visible on the menu.
FALSE | The action is visible on the menu (the default).

Remarks

To get a reference to the Invisible cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Actions.name.Invisiblewhere Actions.name is the name of the Actions row

To get a reference to the Invisible cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2...
Cell index: | visActionInvisible


Invisible Cell (Hyperlinks Section)

 Copy code hover
[image]

Invisible Cell (Hyperlinks Section)
Send feedback

Published: July 16, 2012

Indicates whether a hyperlink appears on the shortcut menu for a shape or page.

Value | Description
TRUE | The hyperlink does not appear as a menu item on the shortcut menu.
FALSE | The hyperlink does appear as a menu item on the shortcut menu (the default).

Remarks

To get a reference to the Invisible cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Hyperlink.name.Invisible where Hyperlink.name is the row name

To get a reference to the Invisible cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionHyperlink
Row index: | visRow1stHyperlink + i where i = 0, 1, 2...
Cell index: | visHLinkInvisible


Invisible Cell (Shape Data Section)

 Copy code hover
[image]

Invisible Cell (Shape Data Section)
Send feedback

Published: July 16, 2012

Specifies whether the shape data item is visible in the Shape Data window.

Value | Description
TRUE | Shape data item is not visible.
FALSE | Shape data item is visible.

Remarks

The value in this cell corresponds to the Hidden check box in the Define Shape Data dialog box (right-click the shape, point to Data, and then click Define Shape Data).

To get a reference to the Invisible cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Prop.name.Invisible where Prop.name is the row name

To get a reference to the Invisible cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionProp
Row index: | visRowProp + i where i = 0, 1, 2...
Cell index: | visCustPropsInvis


IsDropSource Cell (Miscellaneous Section)

 Copy code hover
[image]

IsDropSource Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Determines whether the shape can be added to a group by dropping it onto the group.

Value | Description
TRUE | Can add the shape to a group by dropping it onto the group.
FALSE | Cannot add the shape to a group.

Remarks

You can also set this value by selecting the shape, clicking Behavior on the Developer tab, and then selecting the Add shape to groups on drop check box.

In addition to enabling this behavior for a shape, you must also enable a group to accept shapes that are dragged into it. To do so, select the group, click Behavior on the Developer tab, and then select the Accept dropped shapes check box. This value is stored in the IsDropTarget cell in the Group Properties section.

To get a reference to the IsDropSource cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

IsDropSource

To get a reference to the IsDropSource cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visDropSource


IsDropTarget Cell (Group Properties Section)

 Copy code hover
[image]

IsDropTarget Cell (Group Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the group allows you to add a shape to it by dropping it on the group.

Value | Description
TRUE | Can add a shape to the group by dropping it onto the group.
FALSE | Cannot drop shape onto the group.

Remarks

You can also set this value by selecting the group, clicking Behavior on the Developer tab, and then selecting the Accept dropped shapes check box.

To add a shape to a group by dropping it on the group, you must also enable similar shape behavior. You must select the shape, click Behavior on the Developer tab, and then select the Add shape to groups on drop check box. This value is stored in the IsDropSource cell in the Miscellaneous section.

To get a reference to the IsDropTarget cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

IsDropTarget

To get a reference to the IsDropTarget cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGroup
Cell index: | visGroupIsDropTarget


IsSnapTarget Cell (Group Properties Section)

 Copy code hover
[image]

IsSnapTarget Cell (Group Properties Section)
Send feedback

Published: July 16, 2012

Determines whether you snap to a group or to shapes within the group.

Value | Description
TRUE | Enable snapping to shapes within a group.
FALSE | Snap only to the group.

Remarks

You can also set this value by selecting the group, clicking Behavior on the Developer tab, and then selecting the Snap to member shapes check box.

To get a reference to the IsSnapTarget cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

IsSnapTarget

To get a reference to the IsSnapTarget cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGroup
Cell index: | visGroupIsSnapTarget


IsTextEditTarget Cell (Group Properties Section)

 Copy code hover
[image]

IsTextEditTarget Cell (Group Properties Section)
Send feedback

Published: July 16, 2012

Determines text assignment for a group.

Value | Description
TRUE | Text is added to the group shape.
FALSE | Text is added to the shape in the group at the top of the stacking order.

Remarks

You can also set this value by selecting the group, clicking Behavior on the Developer tab, and then selecting the Edit text of group check box.

Groups created in versions earlier than Visio 2000 have a default value of FALSE. Beginning with Visio version 2000, the default value is TRUE.

To get a reference to the IsTextEditTarget cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

IsTextEditTarget

To get a reference to the IsTextEditTarget cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGroup
Cell index: | visGroupIsTextEditTarget


KeepTextFlat Cell (3-D Rotation Properties Section)

 Copy code hover
[image]

KeepTextFlat Cell (3-D Rotation Properties Section)
Send feedback

Published: July 16, 2012

Indicates whether a shape's text will ignore the shape's rotation in 3-D. Does not apply to 2-D rotation.

Value | Description
TRUE | Shape text does not rotate with the shape's geometry.
FALSE | Shape text is transformed to rotate with the shape's geometry.

Remarks

To get a reference to the KeepTextFlat cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

KeepTextFlat

To get a reference to the KeepTextFlat cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRow3DProperties
Cell index: | visKeepTextFlat


Label Cell (Shape Data Section)

 Copy code hover
[image]

Label Cell (Shape Data Section)
Send feedback

Published: July 16, 2012

Specifies the label that appears to users in the Shape Data window. A label consists of alphanumeric characters, including the underscore (_) character.

Remarks

The application automatically encloses the Label string in quotation marks in the cell, but the quotation marks are not displayed in the Shape Data window.

If no label text is found, Visio displays the row name (Prop.Row) in the Shape Data window.

To get a reference to the Label cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Prop.Name.Label where Prop.Name is the row name

To get a reference to the Label cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionProp
Row index: | visRowProp + i where i = 0, 1, 2...
Cell index: | visCustPropsLabel


LangID Cell (Shape Data Section)

 Copy code hover
[image]

LangID Cell (Shape Data Section)
Send feedback

Published: July 16, 2012

Indicates the language in which the shape data value was entered.

Remarks

For a list of languages supported by Microsoft Office System applications, see the DocLangID Cell (Document Properties Section).

To get a reference to the LangID cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Prop.name.LangID
where Prop.name is the row name

To get a reference to the LangID cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionProp
Row index: | visRowProp + i where i = 0, 1, 2...
Cell index: | visCustPropsLangID


LangID Cell (Miscellaneous Section)

 Copy code hover
[image]

LangID Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Indicates the language in which cell formulas were created.

Remarks

For a list of languages supported by Microsoft Office applications, see the DocLangID Cell (Document Properties Section) topic.

To get a reference to the LangID cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LangID

To get a reference to the LangID cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visObjLangID


LangID Cell (Character Section)

 Copy code hover
[image]

LangID Cell (Character Section)
Send feedback

Published: July 16, 2012

Indicates the language in which the text was entered.

Remarks

For a list of languages supported by Microsoft Office applications, see the DocLangID Cell (Document Properties Section) topic.

To get a reference to the LangID cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.LangID[i]
where i = <1>, 2, 3...

To get a reference to the LangID cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterLangID


LangID Cell (Annotation Section)

 Copy code hover
[image]

LangID Cell (Annotation Section)
Send feedback

Published: July 16, 2012

Indicates the language in which the comment was entered.

Note Note

This cell is used for tracking comments only when opening a .vsd file in Microsoft Visio 2013 or when saving a .vsdx file in the .vsd file format. It is not used for tracking comments in .vsdx documents in Visio 2013.

Remarks

This value is the locale ID (LCID) of the language that is active on the language bar when the comment was entered. For a list of languages supported by Microsoft Office applications, see the DocLangID Cell (Document Properties Section) topic.

To get a reference to the LangID cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Annotation.LangID[i]
where i = <1>, 2, 3...

To get a reference to the LangID cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAnnotation
Row index: | visRowAnnotation + i where i = 0, 1, 2...
Cell index: | visAnnotationLangID


LeftMargin Cell (Text Block Format Section)

 Copy code hover
[image]

LeftMargin Cell (Text Block Format Section)
Send feedback

Published: July 16, 2012

Determines the distance between the left border of the text block and the text it contains. The default is 0.1 inch. This value is independent of the scale of the drawing. If the drawing is scaled, the left margin remains the same.

Remarks

To get a reference to the LeftMargin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LeftMargin

To get a reference to the LeftMargin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowText
Cell index: | visTxtBlkLeftMargin


LineAdjustFrom Cell (Page Layout Section)

 Copy code hover
[image]

LineAdjustFrom Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines which dynamic connectors the application spaces apart if they route on top of each other.

Value | Adjustment | Automation constant
0 | Unrelated lines | visPLOLineAdjustFromNotRelated
1 | All lines | visPLOLineAdjustFromAll
2 | No lines | visPLOLineAdjustFromNone
3 | Routing style default | visPLOLineAdjustFromRoutingDefault

Remarks

You can also set the value of this cell on the Layout and Routing tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow, and then click Layout and Routing).

To get a reference to the LineAdjustFrom cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineAdjustFrom

To get a reference to the LineAdjustFrom cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOLineAdjustFrom


LineAdjustTo Cell (Page Layout Section)

 Copy code hover
[image]

LineAdjustTo Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines which dynamic connectors line up on top of one another.

Value | Adjustment | Automation constant
0 | Routing style default | visPLOLineAdjustToDefault
1 | Lines that are close to each other | visPLOLineAdjustToAll
2 | No lines | visPLOLineAdjustToNone
3 | Related lines | visPLOLineAdjustToRelated

Remarks

You can also set the value of this cell on the Layout and Routing tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow, and then click Layout and Routing).

To get a reference to the LineAdjustTo cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineAdjustTo

To get a reference to the LineAdjustTo cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOLineAdjustTo


LineCap Cell (Line Format Section)

 Copy code hover
[image]

LineCap Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Indicates whether a line has rounded, square, or extended line caps.

Value | Line end style
0 | Rounded
1 | Square
2 | Extended

Remarks

You can also set the value of this cell in the Line dialog box (on the Home tab, in the Shape group, click Line, point to Arrows, and then click More Arrows).

To get a reference to the LineCap cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineCap

To get a reference to the LineCap cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visLineEndCap


LineColor Cell (Line Format Section)

 Copy code hover
[image]

LineColor Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Determines the line color of the shape.

Remarks

To set the line color, enter a number from 0 to 23, which is an index into a collection of line colors. You can view the line color collection in the Line dialog box (on the Home tab, in the Shape group, click Line, point to Weight, and then click More Lines). You can also set the value of LineColor in the Line dialog box.

To enter a custom color, use the RGB or HSL function. The value of a custom color is its RGB color, and RGB(r, g, b), rather than a number, will be shown in the ShapeSheet window. When used in numeric operations, custom colors have values of 24 and above.

You can set the transparency of the line color in the LineColorTrans cell.

To get a reference to the LineColor cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineColor

To get a reference to the LineColor cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visLineColor


LineColorTrans Cell (Line Format Section)

 Copy code hover
[image]

LineColorTrans Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Determines the transparency level of a shape's line color.

Value | Description
0 - 100 | Represents the percentage of transparency. The default is 0% (completely opaque).

Remarks

Values are rounded to the nearest half percent. A value of 100% is completely transparent. Although a shape with a completely transparent line color appears the same as a shape with no lines on the drawing page, it will interact with other objects on the page in the same ways as if its transparency is 0%.

You can also set this value by using the slider control in the Line dialog box (on the Home tab, in the Shape group, click Line, point to Weight, and then click More Lines).

To get a reference to the LineColorTrans cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineColorTrans

To get a reference to the LineColorTrans cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visLineColorTrans


LineGradientAngle Cell (Gradient Properties Section)

 Copy code hover
[image]

LineGradientAngle Cell (Gradient Properties Section)
Send feedback

Published: July 16, 2012

Determines the angle of the line gradient for a linear gradient, from 0 to 359.9 degrees.

Remarks

To get a reference to the LineGradientAngle cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

LineGradientAngle

To get a reference to the LineGradientAngle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGradientProperties
Cell index: | visLineGradientAngle


LineGradientDir Cell (Gradient Properties Section)

 Copy code hover
[image]

LineGradientDir Cell (Gradient Properties Section)
Send feedback

Published: July 16, 2012

Determines the direction of the line gradient. A gradient can be linear, radial, rectangular, or follow a path.

Note Note

A linear gradient is the only gradient that takes an additional angle value (as determined by LineGradientDir cell). All other gradient directions have preset enumerations.

Value | Description
0 | Linear gradient. The LineGradientAngle cell determines the direction of the gradient.
1-7 | Radial gradients. The gradient extends outwards in a circle from a central point.
8-12 | Rectangular gradients. The gradient extends as a directional line from an origin with a rectangular-shaped fade.
13 | Path gradient.

Remarks

To get a reference to the LineGradientDir cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

LineGradientDir

To get a reference to the LineGradientDir cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGradientProperties
Cell index: | visLineGradientDir


LineGradientEnabled Cell (Gradient Properties Section)

 Copy code hover
[image]

LineGradientEnabled Cell (Gradient Properties Section)
Send feedback

Published: July 16, 2012

Determines whether a line gradient is enabled for a line or border of a shape.

Value | Description
TRUE | Gradient is displayed on the line or border of a shape.
FALSE | Gradients are not displayed on the line or border of a shape.

Remarks

To get a reference to the LineGradientEnabled cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

LineGradientEnabled

To get a reference to the LineGradientEnabled cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGradientProperties
Cell index: | visLineGradientEnabled


LineJumpCode Cell (Page Layout Section)

 Copy code hover
[image]

LineJumpCode Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the connectors to which you want to add jumps.

Value | Connectors to which you want to add jumps | Automation constant
0 | None | visPLOJumpNone
1 | Horizontal lines | visPLOJumpHorizontal
2 | Vertical lines | visPLOJumpVertical
3 | Last routed line | visPLOJumpLastRouted
4 | Last displayed line (top shape in the z-order) | visPLOJumpDisplayOrder
5 | First displayed line (shape at the bottom of the z-order) | visPLOJumpReverseDisplayOrder

Remarks

You can also set the value of this cell on the Layout and Routing tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow, and then click Layout and Routing).

To get a reference to the LineJumpCode cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineJumpCode

To get a reference to the LineJumpCode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOJumpCode


LineJumpFactorX Cell (Page Layout Section)

 Copy code hover
[image]

LineJumpFactorX Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the size of line jumps on horizontal dynamic connectors on the page, relative to the value of the LineToLineX cell. The value of this cell can range from 0 to 10 but fractional values from 0 to 1 are suggested.

Remarks

You can also set the value of this cell on the Layout and Routing tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow, and then click Layout and Routing).

To get a reference to the LineJumpFactorX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineJumpFactorX

To get a reference to the LineJumpFactorX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOJumpFactorX


LineJumpFactorY Cell (Page Layout Section)

 Copy code hover
[image]

LineJumpFactorY Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the size of line jumps on vertical dynamic connectors on the page, relative to the value of the LineToLineY cell. The value of this cell can range from 0 to 10 but fractional values from 0 to 1 are suggested.

Remarks

You can also set the value of this cell on the Layout and Routing tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow, and then click Layout and Routing).

To get a reference to the LineJumpFactorY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineJumpFactorY

To get a reference to the LineJumpFactorY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOJumpFactorY


LineJumpStyle Cell (Page Layout Section)

 Copy code hover
[image]

LineJumpStyle Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the line jump style for all connectors on the drawing page that don't have a local line jump style.

Value | Line jump style | Automation constant
0 | Arc | visLOJumpStyleDefault
1 | Arc | visLOJumpStyleArc
2 | Gap | visLOJumpStyleGap
3 | Square | visLOJumpStyleSquare
4 | 2 sides | visLOJumpStyleTriangle
5 | 3 sides | visLOJumpStyle2Point
6 | 4 sides | visLOJumpStyle3Point
7 | 5 sides | visLOJumpStyle4Point
8 | 6 sides | visLOJumpStyle5Point
9 | 7 sides | visLOJumpStyle6Point

Remarks

You can also set the value of this cell on the Layout and Routing tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow, and then click Layout and Routing).

To get a reference to the LineJumpStyle cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineJumpStyle

To get a reference to the LineJumpStyle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOJumpStyle


LinePattern Cell (Line Format Section)

 Copy code hover
[image]

LinePattern Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Determines the line pattern of the shape. The value entered in the LinePattern cell is a number that is an index into a collection of line patterns.

Value | Description
0 | No line pattern
1 | Solid
2 - 23 | Assorted line patterns

Remarks

You can view the line pattern collection in the Line dialog box (on the Home tab, in the Shape group, click Line, point to Dashes, and then click More Lines).

To specify a custom line pattern, use the USE function in this cell.

To get a reference to the LinePattern cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LinePattern

To get a reference to the LinePattern cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visLinePattern


LineRouteExt Cell (Page Layout Section)

 Copy code hover
[image]

LineRouteExt Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the default appearance for all connectors on a drawing page.

Value | Description | Automation constant
0 | Default (straight) | visLORouteExtDefault
1 | Straight | visLORouteExtStraight
2 | Curved | visLORouteExtNURBS

Remarks

To get a reference to the LineRouteExt cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineRouteExt

To get a reference to the LineRouteExt cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOLineRouteExt


LineToLineX Cell (Page Layout Section)

 Copy code hover
[image]

LineToLineX Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the horizontal clearance between all connectors on the drawing page.

Remarks

You can also set the value of this cell in the Layout and Routing Spacing dialog box. (On the Design tab, click the Page Setup arrow, click Layout and Routing, and then click Spacing.)

To get a reference to the LineToLineX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineToLineX

To get a reference to the LineToLineX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOLineToLineX


LineToLineY Cell (Page Layout Section)

 Copy code hover
[image]

LineToLineY Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the vertical clearance between all connectors on the drawing page.

Remarks

You can also set the value of this cell in the Layout and Routing Spacing dialog box. (On the Design tab, click the Page Setup arrow, click Layout and Routing, and then click Spacing.)

To get a reference to the LineToLineY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineToLineY

To get a reference to the LineToLineY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOLineToLineY


LineToNodeX Cell (Page Layout Section)

 Copy code hover
[image]

LineToNodeX Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the horizontal clearance between all connectors and shapes on the drawing page.

Remarks

You can also set the value of this cell in the Layout and Routing Spacing dialog box. (On the Design tab, click the Page Setup arrow, click Layout and Routing, and then click Spacing.)

To get a reference to the LineToNodeY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineToNodeX

To get a reference to the LineToNodeX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOLineToNodeX


LineToNodeY Cell (Page Layout Section)

 Copy code hover
[image]

LineToNodeY Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the vertical clearance between all connectors and shapes on the drawing page.

Remarks

You can also set the value of this cell in the Layout and Routing Spacing dialog box. (On the Design tab, click the Page Setup arrow, click Layout and Routing, and then click Spacing.)

To get a reference to the LineToNodeY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineToNodeY

To get a reference to the LineToNodeY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOLineToNodeY


LineWeight Cell (Line Format Section)

 Copy code hover
[image]

LineWeight Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Determines the line weight of a shape. Set the line weight by entering a number with a valid unit of measure.

Remarks

You can also set the value of LineWeight in the Line dialog box (on the Home tab, in the Shape group, click Line, point to Weight, and then click More Lines).

If the unit of measure is not entered, the unit of measure for text specified in the Visio Options dialog box is used (click the File tab, and then click Options). Line weight is independent of the scale of the drawing. If the drawing is scaled, the line weight remains the same.

To get a reference to the LineWeight cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LineWeight

To get a reference to the LineWeight cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visLineWeight


LocalizeMerge Cell (Miscellaneous Section)

 Copy code hover
[image]

LocalizeMerge Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Determines whether shapes are localized when copied between documents.

Value | Description
TRUE | Localize a shape in the language of the destination document.
FALSE | Do not localize a shape based on the language of the destination document (the default).

Remarks

To get a reference to the LocalizeMerge cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LocalizeMerge

To get a reference to the LocalizeMerge cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visObjLocalizeMerge


Lock Cell (Layers Section)

 Copy code hover
[image]

Lock Cell (Layers Section)
Send feedback

Published: July 16, 2012

Specifies whether shapes belonging to the layer are locked against being selected or edited.

Value | Description
TRUE | Shapes are locked.
FALSE | Shapes are not locked.

Remarks

You can also set this value by selecting Lock in the Layer Properties dialog box (on the Home tab, in the Editing group, click Layers, and then click Layer Properties).

To get a reference to the Lock cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Layers.Locked[i] where i = <1>, 2, 3...

To get a reference to the Lock cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionLayer
Row index: | visRowLayer + i where i = 0, 1, 2...
Cell index: | visLayerLock


LockAspect Cell (Protection Section)

 Copy code hover
[image]

LockAspect Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the aspect ratio of the shape so that the shape can only be sized proportionally; it cannot be sized in a single dimension.

Value | Description
TRUE | Aspect ratio is locked.
FALSE | Aspect ratio is not locked.

Remarks

To get a reference to the LockAspect cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockAspect

To get a reference to the LockAspect cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockAspect


LockBegin Cell (Protection Section)

 Copy code hover
[image]

LockBegin Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the begin point (BeginX, BeginY) of a 1-D shape to a specific location.

Value | Description
TRUE | Begin point is locked.
FALSE | Begin is not locked.

Remarks

To get a reference to the LockBegin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockBegin

To get a reference to the LockBegin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockBegin


LockCalcWH Cell (Protection Section)

 Copy code hover
[image]

LockCalcWH Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks a shape's selection rectangle so it cannot be recalculated when a vertex is edited or a row type is changed in the Geometry section.

Value | Description
TRUE | Width and height cannot be recalculated.
FALSE | Width and height can be recalculated.

Remarks

To get a reference to the LockCalcWH cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockCalcWH

To get a reference to the LockCalcWH cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockCalcWH


LockCrop Cell (Protection Section)

 Copy code hover
[image]

LockCrop Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks an object from another program against being cropped with the Crop tool.

Value | Description
TRUE | Shape cannot be cropped
FALSE | Shape can be cropped.

Remarks

To get a reference to the LockCrop cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockCrop

To get a reference to the LockCrop cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockCrop


LockCustProp Cell (Protection Section)

 Copy code hover
[image]

LockCustProp Cell (Protection Section)
Send feedback

Published: July 16, 2012

Determines whether the user can add, delete, or modify shape data in the user interface (UI) by using the Define Shape Data dialog box or the shortcut menu for the Shape Data window.

Value | Description
TRUE | The Define Shape Data command on the shortcut menu in the Shape Data window is disabled.
FALSE | The Define Shape Data command on the shortcut menu in the Shape Data window is enabled (the default).

Remarks

A value of TRUE does not prevent a user from changing the value of a shape data item or changing the Shape Data section in the ShapeSheet window.

To get a reference to the LockCustProp cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockCustProp

To get a reference to the LockCustProp cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockCustProp


LockDelete Cell (Protection Section)

 Copy code hover
[image]

LockDelete Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the shape so that it cannot be deleted.

Value | Description
TRUE | Shape cannot be deleted
FALSE | Shape can be deleted.

Remarks

To get a reference to the LockDelete cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockDelete

To get a reference to the LockDelete cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockDelete


LockEnd Cell (Protection Section)

 Copy code hover
[image]

LockEnd Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the endpoint (EndX, EndY) of a 1-D shape to a specific location.

Value | Description
TRUE | Endpoint is locked.
FALSE | Endpoint is not locked.

Remarks

To get a reference to the LockEnd cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockEnd

To get a reference to the LockEnd cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockEnd


LockFormat Cell (Protection Section)

 Copy code hover
[image]

LockFormat Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the formatting of a shape so it cannot be changed.

Value | Description
TRUE | Formatting cannot be changed.
FALSE | Formatting can be changed.

Remarks

To get a reference to the LockFormat cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockFormat

To get a reference to the LockFormat cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockFormat


LockFromGroupFormat Cell (Protection Section)

 Copy code hover
[image]

LockFromGroupFormat Cell (Protection Section)
Send feedback

Published: July 16, 2012

Blocks format changes to a group shape from being propagated to its sub-shapes, while still allowing users to format selected sub-shapes directly.

The value of the LockFromGroupFormat cell corresponds to the From group formatting check box setting in the Protection dialog box.

To refer to the LockFromGroupFormat cell by name from another formula, or from a program, using the CellsU property, use:

Cell name:

LockFromGroupFormat

To refer to the LockFromGroupFormat cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockFromGroupFormat

The default value for the cell is 0 (False).


LockGroup Cell (Protection Section)

 Copy code hover
[image]

LockGroup Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks a group so that it cannot be ungrouped.

Value | Description
TRUE | Group cannot be ungrouped.
FALSE | Group can be ungrouped.

Remarks

Setting the LockGroupCell value to TRUE also prevents deletion of any shapes that are members of the group.

To get a reference to the LockGroup cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockGroup

To get a reference to the LockGroup cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockGroup


LockHeight Cell (Protection Section)

 Copy code hover
[image]

LockHeight Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the height of the shape so that its height remains unchanged when the shape is resized.

Value | Description
TRUE | Height is locked.
FALSE | Height is not locked.

Remarks

To get a reference to the LockHeight cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockHeight

To get a reference to the LockHeight cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockHeight


LockMoveX Cell (Protection Section)

 Copy code hover
[image]

LockMoveX Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the horizontal position of the shape so it cannot be moved horizontally.

Value | Description
TRUE | Horizontal position is locked.
FALSE | Horizontal position is not locked.

Remarks

To get a reference to the LockMoveX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockMoveX

To get a reference to the LockMoveX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockMoveX


LockMoveY Cell (Protection Section)

 Copy code hover
[image]

LockMoveY Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the vertical position of the shape so it cannot be moved vertically.

Value | Description
TRUE | Vertical position is locked.
FALSE | Vertical position is not locked.

Remarks

To get a reference to the LockMoveY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockMoveY

To get a reference to the LockMoveY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockMoveY


LockPreview Cell (Document Properties Section)

 Copy code hover
[image]

LockPreview Cell (Document Properties Section)
Send feedback

Published: July 16, 2012

Determines whether a preview is saved each time you save a drawing.

Value | Description
TRUE | Do not save a preview each time a drawing is saved.
FALSE | Save a preview each time a drawing is saved.

Remarks

To get a reference to the LockPreview cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockPreview

To get a reference to the LockPreview cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowDoc
Cell index: | visDocLockPreview


LockReplace Cell (Protection Section)

 Copy code hover
[image]

LockReplace Cell (Protection Section)
Send feedback

Published: July 16, 2012

Indicates whether a shape can participate in a replacement operation (as either a target or a replacement shape).

Value | Description
TRUE | The shape cannot be replaced or be used as a replacement shape. For a shape on the canvas, the Change Shape button is disabled when the shape is selected. For a shape on a stencil, the shape does not appear as a replacement shape when the Change Shape button is clicked.
FALSE | The shape can be replaced or used as a replacement shape.

Remarks

To get a reference to the LockReplace cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

LockReplace

To get a reference to the LockReplace cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockReplace


LockRotate Cell (Protection Section)

 Copy code hover
[image]

LockRotate Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks 2-D shapes against being rotated with the rotation handle or the Rotate Left 90° or Rotate Right 90° command.

Value | Description
TRUE | Shape cannot be rotated.
FALSE | Shape can be rotated (the default).

Remarks

The LockRotate cell does not prevent a 1-D shape from being rotated when an endpoint is dragged. To lock a 1-D shape against rotation, set the LockWidth cell to a non-zero value (TRUE).

To get a reference to the LockRotate cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockRotate

To get a reference to the LockRotate cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockRotate


LockSelect Cell (Protection Section)

 Copy code hover
[image]

LockSelect Cell (Protection Section)
Send feedback

Published: July 16, 2012

Prevents a shape from being selected.

Value | Description
TRUE | Shape cannot be selected.
FALSE | Shape can be selected.

Remarks

In order for LockSelect to take effect, the Shapes check box must be selected in the Protect Document dialog box.

To get a reference to the LockSelect cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockSelect

To get a reference to the LockSelect cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockSelect


LockTextEdit Cell (Protection Section)

 Copy code hover
[image]

LockTextEdit Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the text of a shape so that it cannot be edited.

Value | Description
TRUE | Text cannot be edited.
FALSE | Text can be edited.

Remarks

You can still format text by applying a style in the Text dialog box (on the Home tab, click the Font arrow).

To get a reference to the LockTextEdit cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockTextEdit

To get a reference to the LockTextEdit cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockTextEdir


LockThemeColors Cell (Protection Section)

 Copy code hover
[image]

LockThemeColors Cell (Protection Section)
Send feedback

Published: July 16, 2012

Prevents application of theme colors to the shape.

The value of the LockThemeColors cell corresponds to the From theme colors check box setting in the Protection dialog box.

To refer to the LockThemeColors cell by name from another formula, or from a program, using the CellsU property, use:

Cell name:

LockThemeColors

To refer to the LockThemeColors cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockThemeColors


LockThemeConnectors Cell (Protection Section)

 Copy code hover
[image]

LockThemeConnectors Cell (Protection Section)
Send feedback

Published: July 16, 2012

Prevents the ConnectorsSchemeIndex cell in the Theme Properties row from being altered by applying a new theme or selecting a new connector scheme. Does not prevent users from manually editing this value in the ShapeSheet.

Value | Description
TRUE | The ConnectorsSchemeIndex cell cannot be changed from its current value unless changed in the ShapeSheet directly.
FALSE | The ConnectorsSchemeIndex cell can be changed from its current value through the UI.

Remarks

To get a reference to the LockThemeConnectors cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

LockThemeConnectors

To get a reference to the LockThemeConnectors cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockThemeConnectors


LockThemeFonts Cell (Protection Section)

 Copy code hover
[image]

LockThemeFonts Cell (Protection Section)
Send feedback

Published: July 16, 2012

Prevents the FontIndex cell in the Theme Properties row from being altered by applying a new theme. Does not prevent users from manually editing this value in the ShapeSheet.

Value | Description
TRUE | The FontIndex cell cannot be changed from its current value unless changed in the ShapeSheet directly.
FALSE | The FontIndex cell can be changed from its current value when the theme is changed.

Remarks

To get a reference to the LockThemeFonts cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

LockThemeFonts

To get a reference to the LockThemeFonts cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockThemeFonts


LockThemeIndex Cell (Protection Section)

 Copy code hover
[image]

LockThemeIndex Cell (Protection Section)
Send feedback

Published: July 16, 2012

Prevents ThemeIndex cell in Theme Properties row from being altered by applying a new theme or selecting a new connector scheme. Does not prevent users from manually editing this value in the ShapeSheet.

Value | Description
TRUE | The ThemeIndex cell cannot be changed from its current value unless changed in the ShapeSheet directly.
FALSE | The ThemeIndex cell can be changed from its current value when the theme is changed.

Remarks

To get a reference to the LockThemeIndex cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

LockThemeIndex

To get a reference to the LockThemeIndex cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockThemeIndex


LockThemeEffects Cell (Protection Section)

 Copy code hover
[image]

LockThemeEffects Cell (Protection Section)
Send feedback

Published: July 16, 2012

Prevents application of theme effects to the shape.

Corresponds to the From theme effects check box setting in the Protection dialog box.

To refer ti the LockThemeColors cell by name from another formula, or from a program, using the CellsU property, use:

Cell name:

LockThemeEffects

To refer to the LockThemeEffects cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockThemeEffects


LockVariation Cell (Protection Section)

 Copy code hover
[image]

LockVariation Cell (Protection Section)
Send feedback

Published: July 16, 2012

Determines whether the theme variation applied to the page or shape can be changed, as a Boolean.

TRUE | The current variation applied to the page or shape cannot be changed.
FALSE | The variation of the page or shape can be changed.

Remarks

To get a reference to the LockVariation cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

LockVariation

To get a reference to the LockVariation cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockVariation


LockVtxEdit Cell (Protection Section)

 Copy code hover
[image]

LockVtxEdit Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the vertices of a shape so that they cannot be edited.

Value | Description
TRUE | Vertices cannot be edited.
FALSE | Vertices can be edited.

Remarks

To get a reference to the LockVtxEdit cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockVtxEdit

To get a reference to the LockVtxEdit cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockVtxEdit


LockWidth Cell (Protection Section)

 Copy code hover
[image]

LockWidth Cell (Protection Section)
Send feedback

Published: July 16, 2012

Locks the width of the shape so that its width remains unchanged when the shape is sized.

Value | Description
TRUE | Width is locked.
FALSE | Width is not locked.

Remarks

To get a reference to the LockWidth cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LockWidth

To get a reference to the LockWidth cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLock
Cell index: | visLockWidth


LocPinX Cell (Shape Transform Section)

 Copy code hover
[image]

LocPinX Cell (Shape Transform Section)
Send feedback

Published: July 16, 2012

Represents the x-coordinate of the shape's pin (center of rotation) in relation to the origin of the shape. The default formula for determining LocPinX is:

= Width * 0.5

Remarks

To get a reference to the LocPinX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LocPinX

To get a reference to the LocPinX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXFormOut
Cell index: | visXFormLocPinX


LocPinY Cell (Shape Transform Section)

 Copy code hover
[image]

LocPinY Cell (Shape Transform Section)
Send feedback

Published: July 16, 2012

Represents the y-coordinate of the shape's pin (center of rotation) in relation to the origin of the shape. The default formula for determining LocPinY is:

= Height * 0.5

Remarks

To get a reference to the LocPinY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

LocPinY

To get a reference to the LocPinY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXFormOut
Cell index: | visXFormLocPinY


Menu Cell (Actions Section)

 Copy code hover
[image]

Menu Cell (Actions Section)
Send feedback

Published: July 16, 2012

Defines the name of a menu item that appears on a shortcut or action tag menu for a shape or page.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

To insert a separator into the menu above this item, use the BeginGroup cell. To display the command at the bottom of the menu, prefix the name with a percent character (%) .

To get a reference to the Menu cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Actions.name.Menuwhere Actions.name is the name of the Actions row

To get a reference to the Menu cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2, ...
Cell index: | visActionMenu


Name Cell (Reviewer Section)

 Copy code hover
[image]

Name Cell (Reviewer Section)
Send feedback

Published: July 16, 2012

Contains the name of a document reviewer.

Remarks

This value defaults to the name found in the User name box on the General tab of the Visio Options dialog box (click the File tab, click Options, and then click General).

To get a reference to the Name cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Reviewer.Name [i] where i = <1>, 2, 3...

To get a reference to the Name cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionReviewer
Row index: | visRowReviewer + i where i = 0, 1, 2...
Cell index: | visReviewerName


NewWindow Cell (Hyperlinks Section)

 Copy code hover
[image]

NewWindow Cell (Hyperlinks Section)
Send feedback

Published: July 16, 2012

Specifies whether to open the hyperlink in a new window.

Value | Description
TRUE | Open the linked page, document, or Web site in a new window.
FALSE | Default. Do not open a new window for the hyperlink.

Remarks

To get a reference to the NewWindow cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Hyperlink.Name.NewWindow
where Hyperlink.Name is the row name

To get a reference to the NewWindow cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionHyperlink
Row index: | visRow1stHyperlink + i where i = 0, 1, 2, ...
Cell index: | visHLinkNewWin


NoAlignBox Cell (Miscellaneous Section)

 Copy code hover
[image]

NoAlignBox Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Switches the display of the selection rectangle on and off for the selected shape.

Value | Description
TRUE | Selection rectangle is not displayed when the shape is selected.
FALSE | Selection rectangle is displayed when the shape is selected.

Remarks

To get a reference to the NoAlignBox cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

NoAlignBox

To get a reference to the NoAlignBox cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visNoAlignBox


NoCoauth Cell (Document Properties Section)

 Copy code hover
[image]

NoCoauth Cell (Document Properties Section)
Send feedback

Published: July 16, 2012

Sets whether a document stored on a Microsoft SharePoint 2013 server or Windows Live SkyDrive can be edited by multiple authors simultaneously in a coauthoring session.

Value | Description
TRUE | The document cannot be coauthored and is locked for editing when open.
FALSE | The document can be coauthored.

Remarks

To get a reference to the NoCoauth cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

NoCoauth

To get a reference to the NoCoauth cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowDoc
Cell index: | visDocNoCoauth


NoCtlHandles Cell (Miscellaneous Section)

 Copy code hover
[image]

NoCtlHandles Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Switches the display of control handles on and off for the selected shape.

Value | Description
TRUE | Control handles are not displayed when a shape is selected.
FALSE | Control handles are displayed when a shape is selected.

Remarks

To get a reference to the NoCtlHandles cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

NoCtlHandles

To get a reference to the NoCtlHandles cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visNoCtlHandles


NoFill Cell (Geometry Section)

 Copy code hover
[image]

NoFill Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Indicates whether a path can be filled.

Value | Description
TRUE | The path is not filled even if other paths in the shape are filled.
FALSE | The shape's fill applies to the path, even if it isn't closed.

Remarks

If you set a shape's fill pattern to none (0), none of its paths are filled. This cell is used to turn the fill off selectively for a path within a shape.

To get a reference to the NoFill cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Geometryi.NoFill
where i = <1>, 2, 3...

To get a reference to the NoFill cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowComponent
Cell index: | visCompNoFill


NoLine Cell (Geometry Section)

 Copy code hover
[image]

NoLine Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Determines whether a line is drawn around the boundary of the path.

Value | Description
TRUE | A line is not drawn around the boundary of the path that is the boundary of a filled region.
FALSE | A line is drawn around the boundary of a path.

Remarks

When you change the color of a line to white, the line still exists even though you can't see it on a white background. When you set the value of this cell to TRUE, no line is drawn.

To get a reference to the NoLine cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Geometryi.NoLine
where i = <1>, 2, 3...

To get a reference to the NoLine cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowComponent
Cell index: | visCompNoLine


NoLiveDynamics Cell (Miscellaneous Section)

 Copy code hover
[image]

NoLiveDynamics Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Determines whether a shape dynamically resizes or rotates as you are manipulating it.

Value | Description
TRUE | Do not dynamically update the shape while you are manipulating it.
FALSE | Dynamically update the shape while you are manipulating it.

Remarks

As you resize or rotate a two-dimensional (2-D) shape without live dynamics, you see a selection box. If the shape is one-dimensional (1-D), the visual feedback is based on the value of the DynFeedback cell.

To get a reference to the NoLiveDynamics cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

NoLiveDynamics

To get a reference to the NoLiveDynamics cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visNoLiveDynamics


NonPrinting Cell (Miscellaneous Section)

 Copy code hover
[image]

NonPrinting Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Switches printing on and off for the selected shape.

Value | Description
TRUE | Printing disabled, but the shape will be displayed in the drawing window.
FALSE | Printing enabled.

Remarks

You can print a guide by selecting it, and then setting the value of its NonPrinting cell to FALSE.

To get a reference to the NonPrinting cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

NonPrinting

To get a reference to the NonPrinting cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visNonPrinting


NoObjHandles Cell (Miscellaneous Section)

 Copy code hover
[image]

NoObjHandles Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Switches the display of selection handles on and off for the selected shape.

Value | Description
TRUE | Selection handles are not displayed when a shape is selected.
FALSE | Selection handles are displayed when a shape is selected.

Remarks

To get a reference to the NoObjHandles cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

NoObjHandles

To get a reference to the NoObjHandles cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visNoObjHandles


NoProofing Cell (Miscellaneous Section)

 Copy code hover
[image]

NoProofing Cell (Miscellaneous Section)
Send feedback

Determines whether spelling is automatically corrected and whether spelling errors are displayed for the selected shape. Takes a Boolean value.

Value | Description
TRUE | Spelling is not automatically corrected and spelling errors are not displayed for the selected shape.
FALSE | Spelling is automatically corrected and spelling errors are displayed for the selected shape.

Remarks

To get a reference to the NoProofing cell by name from another formula or from a program, by using the CellsU property, use:

Cell name:

NoProofing

To get a reference to the NoProofing cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visNoProofing


NoQuickDrag Cell (Geometry Section)

 Copy code hover
[image]

NoQuickDrag Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Determines whether a shape can be selected or dragged when the user clicks the filled area defined by the Geometry section.

Remarks

To get a reference to the NoQuickDrag cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Geometry i .NoQuickDrag, where i - <1>, 2, 3...

To get a reference to the NoQuickDrag cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i, where i = 0, 1, 2...
Row index: | visRowComponent
Cell index: | visCompNoQuickDrag


NoShow Cell (Geometry Section)

 Copy code hover
[image]

NoShow Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Indicates whether a path is displayed on the drawing page.

Value | Description
TRUE | The stroke and fill of the path represented by the section is hidden.
FALSE | The stroke and fill of the path is shown.

Remarks

To get a reference to the NoShow cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Geometryi.NoShow
where i = <1>, 2, 3...

To get a reference to the NoShow cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowComponent
Cell index: | visCompNoShow


NoSnap Cell (Geometry Section)

 Copy code hover
[image]

NoSnap Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Determines whether other shapes snap to a path.

Value | Description
TRUE | Do not allow other shapes to snap to this path.
FALSE | Allow other shapes to snap to this path.

Remarks

To get a reference to the NoSnap cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Geometryi.NoSnap
where i = <1>, 2, 3...

To get a reference to the NoSnap cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowComponent
Cell index: | visCompNoSnap


ObjectKind Cell (Text Fields Section)

 Copy code hover
[image]

ObjectKind Cell (Text Fields Section)
Send feedback

Published: July 16, 2012

Indicates the type of text field.

Value | Description | Automation constant
0 | Standard | visTFOKStandard
1 | Horizontal in vertical | visTFOKHorizontaInVertical

Remarks

Text fields can be one of the following types:

  • Standard, indicating that the field was inserted by field category.

  • Horizontal in vertical, indicating that the field is horizontal text set within vertical text.

To get a reference to the ObjectKind cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Fields.ObjectKind[i]
where i = <1>, 2, 3...

To get a reference to the ObjectKind cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionTextField
Row index: | visRowField + i where i = 0, 1, 2...
Cell index: | visFieldObjectKind


ObjType Cell (Miscellaneous Section)

 Copy code hover
[image]

ObjType Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Determines whether objects are placeable or routable in diagrams when you use the Configure Layout dialog box to lay out shapes.

Value | Description | Automation constant
&H0 | Default. The application decides based on the drawing context. | visLOFlagsVisDecides
&H1 | Shape is placeable. | visLOFlagsPlacable
&H2 | Shape is routable. Must be a one-dimensional (1-D) shape. | visLOFlagsRoutable
&H4 | Shape is not placeable, not routable. | visLOFlagsDont
&H8 | Group contains placeable/routable shapes. | visLOFlagsPNRGroup

Remarks

By default, the ObjType cell is set to No Formula for a shape, which evaluates to 0, meaning that the application determines whether the shape can be placeable depending on its context. For example, if you draw a simple rectangle, the value of its ObjType cell is 0. If you then use the Connector tool to connect the rectangle to another shape, Visio resets the value of the rectangle's ObjType cell to 1 (placeable).

The value of the ObjType cell can be a combination of values. If the non-placeable bit is set (&H4), however, it takes precedence over other values except the group value (&H8).

To get a reference to the ObjType cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ObjType

To get a reference to the ObjType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visLOFlags


OnPage Cell (Print Properties Section)

 Copy code hover
[image]

OnPage Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Indicates whether the drawing is printed on a specific number of printer pages.

Value | Description
TRUE | Fit the drawing page to a defined number of printer pages.
FALSE | Do not fit the drawing page to a defined number of printer pages (the default).

Remarks

If the OnPage cell is set to TRUE, Microsoft Visio uses the PagesX and PagesY cells to determine the number of printer pages on which to fit the drawing. Values in the ScaleX and ScaleY cells are ignored. This can be considered an "autoscale" setting.

This value corresponds to the Fit to option on the Print Setup tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow) .

To get a reference to the OnPage cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

OnPage

To get a reference to the OnPage cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesOnPage


OutputFormat Cell (Document Properties Section)

 Copy code hover
[image]

OutputFormat Cell (Document Properties Section)
Send feedback

Published: July 16, 2012

Determines the output format for a drawing. Drawing pages are usually formatted for printing (default); however, you can choose other output formats.

Value | Output format
0 | Printing (default)
1 | PowerPoint slide show
2 | HTML or GIF output

Remarks

To get a reference to the OutputFormat cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

OutputFormat

To get a reference to the OutputFormat cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowDoc
Cell index: | visDocOutputFormat


Overline Cell (Character Section)

 Copy code hover
[image]

Overline Cell (Character Section)
Send feedback

Published: July 16, 2012

Determines whether the text has a line above it.

Value | Description
TRUE | Text has a line above it.
FALSE | Text does not have a line above it.

Remarks

You can also set the value of this cell by using the Text dialog box (on the Home tab, click the Font arrow).

To get a reference to the Overline cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.Overline[i] where i = <1>, 2. 3...

To get a reference to the Overline cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterOverline


PageBottomMargin Cell (Print Properties Section)

 Copy code hover
[image]

PageBottomMargin Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Specifies the margin at the bottom of the printed page.

Remarks

This value represents physical units and is unaffected by scale or drawing units. For example, if this cell has a value of 0.5 in., this margin is 0.5 inch even if page units are feet. If units are not explicitly stated, this value defaults to page units.

To get a reference to the PageBottomMargin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PageBottomMargin

To get a reference to the PageBottomMargin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesBottomMargin


PageHeight Cell (Page Properties Section)

 Copy code hover
[image]

PageHeight Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Contains the height of the printed page in drawing units.

Remarks

You can also set the page height on the Page Size tab of the Page Setup dialog box (on the Design tab, click the Page Setup arrow), or by manually resizing the page with the mouse.

To get a reference to the PageHeight cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PageHeight

To get a reference to the PageHeight cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageHeight


PageLeftMargin Cell (Print Properties Section)

 Copy code hover
[image]

PageLeftMargin Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Specifies the margin on the left of the printed page.

Remarks

This value represents physical units and is unaffected by scale or drawing units. For example, if this cell has a value of 0.25 in., this margin is 0.25 inch even if page units are feet. If units are not explicitly stated, this value defaults to page units.

To get a reference to the PageLeftMargin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PageLeftMargin

To get a reference to the PageLeftMargin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesLeftMargin


PageLineJumpDirX Cell (Page Layout Section)

 Copy code hover
[image]

PageLineJumpDirX Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the direction of line jumps on horizontal dynamic connectors on the drawing page for which you haven't applied a local jump direction.

Value | Line jump direction | Automation constant
0 | Default; left or the page's setting for shapes | visLOJumpDirXDefault
1 | Up | visLOJumpDirXUp
2 | Down | visLOJumpDirXDown

Remarks

To get a reference to the PageLineJumpDirX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PageLineJumpDirX

To get a reference to the PageLineJumpDirX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOJumpDirX


PageLineJumpDirY Cell (Page Layout Section)

 Copy code hover
[image]

PageLineJumpDirY Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the direction of line jumps on vertical dynamic connectors on the drawing page for which you haven't applied a local jump direction.

Value | Line jump direction | Automation constant
0 | Default; up or the page's setting for shapes | visLOJumpDirYDefault
1 | Left | visLOJumpDirYLeft
2 | Right | visLOJumpDirYRight

Remarks

To get a reference to the PageLineJumpDirY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PageLineJumpDirY

To get a reference to the PageLineJumpDirY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOJumpDirY


PageLockDuplicate Cell (Page Properties Section)

 Copy code hover
[image]

PageLockDuplicate Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the page can be duplicated, as a Boolean.

TRUE | Duplicate in the page shortcut menu and the Page.Duplicate automation method are both disabled for the page.
FALSE | The page can be duplicated.

Remarks

To get a reference to the PageLockDuplicate cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

PageLockDuplicate

To get a reference to the PageLockDuplicate cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageLockDuplicate


PageLockReplace Cell (Page Properties Section)

 Copy code hover
[image]

PageLockReplace Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Indicates whether the Replace Shape button should be disabled for this page.

Value | Description
TRUE | The Change Shape button is grayed out when this page is active.
FALSE | The Change Shape button is not disabled by this page. The button may still be grayed out if: the DocLockReplace on the DocumentSheet is set to TRUE; the LockReplace cell for the selected shape is set to TRUE.

Remarks

To get a reference to the PageLockReplace cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

PageLockReplace

To get a reference to the PageLockReplace cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageLockReplace


PageRightMargin Cell (Print Properties Section)

 Copy code hover
[image]

PageRightMargin Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Specifies the margin on the right of the printed page.

Remarks

This value represents physical units and is unaffected by scale or drawing units. For example, if this cell has a value of 0.25 in., this margin is 0.25 inch even if page units are feet. If units are not explicitly stated, this value defaults to page units.

To get a reference to the PageRightMargin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PageRightMargin

To get a reference to the PageRightMargin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesRightMargin


PageScale Cell (Page Properties Section)

 Copy code hover
[image]

PageScale Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Determines the value of the page unit in the current drawing scale. The drawing scale for the page is the ratio of the page unit shown in the PageScale cell to the drawing unit shown in the DrawingScale cell.

Remarks

You can also set the value of the PageScale cell on the Drawing Scale tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow). The value of the cell is the first of the two numbers in the Pre-defined scale box or Custom scale box, depending on the drawing scale setting selected under Drawing scale. For example, if you select an architectural scale for your drawing, the drawing scale for the page is 3/32" = 1'0". The value in the PageScale cell is 0.0938 in. (or 3/32") and the value in the DrawingScale cell is 1 ft.

To get a reference to the PageScale cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PageScale

To get a reference to the PageScale cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageScale


PageShapeSplit Cell (Page Layout Section)

 Copy code hover
[image]

PageShapeSplit Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Indicates whether shapes on the page can be automatically split.

Value | Description | Automation constant
0 | Do not allow automatic shape splitting. | visPLOSplitNone
1 | Allow automatic shape splitting (the default). | visPLOSplitAllow

Remarks

Automatic splitting of shapes is enabled and disabled at three different levels: application, page, and shape. By default, splitting is enabled at the application and page levels. The default setting for shapes varies by drawing type.

To enable or disable splitting at the application level, use the Enable connector splitting setting on the Advanced tab of the Visio Options dialog box (click the Office button, click Options on the Visio tab, and then click Advanced ).

To enable or disable splitting at the shape level, see the ShapeSplit and ShapeSplittable cells.

To get a reference to the PageShapeSplit cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PageShapeSplit

To get a reference to the PageShapeSplit cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOSplit


PagesX Cell (Print Properties Section)

 Copy code hover
[image]

PagesX Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Determines the number of printer pages on which to fit the drawing page horizontally.

Remarks

This value is used only when the OnPage cell is set to TRUE.

To get a reference to the PagesX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PagesX

To get a reference to the PagesX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesPagesX


PagesY Cell (Print Properties Section)

 Copy code hover
[image]

PagesY Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Determines the number of printer pages on which to fit the drawing page vertically.

Remarks

This value is used only when the OnPage cell is set to TRUE.

To get a reference to the PagesY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PagesY

To get a reference to the PagesY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesPagesY


PageTopMargin Cell (Print Properties Section)

 Copy code hover
[image]

PageTopMargin Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Specifies the margin at the top of the printer page.

Remarks

This value represents physical units and is unaffected by scale or drawing units. For example, if this cell has a value of 0.25 in., this margin is 0.25 inch even if page units are feet. If units are not explicitly stated, this value defaults to page units.

To get a reference to the PageTopMargin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PageTopMargin

To get a reference to the PageTopMargin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesTopMargin


PageWidth Cell (Page Properties Section)

 Copy code hover
[image]

PageWidth Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Determines the width of the printed page in drawing units.

Remarks

You can also set the page width on the Page Size tab of the Page Setup dialog box (on the Design tab, click the Page Setup arrow) or by manually resizing the page with the mouse. To do this, drag the edge of the page while holding down the CTRL key.

To get a reference to the PageWidth cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PageWidth

To get a reference to the PageWidth cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageWidth


PaperKind Cell (Print Properties Section)

 Copy code hover
[image]

PaperKind Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Specifies the type of paper on which to print the page.

Remarks

This setting corresponds to the Paper Size setting in the Print Setup dialog box (on the Design tab, click the Page Setup arrow, and then on the Print Setup tab, click the Setup button).

The numeric values in this cell map to constants (prefixed with DMPAPER) defined for paper selections in the Microsoft Windows wingdi.h file.

To get a reference to the PaperKind cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PaperKind

To get a reference to the PaperKind cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesPaperKind


PaperSource Cell (PrintProperties Section)

 Copy code hover
[image]

PaperSource Cell (PrintProperties Section)
Send feedback

Published: July 16, 2012

Determines the paper source for the page.

Remarks

This setting corresponds to the Paper Source setting in the Print Setup dialog box (on the Design tab, click the Page Setup arrow, and then on the Print Setup tab, click Setup).

The numeric values in this cell map to constants (prefixed with DMBIN) defined for bin selections in the Microsoft Windows wingdi.h file; for example, the value 7 represents DMBIN_AUTO.

To get a reference to the PaperSource cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PaperSource

To get a reference to the PaperSource cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesPaperSource


Perspective Cell (3-D Rotation Properties Section)

 Copy code hover
[image]

Perspective Cell (3-D Rotation Properties Section)
Send feedback

Published: July 16, 2012

Determines the perspective angle for a perspective rotation, in degrees (0 to 359.9)

Remarks

To get a reference to the Perspective cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

Perspective

To get a reference to the Perspective cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRow3DProperties
Cell index: | visPerspective


PinX Cell (Shape Transform Section)

 Copy code hover
[image]

PinX Cell (Shape Transform Section)
Send feedback

Published: July 16, 2012

Represents the x-coordinate of the shape's pin (center of rotation) in relation to the origin of its parent.

Remarks

To get a reference to the PinX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PinX

To get a reference to the PinX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXFormOut
Cell index: | visXFormPinX


PinY Cell (Shape Transform Section)

 Copy code hover
[image]

PinY Cell (Shape Transform Section)
Send feedback

Published: July 16, 2012

Represents the y-coordinate of the shape's pin (center of rotation) in relation to the origin of its parent.

Remarks

To get a reference to the PinY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PinY

To get a reference to the PinY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXFormOut
Cell index: | visXFormPinY


PlaceDepth Cell (Page Layout Section)

 Copy code hover
[image]

PlaceDepth Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the method by which the drawing is analyzed before creating the layout, and determines the type of layout.

Value | Placement depth for vertical and horizontal layouts | Automation constant
0 | Page default | visPLOPlaceDepthDefault
1 | Medium | visPLOPlaceDepthMedium
2 | Deep | visPLOPlaceDepthDeep
3 | Shallow | visPLOPlaceDepthShallow

Remarks

To get a reference to the PlaceDepth cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PlaceDepth

To get a reference to the PlaceDepth cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOPlaceDepth


PlaceFlip Cell (Page Layout Section)

 Copy code hover
[image]

PlaceFlip Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines how placeable shapes flip and/or rotate on a page when you use the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options).

Value | Description | Automation constant
&H0 | Default. Do not flip. | visLOFlipDefault
&H1 | Flip horizontal. | visLOFlipX
&H2 | Flip vertical. | visLOFlipY
&H4 | Flip in 90 degree increments. | visLOFlipRotate
&H8 | Do not flip. | visLOFlipNone

Remarks

The value in the PlaceFlip cell helps orient a placeable shape toward the next placeable shape it is connected to. It is typically used when laying out drawings that use static glue.

To set this behavior for a particular shape, use the ShapePlaceFlip cell in the Shape Layout section.

To get a reference to the PlaceFlip cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

PlaceFlip

To get a reference to the PlaceFlip cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOPlaceFlip


PlaceStyle Cell (Page Layout Section)

 Copy code hover
[image]

PlaceStyle Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines how shapes are placed on the page when you are laying out shapes by using the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options).

Remarks

You can also set the value of this cell in the Configure Layout dialog box.

To get a reference to the PlaceStyle cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

PlaceStyle

To get a reference to the PlaceStyle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOPlaceStyle


PlowCode Cell (Page Layout Section)

 Copy code hover
[image]

PlowCode Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines whether placeable shapes move away when you drop a placeable shape near another placeable shape on the drawing page.

Value | Description | Automation constant
0 | Don't move shapes | visPLOPlowNone
1 | Move shapes | visPLOPlowAll

Remarks

You can also set the value of this cell on the Layout and Routing tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow) by using the Move other shapes away on drop check box.

To get a reference to the PlowCode cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PlowCode

To get a reference to the PlowCode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOPlowCode


Pos Cell (Character Section)

 Copy code hover
[image]

Pos Cell (Character Section)
Send feedback

Published: July 16, 2012

Determines the position of the shape's text relative to the baseline.

Value | Description | Automation constant
0 | Normal position | visPosNormal
1 | Superscript | visPosSuper
2 | Subscript | visPosSub

Remarks

To get a reference to the Pos cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.Pos[i]
where i = <1>, 2, 3...

To get a reference to the Pos cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterPos


Position Cell (Tabs Section)

 Copy code hover
[image]

Position Cell (Tabs Section)
Send feedback

Published: July 16, 2012

Specifies the position of a tab stop. The tab position is independent of the scale of the drawing. If the drawing is scaled, the tab position remains the same.

Remarks

To get a reference to the Position cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Tabs.ij
where i and j = <1>, 2, 3...

To get a reference to the Position cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionTab
Row index: | visRowTab + i where i = 0, 1, 2...
Cell index: | (j*3) + visTabPos


PreviewQuality Cell (Document Properties Section)

 Copy code hover
[image]

PreviewQuality Cell (Document Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the drawing preview is draft quality or detailed.

Value | Preview quality | Automation constant
0 | Draft | visDocPreviewQualityDraft
1 | Detailed | visDocPreviewQualityDetailed

Remarks

You can also set this value on the Summary tab in the Properties dialog box (click the Office button, click the Info tab, click Document Properties, and then click Advanced Properties).

To get a reference to the PreviewQuality cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PreviewQuality

To get a reference to the PreviewQuality cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObj
Row index: | visRowDoc
Cell index: | visDocPreviewQuality


PreviewScope Cell (Document Properties Section)

 Copy code hover
[image]

PreviewScope Cell (Document Properties Section)
Send feedback

Published: July 16, 2012

Determines whether your drawing includes a preview. If your drawing does include a preview, it determines whether the preview shows the first page only or all of the pages in the drawing.

Value | Preview scope | Automation constant
0 | First page | visDocPreviewScope1stPage
1 | None | visDocPreviewScopeNone
2 | All pages | visDocPreviewScopeAllPages

Remarks

You can also set this value on the Summary tab in the Properties dialog box (click the Office button, click the Info tab, click Document Properties, and then click Advanced Properties).

To get a reference to the PreviewScope cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PreviewScope

To get a reference to the PreviewScope cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObj
Row index: | visRowDoc
Cell index: | visDocPreviewScope


Print Cell (Layers Section)

 Copy code hover
[image]

Print Cell (Layers Section)
Send feedback

Published: July 16, 2012

Specifies whether shapes belonging to the layer can be printed.

Value | Description
TRUE | Shapes can be printed.
FALSE | Shapes cannot be printed.

Remarks

You can also set this value by using the Print option in the Layer Properties dialog box (on the Home tab, in the Editing group, click Layers, and then click Layer Properties).

To get a reference to the Print cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Layers.Print[i] where i = <1>, 2, 3...

To get a reference to the Print cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionLayer
Row index: | visRowLayer + i where i = 0, 1, 2...
Cell index: | visDocPreviewScope


PrintGrid Cell (Print Properties Section)

 Copy code hover
[image]

PrintGrid Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Specifies whether to print the grid when printing a document page.

Value | Description
TRUE | Show the grid when printing this page.
FALSE | Do not show the grid when printing this page (the default).

Remarks

This value corresponds to the Gridlines check box on the Print Setup tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow). Other than color (the printed version is gray), the printed grid is identical to the grid you see in the Microsoft Visio drawing window.

You can choose whether to print the grid on a page-by-page basis. The style of grid can also be defined on a page-by-page basis in the Ruler & Grid dialog box (on the View tab, click the Show arrow) when a page is active.

To get a reference to the PrintGrid cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PrintGrid

To get a reference to the PrintGrid cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesPrintGrid


PrintPageOrientation Cell (Print Properties Section)

 Copy code hover
[image]

PrintPageOrientation Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the page prints using portrait or landscape orientation.

Value | Orientation | Automation constant
0 | Same as printer | visPPOSameAsPrinter
1 | Portrait | visPPOPortrait
2 | Landscape | visPPOLandscape

Remarks

When you insert new pages in a document, this setting defaults to the setting in the active page.

To get a reference to the PrintPageOrientation cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

PrintPageOrientation

To get a reference to the PrintPageOrientation cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesPageOrientation


Prompt Cell (Actions Section)

 Copy code hover
[image]

Prompt Cell (Actions Section)
Send feedback

Published: July 16, 2012

Beginning with Visio 2002, this cell is no longer used.

Remarks

In earlier versions of Visio, this cell specified a descriptive prompt that appeared in the status bar when you selected the corresponding shortcut command.


Prompt Cell (Shape Data Section)

 Copy code hover
[image]

Prompt Cell (Shape Data Section)
Send feedback

Published: July 16, 2012

Specifies descriptive or instructional text that appears as a tip when the mouse is paused over a value in the Shape Data window.

Remarks

To get a reference to the Prompt cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Prop.Name.Prompt where Name is the row name

To get a reference to the Prompt cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionProp
Row index: | visRowProp + i where i = 0, 1, 2...
Cell index: | visCustPropsPrompt


Prompt Cell (User-Defined Cells Section)

 Copy code hover
[image]

Prompt Cell (User-Defined Cells Section)
Send feedback

Published: July 16, 2012

Specifies a descriptive prompt or comment for the user-defined cell. The application automatically encloses the prompt text in quotation marks (" ") to indicate that it is a text string. If you type an equal sign (=) and omit the quotation marks, you can enter a formula in this cell that the application evaluates.

Remarks

To get a reference to the Prompt cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

User.Name.Prompt
where User.Name is the row name

To get a reference to the Prompt cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionUser
Row index: | visRowUser + i where i = 0, 1, 2...
Cell index: | visUserPrompt


QuickStyleEffectsMatrix Cell (Quick Style Section)

 Copy code hover
[image]

QuickStyleEffectsMatrix Cell (Quick Style Section)
Send feedback

Published: July 16, 2012

Determines the Quick Style effects that the shape inherits from the active theme, as an integer from 0-6.

Remarks

To get a reference to the QuickStyleEffectsMatrix cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

QuickStyleEffectsMatrix

To get a reference to the QuickStyleEffectsMatrix cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowQuickStyleProperties
Cell index: | visQuickStyleEffectsMatrix


QuickStyleFillColor Cell (Quick Style Section)

 Copy code hover
[image]

QuickStyleFillColor Cell (Quick Style Section)
Send feedback

Published: July 16, 2012

Determines which theme color that a shape's fill uses, as an integer from 0 to 7

Value | Description
0 | The shape fill color inherits from the Dark theme color.
1 | The shape fill color inherits from the Light theme color.
2 | The shape fill color inherits from the Accent 1 theme color
3 | The shape fill color inherits from the Accent 2 theme color
4 | The shape fill color inherits from the Accent 3 theme color
5 | The shape fill color inherits from the Accent 4 theme color
6 | The shape fill color inherits from the Accent 5 theme color
7 | The shape fill color inherits from the Accent 6 theme color

Remarks

To get a reference to the QuickStyleFillColor cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

QuickStyleFillColor

To get a reference to the QuickStyleFillColor cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowQuickStyleProperties
Cell index: | visQuickStyleFillColor


QuickStyleFillMatrix Cell (Quick Style Section)

 Copy code hover
[image]

QuickStyleFillMatrix Cell (Quick Style Section)
Send feedback

Published: July 16, 2012

Determines the Quick Style fill style that the shape inherits from the active theme, as an integer from 0-6.

Remarks

To get a reference to the QuickStyleFillMatrix cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

QuickStyleFillMatrix

To get a reference to the QuickStyleFillMatrix cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowQuickStyleProperties
Cell index: | visQuickStyleFillMatrix


QuickStyleFontColor Cell (Quick Style Section)

 Copy code hover
[image]

QuickStyleFontColor Cell (Quick Style Section)
Send feedback

Published: July 16, 2012

Determines the font color from the Quick Styles that a shape's text inherits from the active theme, as an integer from 0-1.

Value | Description
0 | The shape text uses the Dark font color.
1 | The shape text uses the Light font color.

Remarks

To get a reference to the QuickStyleFontColor cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

QuickStyleFontColor

To get a reference to the QuickStyleFontColor cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowQuickStyleProperties
Cell index: | visQuickStyleFontColor


QuickStyleFontMatrix Cell (Quick Style Section)

 Copy code hover
[image]

QuickStyleFontMatrix Cell (Quick Style Section)
Send feedback

Published: July 16, 2012

Determines the style of the font for each Quick Style, as an integer from 1 to 6.

Remarks

To get a reference to the QuickStyleFontMatrix cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

QuickStyleFontMatrix

To get a reference to the QuickStyleFontMatrix cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowQuickStyleProperties
Cell index: | visQuickStyleFontMatrix


QuickStyleLineColor Cell (Quick Style Section)

 Copy code hover
[image]

QuickStyleLineColor Cell (Quick Style Section)
Send feedback

Published: July 16, 2012

Determines which theme color that a shape's line uses, as an integer from 0 to 7.

Value | Description
0 | The shape line color inherits from the Dark theme color.
1 | The shape line color inherits from the Light theme color.
2 | The shape line color inherits from the Accent 1 theme color
3 | The shape line color inherits from the Accent 2 theme color
4 | The shape line color inherits from the Accent 3 theme color
5 | The shape line color inherits from the Accent 4 theme color
6 | The shape line color inherits from the Accent 5 theme color
7 | The shape line color inherits from the Accent 6 theme color

Remarks

To get a reference to the QuickStyleLineColor cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

QuickStyleLineColor

To get a reference to the QuickStyleLineColor cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowQuickStyleProperties
Cell index: | visQuickStyleLineColor


QuickStyleLineMatrix Cell (Quick Style Section)

 Copy code hover
[image]

QuickStyleLineMatrix Cell (Quick Style Section)
Send feedback

Published: July 16, 2012

Determines the Quick Style line style that the shape inherits, as an integer from 0-6.

Remarks

To get a reference to the QuickStyleLineMatrix cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

QuickStyleLineMatrix

To get a reference to the QuickStyleLineMatrix cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowQuickStyleProperties
Cell index: | visQuickStyleLineMatrix


QuickStyleShadowColor Cell (Quick Style Section)

 Copy code hover
[image]

QuickStyleShadowColor Cell (Quick Style Section)
Send feedback

Published: July 16, 2012

Determines which theme color that a shape's shadow uses, as an integer from 0 to 7.

Value | Description
0 | The shape shadow color inherits from the Dark theme color.
1 | The shape shadow color inherits from the Light theme color.
2 | The shape shadow color inherits from the Accent 1 theme color.
3 | The shape shadow color inherits from the Accent 2 theme color.
4 | The shape shadow color inherits from the Accent 3 theme color.
5 | The shape shadow color inherits from the Accent 4 theme color.
6 | The shape shadow color inherits from the Accent 5 theme color.
7 | The shape shadow color inherits from the Accent 6 theme color.

Remarks

To get a reference to the QuickStyleShadowColor cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

QuickStyleShadowColor

To get a reference to the QuickStyleShadowColor cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowQuickStyleProperties
Cell index: | visQuickStyleShadowColor


QuickStyleType Cell (Quick Style Section)

 Copy code hover
[image]

QuickStyleType Cell (Quick Style Section)
Send feedback

Published: July 16, 2012

Determines the type of Quick Style (2-dimensional, 1-dimensional, or connector) that the shape inherits.

Value | Description
0 | Visio chooses automatically
1 | 1-dimensional
2 | 2-dimensional
3 | Connector

Remarks

To get a reference to the QuickStyleType cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

QuickStyleType

To get a reference to the QuickStyleType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowQuickStyleProperties
Cell index: | visQuickStyleType


QuickStyleVariation Cell (Quick Style Section)

 Copy code hover
[image]

QuickStyleVariation Cell (Quick Style Section)
Send feedback

Determines whether to override the formulas and values of text, line, and fill color (or a combination of those properties) by using colors that contrast with the diagram background. Value is a bitwise OR of 0, 1, 2, 4, and 8.

Value | Description
0 | Do not alter a shape's text, line, or fill color (or any combination of those properties) to remain visible against a theme's given background color.
1 | Do not alter a shape's text, line, or fill color (or any combination of those properties) to remain visible against a theme's given background color.
2 | Alter a shape's text color, if necessary, to remain visible against a theme's given background color.
4 | Alter a shape's line color, if necessary, to remain visible against a theme's given background color.
8 | Alter a shape's fill color, if necessary, to remain visible against a theme's given background color.

Remarks

Use the QuickStyleVariation cell to guarantee visibility in either text or lines when they are outside any visible shape geometry (for example, in a shape whose textbox is below the bottom of the shape, such as those in Network Diagrams). The cell's default value is 0, which means that its behavior is inactive. Any other value triggers the cell's behavior.

The QuickStyleVariation value overrides the value produced by the THEMEVAL function when it resides in the Color (Character Section), FillForegnd, or LineColor cells (or produced by direct references to these three properties by means of THEMEVAL("CharacterColor"), THEMEVAL("FillColor"), and THEMEVAL("LineColor")).

To get a reference to the QuickStyleVariation cell by name from another formula, by getting the value of the N attribute of a Cell element, or from a program by using the CellsU property, use:

Cell name:

QuickStyleVariation

To get a reference to the QuickStyleVariation cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowQuickStyleProperties
Cell index: | visQuickStyleVariation


ReadOnly Cell (Actions Section)

 Copy code hover
[image]

ReadOnly Cell (Actions Section)
Send feedback

Published: July 16, 2012

Controls whether the action on an action tag or shortcut menu is read-only.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Value | Description
TRUE | The action appears on the menu but is read-only.
FALSE | The action appears on the menu and can be selected (the default).

Remarks

When an action is read-only, it appears on the action tag or shortcut menu but you cannot select it. It is not dimmed but rather appears on a colored background, like a label. To make the menu item appear dimmed, use the Disabled cell.

To get a reference to the ReadOnly cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Actions.name.ReadOnlywhere Actions.name is the name of the Actions row

To get a reference to the ReadOnly cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2...
Cell index: | visActionReadOnly


ReflectionBlur Cell (Additional Effect Properties Section)

 Copy code hover
[image]

ReflectionBlur Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the amount of blur for a reflection on a shape, in points between 0.0 and 100.0.

Remarks

To get a reference to the ReflectionBlur cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ReflectionBlur

To get a reference to the ReflectionBlur cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visReflectionBlur


ReflectionDist Cell (Additional Effect Properties Section)

 Copy code hover
[image]

ReflectionDist Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the distance that a reflection is offset from a shape, in points from 0.0 to 100.0.

Remarks

To get a reference to the ReflectionDist cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ReflectionDist

To get a reference to the ReflectionDist cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visReflectionDist


ReflectionSize Cell (Additional Effect Properties Section)

 Copy code hover
[image]

ReflectionSize Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the size of the reflection relative to the shape, as a percentage from 0.0 to 100.0%. A shape with a value of 0% in the ReflectionSize cell does not have a reflection; a value of 100% displays a complete mirror image of the shape.

Remarks

To get a reference to the ReflectionSize cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ReflectionSize

To get a reference to the ReflectionSize cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visReflectionSize


ReflectionTrans Cell (Additional Effect Properties Section)

 Copy code hover
[image]

ReflectionTrans Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the transparency of the reflection, as a percentage from 0 to 100%.

Remarks

To get a reference to the ReflectionTrans cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ReflectionTrans

To get a reference to the ReflectionTrans cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visReflectionTrans


Relationships Cell (Shape Layout Section)

 Copy code hover
[image]

Relationships Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Stores the relationships between containers, lists, callouts, and shapes.

Remarks

Microsoft Visio uses the Relationships cell to store the relationships that involve this shape. A series of DEPENDSON functions, with the parameters shown, are used to represent relationships with this shape, as shown in the following table.

First parameter | Additional parameters
1 | Shapes that are members of this container.
2 | Shapes that are members of this list.
3 | Callouts that are associated with this shape.
4 | Containers that this shape is a member of.
5 | List that this list item is a member of.
6 | Shape associated with this callout.
7 | Container on the left boundary edge of which this shape sits.
8 | Container on the right boundary edge of which this shape sits.
9 | Container on the top boundary edge of which this shape sits.
10 | Container on the bottom boundary edge of which this shape sits.
11 | List that this list overlaps.

To get a reference to the Relationships cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Relationships

To get a reference to the Relationships cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLORelationships


ReplaceCopyCells Cell (Change Shape Behavior Section)

 Copy code hover
[image]

ReplaceCopyCells Cell (Change Shape Behavior Section)
Send feedback

Published: July 16, 2012

Indicates a list of cells in the ShapeSheet that are copied from an old shape to the replacement shape during a shape replacement operation.

Remarks

The master shape of the replacement must contain a DEPENDSON function call in the ReplaceCopyCells cell, where each argument in the function is a reference to a cell. Those cells are copied from the old shape to the shape that results from a shape replacement operation, regardless of where they are in the ShapeSheet.

Values and/or formulas that reference other cells are copied to the resulting shape. If the resulting shape does not have the referenced cell, the copied cell contains the value only.

References in the ReplaceCopyCells cell override protection set on cells as defined in the Protection section and the ReplaceLockFormat, ReplaceLockShapeData, and ReplaceLockText cells.

To get a reference to the ReplaceCopyCells cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ReplaceCopyCells

To get a reference to the ReplaceCopyCells cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowReplaceBehaviors
Cell index: | visReplaceCopyCells


ReplaceLockFormat Cell (Change Shape Behavior Section)

 Copy code hover
[image]

ReplaceLockFormat Cell (Change Shape Behavior Section)
Send feedback

Published: July 16, 2012

Indicates whether the values of specified cells in a master shape overwrite the values (including local values) of a shape being replaced during a shape replacement operation. If the ReplaceLockFormat cell of a master shape is set to TRUE (1), the formatting values of the master overwrite all corresponding values of a shape being replaced by the master.

Value | Description
TRUE | If the ReplaceLockFormat cell of a master shape is set to TRUE, the formatting values of the master overwrite all corresponding values of a shape being replaced by the master.
FALSE | If the ReplaceLockFormat cell of a master shape is set to FALSE, the replacement shape contains the local formatting values from the old shape after the replacement operation.

Remarks

The ReplaceLockFormat cell determines whether the master shape overwrites the local formatting values of the cells in the following sections during a shape replacement operation:

  • Fill Format section

  • Line Format section

  • Quick Style section

  • Theme Properties section

  • Gradient Properties section

  • Bevel Properties section

  • Additional Effect Properties section

  • Line Gradient Stops section

  • Fill Gradient Stops section

To get a reference to the ReplaceLockFormat cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ReplaceLockFormat

To get a reference to the ReplaceLockFormat cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowReplaceBehaviors
Cell index: | visReplaceLockFormat


ReplaceLockShapeData Cell (Change Shape Behavior Section)

 Copy code hover
[image]

ReplaceLockShapeData Cell (Change Shape Behavior Section)
Send feedback

Published: July 16, 2012

Indicates whether the values of specified cells in a master shape overwrite the values (including local values) of a shape being replaced during a shape replacement operation. The ReplaceLockShapeData determines whether the shape data of the master shape overwrites all of the shape data of the shape being replaced.

Value | Description
1 (TRUE) | All rows and values of the Shape Data section of the master shape are copied onto the replacement shape and any local values from the old shape being replaced are discarded.
0 (FALSE) | The rows and values of the Shape Data section of the master shape are copied to the replacement shape. Any rows in the Shape Data section of the old shape with local values are transferred to the replacement shape.

Remarks

To get a reference to the ReplaceLockShapeData cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ReplaceLockShapeData

To get a reference to the ReplaceLockShapeData cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowReplaceBehaviors
Cell index: | visReplaceLockShapeData


ReplaceLockText Cell (Change Shape Behavior Section)

 Copy code hover
[image]

ReplaceLockText Cell (Change Shape Behavior Section)
Send feedback

Published: July 16, 2012

Indicates whether the values of specified cells in a master shape overwrite the values (including local values) of a shape being replaced during a shape replacement operation. The ReplaceLockText determines whether the text displayed on the Master overwrites the text of the shape being replaced.

Value

Description

TRUE

The text on the master shape overwrites the text on the old shape. In addition, the master shape overwrites the values of the cells in the following sections during a shape replacement operation:

  • Text Fields section

  • Text Block Format section

FALSE

The replacement shape contains any text, text fields, or other text properties from the old shape that have been added to the shape.

When the replacement shape contains text properties from the old shape, the replacement shape also has the values from the Character and Paragraph sections of the old shape if they have more than one row.

If set to TRUE (1), the values of the shape Master replaces the values of the following on the shape being replaced:

  • TheText Cell (Events Section)

  • Cells in the Character Section

  • Cells in the Paragraph Section

  • Cells in the Tabs Section

Remarks

To get a reference to the ReplaceLockText cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ReplaceLockText

To get a reference to the ReplaceLockText cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowReplaceBehaviors
Cell index: | visReplaceLockText


ResizeMode Cell (Shape Transform Section)

 Copy code hover
[image]

ResizeMode Cell (Shape Transform Section)
Send feedback

Published: July 16, 2012

Shows the current resize behavior setting for the shape.

Value | Description | Automation constant
0 | Use group's setting. | visXFormResizeDontCare
1 | Reposition only. | visXFormResizeSpread
2 | Scale with group. | visXFormResizeScale

Remarks

You can also set this value on the Behavior tab in the Behavior dialog box (on the Developer tab, in the Shape Design group, click Behavior). To get a reference to the ResizeMode cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ResizeMode

To get a reference to the ResizeMode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXFormOut
Cell index: | visXFormResizeMode


ResizePage Cell (Page Layout Section)

 Copy code hover
[image]

ResizePage Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines whether to enlarge the page to enclose the drawing after laying out shapes by using the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options).

Value | Description
TRUE | Enlarge the page.
FALSE | Do not enlarge the page.

Remarks

To get a reference to the ResizePage cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

ResizePage

To get a reference to the ResizePage cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLOResizePage


RightMargin Cell (Text Block Format Section)

 Copy code hover
[image]

RightMargin Cell (Text Block Format Section)
Send feedback

Published: July 16, 2012

Determines the distance between the right border of the text block and the text it contains. The default is 0.1 inch.

Remarks

This value is independent of the scale of the drawing. If the drawing is scaled, the right margin remains the same.

To get a reference to the RightMargin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

RightMargin

To get a reference to the RightMargin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowText
Cell index: | visTxtBlkRightMargin


RotateGradientWithShape Cell (Gradient Properties Section)

 Copy code hover
[image]

RotateGradientWithShape Cell (Gradient Properties Section)
Send feedback

Published: July 16, 2012

Determines whether a fill gradient rotates with a shape in 2D rotation, as a boolean.

Value | Description
TRUE | The gradient rotates with the shape when the shape is rotated around the rotation pin. The "top" of the gradient is parallel to the rotation handle.
FALSE | The gradient does not rotate with the shape when the shape is rotated around the rotation pin. The "top" of the gradient is parallel to the drawing canvas.

Remarks

To get a reference to the RotateGradientWithShape cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

RotateGradientWithShape

To get a reference to the RotateGradientWithShape cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGradientProperties
Cell index: | visRotateGradientWithShape


RotationType Cell (3-D Rotation Properties Section)

 Copy code hover
[image]

RotationType Cell (3-D Rotation Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the shape follows a parallel rotation, a perspective rotation, or an oblique rotation, as an integer from 0 to 6.

Value | Description
0 | The shape does not have any rotation.
1 | The shape has a parallel rotation.
2 | The shape has a perspective rotation.
3 | The shape has a top left oblique rotation.
4 | The shape has a top right oblique rotation.
5 | The shape has a bottom left oblique rotation.
6 | The shape has a bottom right oblique rotation.

Remarks

To get a reference to the RotationType cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

RotationType

To get a reference to the RotationType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRow3DProperties
Cell index: | visRotationType


RotationXAngle Cell (3-D Rotation Properties Section)

 Copy code hover
[image]

RotationXAngle Cell (3-D Rotation Properties Section)
Send feedback

Published: July 16, 2012

Determines the angle of rotation along the X-axis, in degrees (0.0 - 359.9).

Remarks

To get a reference to the RotationXAngle cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

RotationXAngle

To get a reference to the RotationXAngle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRow3DProperties
Cell index: | visRotationXAngle


RotationYAngle Cell (3-D Rotation Properties Section)

 Copy code hover
[image]

RotationYAngle Cell (3-D Rotation Properties Section)
Send feedback

Published: July 16, 2012

Determines the angle of rotation along the Y-axis, in degrees (0.0 - 359.9).

Remarks

To get a reference to the RotationYAngle cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

RotationYAngle

To get a reference to the RotationYAngle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRow3DProperties
Cell index: | visRotationYAngle


RotationZAngle Cell (3-D Rotation Properties Section)

 Copy code hover
[image]

RotationZAngle Cell (3-D Rotation Properties Section)
Send feedback

Published: July 16, 2012

Determines the angle of rotation along the Z-axis, in degrees (0.0 - 359.9).

Remarks

To get a reference to the RotationZAngle cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

RotationZAngle

To get a reference to the RotationZAngle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRow3DProperties
Cell index: | visRotationZAngle


Rounding Cell (Line Format Section)

 Copy code hover
[image]

Rounding Cell (Line Format Section)
Send feedback

Published: July 16, 2012

Indicates the radius of the rounding arc applied where two contiguous segments of a path meet. For example, rounding can be used to give a rectangle rounded corners. To set rounding, enter a value with units of measure (a number-unit pair).

Remarks

You can also set this value in the Line dialog box (on the Home tab, in the Shape group, click Line, point to Weight, and then click More Lines ).

To get a reference to the Rounding cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Rounding

To get a reference to the Rounding cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowLine
Cell index: | visLineRounding


RouteStyle Cell (Page Layout Section)

 Copy code hover
[image]

RouteStyle Cell (Page Layout Section)
Send feedback

Published: July 16, 2012

Determines the routing style and direction for all connectors on the drawing page that don't have a local routing style.

Value | Routing style | Direction | Automation constant
0 | Default; right angle | None | visLORouteDefault
1 | Right angle | None | visLORouteRightAngle
2 | Straight | None | visLORouteStraight
3 | Organization chart | Top to bottom | visLORouteOrgChartNS
4 | Organization chart | Left to right | visLORouteOrgChartWE
5 | Flowchart | Top to bottom | visLORouteFlowchartNS
6 | Flowchart | Left to right | visLORouteFlowchartWE
7 | Tree | Top to bottom | visLORouteTreeNS
8 | Tree | Left to right | visLORouteTreeWE
9 | Network | None | visLORouteNetwork
10 | Organization chart | Bottom to top | visLORouteOrgChartSN
11 | Organization chart | Right to left | visLORouteOrgChartEW
12 | Flowchart | Bottom to top | visLORouteFlowchartSN
13 | Flowchart | Right to left | visLORouteFlowchartEW
14 | Tree | Bottom to top | visLORouteTreeSN
15 | Tree | Right to left | visLORouteTreeEW
16 | Center to center | None | visLORouteCenterToCenter
17 | Simple | Top to bottom | visLORouteSimpleNS
18 | Simple | Left to right | visLORouteSimpleWE
19 | Simple | Bottom to top | visLORouteSimpleSN
20 | Simple | Right to left | visLORouteSimpleEW
21 | Simple horizontal-vertical | None | visLORouteSimpleHV
22 | Simple vertical-horizontal | None | visLORouteSimpleVH

Remarks

You can also set the value of this cell on the Layout and Routing tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow, click Layout and Routing , and then click Spacing ).

You can set a local routing style for a connector in the ShapeRouteStyle cell of the Shape Layout section.

To get a reference to the RouteStyle cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

RouteStyle

To get a reference to the RouteStyle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPageLayout
Cell index: | visPLORouteStyle


Scale Cell (Character Section)

 Copy code hover
[image]

Scale Cell (Character Section)
Send feedback

Published: July 16, 2012

Controls the font width. The default value for this cell is 100%.

Remarks

Set the percentage between 1% and 99% to decrease the font width. Set it between 101% and 600% to increase the font width.

You can also set the value of this cell by using the Text dialog box (on the Home tab, click the Font arrow).

To get a reference to the Scale cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.FontScale[i] where i = <1>, 2, 3...

To get a reference to the Scale cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterFontScale


ScaleX Cell (Print Properties Section)

 Copy code hover
[image]

ScaleX Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Specifies the percentage of magnification of the drawing page on the printer page.

Remarks

This value is used only when the OnPage cell value is FALSE. The ScaleX and ScaleY cells always have the same value, which corresponds to the value in the Adjust to setting on the Print Setup tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow).

To get a reference to the ScaleX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ScaleX

To get a reference to the ScaleX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesScaleX


ScaleY Cell (Print Properties Section)

 Copy code hover
[image]

ScaleY Cell (Print Properties Section)
Send feedback

Published: July 16, 2012

Specifies the percentage of magnification of the drawing page on the printer page.

Remarks

This value is used only when the OnPage cell value is FALSE. The ScaleX and ScaleY cells always have the same value, which corresponds to the value in the Adjust to setting on the Print Setup tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow).

To get a reference to the ScaleY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ScaleY

To get a reference to the ScaleY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPrintProperties
Cell index: | visPrintPropertiesScaleY


SelectMode Cell (Group Properties Section)

 Copy code hover
[image]

SelectMode Cell (Group Properties Section)
Send feedback

Published: July 16, 2012

Determines how you select a group shape and its members.

Value | Selection mode | Automation constant
0 | Select the group shape only. | visGrpSelModeGroupOnly
1 | Select the group shape first. | visGrpSelModeGroup1st
2 | Select the members of the group first. | visGrpSelModeMembers1st

Remarks

You can also set this value in the Behavior dialog box (with the group shape selected, on the Developer tab, in the Shape Design group, click Behavior , and then click a mode in the Selection list under Group Behavior ).

To get a reference to the SelectMode cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

SelectMode

To get a reference to the SelectMode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGroup
Cell index: | visGroupSelectMode


ShapeFixedCode Cell (Shape Layout Section)

 Copy code hover
[image]

ShapeFixedCode Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Specifies placement behavior for a placeable shape.

Value | Selection mode | Automation constant
&H1 | Don't move this shape when shapes are laid out by using the Configure Layout dialog box. | visSLOFixedPlacement
&H2 | Don't move this shape and do not allow shapes that plow to be placed on top of it. | visSLOFixedPlow
&H4 | Don't move this shape and allow shapes that plow to be placed on top of it. | visSLOFixedPermeablePlow
&H20 (32) | Ignore connection point locations when being routed to. | visSLOFixedConnPtsIgnore
&H40 (64) | Only allow routing to sides with connection points. | visSLOFixedConnPtsOnly
&H80 (128) | Don't glue to the perimeter of this shape. Glue to the shape's alignment box instead. | visSLOFixedNoFoldToShape

Remarks

You can also set the value of this cell on the Placement tab in the Behavior dialog box (with a shape selected, on the Developer tab, in the Shape Design group, click Behavior, and then click the Placement tab).

You can set any combination of these values for this cell. For example, you can enter the value 3 (&H3), which eliminates movement when you lay out shapes by using the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page , and then click More Layout Options ) and when other placeable shapes are placed on or near the shape.

In versions earlier than Visio 2000, you set this behavior using the ObjInteract cell in the Miscellaneous section.

To get a reference to the ShapeFixedCode cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

ShapeFixedCode

To get a reference to the ShapeFixedCode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOFixedCode


ShapePermeablePlace Cell (Shape Layout Section)

 Copy code hover
[image]

ShapePermeablePlace Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines whether placeable shapes can be placed on top of a shape when laying out shapes in the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options).

Value | Description
TRUE | Enable shapes to be placed on top of a shape.
FALSE | Do not enable shapes to be placed on top of a shape.

Remarks

You can also set the value of this cell on the Placement tab in the Behavior dialog box (with a shape selected, on the Developer tab, in the Shape Design group, click Behavior, and then click the Placement tab).

In versions earlier than Visio 2000, you set this behavior using the ObjInteract cell in the Miscellaneous section.

To get a reference to the ShapePermeablePlace cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

ShapePermeablePlace

To get a reference to the ShapePermeablePlace cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOPermeablePlace


ShapePermeableX Cell (Shape Layout Section)

 Copy code hover
[image]

ShapePermeableX Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines whether a connector can route horizontally through a placeable shape.

Value | Description
TRUE | Enable connectors to route horizontally through a placeable shape.
FALSE | Do not let connectors route horizontally through a placeable shape.

Remarks

You can also set the value of this cell on the Placement tab in the Behavior dialog box (with a shape selected, on the Developer tab, in the Shape Design group, click Behavior, and then click the Placement tab).

In versions earlier than Visio 2000, you set this behavior by using the ObjInteract cell in the Miscellaneous section.

To get a reference to the ShapePermeableX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShapePermeableX

To get a reference to the ShapePermeableX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOPermX


ShapePermeableY Cell (Shape Layout Section)

 Copy code hover
[image]

ShapePermeableY Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines whether a connector can route vertically through a shape.

Value | Description
TRUE | Enable connectors to route vertically through a shape.
FALSE | Do not let connectors route vertically through a shape.

Remarks

You can also set the value of this cell on the Placement tab in the Behavior dialog box (with a shape selected, on the Developer tab, in the Shape Design group, click Behavior, and then click the Placement tab).

In versions earlier than Visio 2000, you set this behavior by using the ObjInteract cell in the Miscellaneous section.

To get a reference to the ShapePermeableY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShapePermeableY

To get a reference to the ShapePermeableY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOPermY


ShapePlaceFlip Cell (Shape Layout Section)

 Copy code hover
[image]

ShapePlaceFlip Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines how a placeable shape flips, rotates, or both on the page when you are laying out shapes by using the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options).

Value | Description | Automation constant
0 | Use page default. | visLOFlipDefault
1 | Flip horizontal. | visLOFlipX
2 | Flip vertical. | visLOFlipY
4 | Flip in 90 degree increments between 0 and 270. | visLOFlipRotate
8 | Do not flip. | visLOFlipNone

Remarks

The value in the ShapePlaceFlip cell helps orient a placeable shape toward the next placeable shape it is connected to.

To set this behavior for all the shapes on the drawing page, use the PlaceFlip cell in the Page Layout section.

To get a reference to the ShapePlaceFlip cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

ShapePlaceFlip

To get a reference to the ShapePlaceFlip cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOPlaceFlip


ShapePlaceStyle Cell (Shape Layout Section)

 Copy code hover
[image]

ShapePlaceStyle Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Specifies how shapes are placed on the page when shapes are laid out in the Configure Layout dialog box (on the Design tab, in the Layout group, click Re-Layout Page, and then click More Layout Options). Stores layout style and alignment values from VisCellIndices.

Constant | Value
visLOPlaceBottomToTop | 4
visLOPlaceCircular | 6
visLOPlaceCompactDownLeft | 14
visLOPlaceCompactDownRight | 7
visLOPlaceCompactLeftDown | 13
visLOPlaceCompactLeftUp | 12
visLOPlaceCompactRightDown | 8
visLOPlaceCompactRightUp | 9
visLOPlaceCompactUpLeft | 11
visLOPlaceCompactUpRight | 10
visLOPlaceDefault | 0
visLOPlaceHierarchyBottomToTopCenter | 20
visLOPlaceHierarchyBottomToTopLeft | 19
visLOPlaceHierarchyBottomToTopRight | 21
visLOPlaceHierarchyLeftToRightBottom | 24
visLOPlaceHierarchyLeftToRightMiddle | 23
visLOPlaceHierarchyLeftToRightTop | 22
visLOPlaceHierarchyRightToLeftBottom | 27
visLOPlaceHierarchyRightToLeftMiddle | 26
visLOPlaceHierarchyRightToLeftTop | 25
visLOPlaceHierarchyTopToBottomCenter | 17
visLOPlaceHierarchyTopToBottomLeft | 16
visLOPlaceHierarchyTopToBottomRight | 18
visLOPlaceLeftToRight | 2
visLOPlaceParentDefault | 15
visLOPlaceRadial | 3
visLOPlaceRightToLeft | 5
visLOPlaceTopToBottom | 1

To refer to the ShapePlaceStyle cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShapePlaceStyle

To refer to the ShapePlaceStyle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOPlaceStyle


ShapePlowCode Cell (Shape Layout Section)

 Copy code hover
[image]

ShapePlowCode Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines whether this placeable shape moves away when you drop another placeable shape near this shape on the drawing page.

Value | Description | Automation constant
0 | Plow as page specifies. | visSLOPlowDefault
1 | Plow no shapes. | visSLOPlowNever
2 | Plow every shape. | visSLOPlowAlways

Remarks

You can also set the value of this cell for a particular shape on the Placement tab in the Behavior dialog box (with a shape selected, on the Developer tab, in the Shape Design group, click Behavior , and then click the Placement tab).

To set this behavior for all the shapes on the drawing page, use the PlowCode cell in the Page Layout section.

To get a reference to the ShapePlowCode cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShapePlowCode

To get a reference to the ShapePlowCode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOPlowCode


ShapeRouteStyle Cell (Shape Layout Section)

 Copy code hover
[image]

ShapeRouteStyle Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Determines the routing style and direction for a selected connector on the drawing page.

Value | Routing style | Direction | Automation constant
0 | Use page default | None | visLORouteDefault
1 | Right angle | None | visLORouteRightAngle
2 | Straight | None | visLORouteStraight
3 | Organization chart | Top to bottom | visLORouteOrgChartNS
4 | Organization chart | Left to right | visLORouteOrgChartWE
5 | Flowchart | Top to bottom | visLORouteFlowchartNS
6 | Flowchart | Left to right | visLORouteFlowchartWE
7 | Tree | Top to bottom | visLORouteTreeNS
8 | Tree | Left to right | visLORouteTreeWE
9 | Network | None | visLORouteNetwork
10 | Organization chart | Bottom to top | visLORouteOrgChartSN
11 | Organization chart | Right to left | visLORouteOrgChartEW
12 | Flowchart | Bottom to top | visLORouteFlowchartSN
13 | Flowchart | Right to left | visLORouteFlowchartEW
14 | Tree | Bottom to top | visLORouteTreeSN
15 | Tree | Right to left | visLORouteTreeEW
16 | Center to center | None | visLORouteCenterToCenter
17 | Simple | Top to bottom | visLORouteSimpleNS
18 | Simple | Left to right | visLORouteSimpleWE
19 | Simple | Bottom to top | visLORouteSimpleSN
20 | Simple | Right to left | visLORouteSimpleEW
21 | Simple horizontal-vertical | None | visLORouteSimpleHV
22 | Simple vertical-horizontal | None | visLORouteSimpleVH

Remarks

You can also set the value of this cell for a particular connector on the Connector tab in the Behavior dialog box (with a connector selected, click Behavior on the Developer tab, and then click the Connector tab).

To set this behavior for all the connectors on a page, use the RouteStyle cell in the Page Layout section.

In versions earlier than Visio 2000, you set this behavior using the ObjBehavior cell in the Miscellaneous section.

To get a reference to the ShapeRouteStyle cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShapeRouteStyle

To get a reference to the ShapeRouteStyle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLORouteStyle


ShapeShdwBlur Cell (Fill Format Section)

 Copy code hover
[image]

ShapeShdwBlur Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the size of the blur for a shape's shadow, in points (0.00 to 100.00).

Remarks

To get a reference to the ShapeShdwBlur cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ShapeShdwBlur

To get a reference to the ShapeShdwBlur cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillShdwBlur


ShapeShdwObliqueAngle Cell (Fill Format Section)

 Copy code hover
[image]

ShapeShdwObliqueAngle Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Specifies the angle of oblique direction of a shape's shadow.

Remarks

A value of zero (0) in this cell indicates that the angle direction is straight up and is measured moving clockwise.

This value corresponds to the value of the Direction setting in the Shadow dialog box (on the Home tab, in the Shape group, click Shadow, and then click Shadow Options).

To get a reference to the ShapeShdwObliqueAngle cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShapeShdwObliqueAngle

To get a reference to the ShapeShdwObliqueAngle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillShdwObliqueAngle


ShapeShdwOffsetX Cell (Fill Format Section)

 Copy code hover
[image]

ShapeShdwOffsetX Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the distance in page units that a shape's shadow is offset horizontally from the shape.

Remarks

This value corresponds to the value in the X Offset setting in the Shadow dialog box (on the Home tab, in the Shape group, click Shadow, and then click Shadow Options).

To get a reference to the ShapeShdwOffsetX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShapeShdwOffsetX

To get a reference to the ShapeShdwOffsetX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillShdwOffsetX


ShapeShdwOffsetY Cell (Fill Format Section)

 Copy code hover
[image]

ShapeShdwOffsetY Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the distance in page units that a shape's shadow is offset vertically from the shape.

Remarks

This value corresponds to the value in the Y Offset setting in the Shadow dialog box (on the Home tab, in the Shape group, click Shadow, and then click Shadow Options).

To get a reference to the ShapeShdwOffsetY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShapeShdwOffsetY

To get a reference to the ShapeShdwOffsetY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillShdwOffsetY


ShapeShdwScaleFactor Cell (Fill Format Section)

 Copy code hover
[image]

ShapeShdwScaleFactor Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Specifies the percentage by which the shadow of a shape can be enlarged or reduced.

Remarks

Each shadow has a shadowed pin location, which is a point on the shadow that corresponds to the shape's pin. For example, if a shape's pin is in the center of the shape, then the shadowed pin location would be the point in the center of the shadow. When applying scale to simple shadows, magnification is centered at the shadowed pin location; when applying scale to oblique shadows, magnification is applied in the oblique direction.

To set this value for all the shapes on a page, use the ShdwScaleFactor cell in the Page Properties section.

This value corresponds to the value of the Magnification setting in the Shadow dialog box (on the Home tab, in the Shape group, click Shadow, and then click Shadow Options).

To get a reference to the ShapeShdwScaleFactor cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShapeShdwScaleFactor

To get a reference to the ShapeShdwScaleFactor cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillShdwScaleFactor


ShapeShdwShow Cell (Fill Format Section)

 Copy code hover
[image]

ShapeShdwShow Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines whether the shape displays a shadow, as an integer from 0 to 2.

Value | Description
0 | Always display the shadow if a shadow is specified. The shadows for sub-shapes are not displayed.
1 | Do not render a shadow unless the shape does not have a parent. Use sub-shape shadows if grouped together.
2 | Always display a shadow if a shadow is specified. The shadows for sub-shapes are displayed.

Remarks

To get a reference to the ShapeShdwShow cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ShapeShdwShow

To get a reference to the ShapeShdwShow cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillShdwShow


ShapeShdwType Cell (Fill Format Section)

 Copy code hover
[image]

ShapeShdwType Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Specifies the type of shadow for a shape.

Value | Description | Automation constant
0 | Use page default (the default) | visFSTPageDefault
1 | Simple | visFSTSimple
2 | Oblique | visFSTOblique

Remarks

Use this cell to apply a shape shadow that is different from the page default (the page default shadow type is defined in the ShdwType cell in the Page Properties Section).

Simple shadow types are described as offset shadows in the user interface (UI). A simple shadow gives the effect of the shape being shadowed onto a parallel plane located behind the shape. Oblique shadows are described as oblique shadows in the UI and give the effect of a shadow being cast onto a plane perpendicular to the shape.

For a list of predefined simple and oblique shadow types, see the Style box in the Shadow dialog box (on the Home tab, in the Shape group, click Shadow, and then click Shadow Options).

To get a reference to the ShapeShdwType cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShapeShdwType

To get a reference to the ShapeShdwType cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillShdwType


ShapeSplit Cell (Shape Layout Section)

 Copy code hover
[image]

ShapeSplit Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Indicates whether this shape can split shapes that are splittable.

Value | Description | Automation constant
0 | Do not allow this shape to split other shapes. | visSLOSplitNone
1 | Allow this shape to split other shapes. | visSLOSplitAllow

Remarks

A shape that can split other shapes must be either a 2-D shape or a 1-D placeable shape.

Automatic splitting of shapes is enabled and disabled at three different levels: application, page, and shape. By default, splitting is enabled at the application and page level; for shapes, it varies by drawing type.

To enable or disable splitting at the application level, use the Enable connector splitting setting on the Advanced tab of the Visio Options dialog box (click the File tab, click Options, and then click Advanced).

To enable or disable splitting on a page, see the PageShapeSplit cell.

To cause a 1-D shape to be splittable, see the ShapeSplittable cell.

To get a reference to the ShapeSplit cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

ShapeSplit

To get a reference to the ShapeSplit cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOSplit


ShapeSplittable Cell (Shape Layout Section)

 Copy code hover
[image]

ShapeSplittable Cell (Shape Layout Section)
Send feedback

Published: July 16, 2012

Indicates whether this 1-D shape can be split.

Value | Description | Automation constant
0 | Do not allow this shape to be split. | visSLOSplittableNone
1 | Allow this shape to be split. | visSLOSplittableAllow

Remarks

The default behavior for connectors and other 1-D shapes varies by drawing type.

Automatic splitting of shapes is enabled and disabled at three different levels: application, page, and shape. By default, splitting is enabled at the application level and page levels.

To enable or disable splitting at the application level, use the Enable connector splitting setting on the Advanced tab of the Visio Options dialog box (click the File tab, click Options , and then click Advanced ).

To enable or disable splitting on a page, see the PageShapeSplit cell.

To cause a shape to be able to split 1-D splittable shapes, see the ShapeSplit cell.

To get a reference to the ShapeSplittable cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

ShapeSplittable

To get a reference to the ShapeSplittable cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowShapeLayout
Cell index: | visSLOSplittable


Sharpen Cell (Image Properties Section)

 Copy code hover
[image]

Sharpen Cell (Image Properties Section)
Send feedback

Published: July 16, 2012

Sharpens a bitmap image. The default value is 0%. Sharpening an image focuses it by increasing the contrast of adjacent pixels.

Remarks

To get a reference to the Sharpen cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Sharpen

To get a reference to the Sharpen cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowImage
Cell index: | visImageSharpen


ShdwForegnd Cell (Fill Format Section)

 Copy code hover
[image]

ShdwForegnd Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the color used for the foreground (stroke) of the shape's drop shadow fill pattern.

Remarks

To set the color, enter a number from 0 to 23, which is an index into a collection of colors.

To enter a custom color, use the RGB or HSL function. The value of a custom color is its RGB color, and RGB(r, g, b), rather than a number, will be shown in the ShapeSheet window. When used in numeric operations, custom colors have values of 24 and above.

You can set the transparency of the foreground color of the shape's drop shadow fill pattern in the ShdwForegndTrans cell.

To get a reference to the ShdwForegnd cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShdwForegnd

To get a reference to the ShdwForegnd cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillShdwForegnd


ShdwForegndTrans Cell (Fill Format Section)

 Copy code hover
[image]

ShdwForegndTrans Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the transparency level for the color used for the foreground (stroke) of the shape's drop shadow fill pattern.

Value | Description
0 - 100 | Represents the percentage of transparency. The default is 0% (completely opaque).

Remarks

Values are rounded to the nearest half percent. A value of 100% is completely transparent. Although a shadow that has a completely transparent fill appears the same on the drawing page as a shadow that has no fill, it interacts with other objects on the page in the same ways as if its transparency were 0%.

You can also set this value by using the slider control in the Shadow dialog box (on the Home tab, in the Shape group, click Shadow, and then click Shadow Options). This value controls the value of both the background and foreground shadow transparencies. To set these values independently, you must enter them in the ShapeSheet window.

To get a reference to the ShdwForegndTrans cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShdwForegndTrans

To get a reference to the ShdwForegndTrans cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillShdwForegndTrans


ShdwObliqueAngle Cell (Page Properties Section)

 Copy code hover
[image]

ShdwObliqueAngle Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Contains a number specifying the angle of oblique direction when applying the default page shadow type.

Remarks

A value of zero (0) in this cell indicates that the angle direction is straight up and is measured moving clockwise.

The angle described in this cell is used whenever the ShapeShdwType Cell (the shadow type for a shape on the page) is set to Page Default (visFSTPageDefault), and the shadow type is oblique. The default page shadow type is defined in the ShdwType cell.

To set this behavior for an individual shape, use the ShapeShdwObliqueAngle cell in the Fill Format section.

To get a reference to the ShdwObliqueAngle cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShdwObliqueAngle

To get a reference to the ShdwObliqueAngle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageShdwObliqueAngle


ShdwOffsetX Cell (Page Properties Section)

 Copy code hover
[image]

ShdwOffsetX Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Determines the distance in page units that a shape's drop shadow is offset horizontally from the shape.

Remarks

This value is set in the Page Setup dialog box (on the Design tab, click the Page Setup arrow). This value is independent of the scale of the drawing. If the drawing is scaled, the shadow offset remains the same.

To get a reference to the ShdwOffsetX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShdwOffsetX

To get a reference to the ShdwOffsetX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageShdwOffsetX


ShdwOffsetY Cell (Page Properties Section)

 Copy code hover
[image]

ShdwOffsetY Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Determines the distance in page units that a shape's drop shadow is offset vertically from the shape.

Remarks

This value is set in the Page Setup dialog box (on the Design tab, click the Page Setup arrow). This value is independent of the scale of the drawing. If the drawing is scaled, the shadow offset remains the same.

To get a reference to the ShdwOffsetY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShdwOffsetY

To get a reference to the ShdwOffsetY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageShdwOffsetY


ShdwPattern Cell (Fill Format Section)

 Copy code hover
[image]

ShdwPattern Cell (Fill Format Section)
Send feedback

Published: July 16, 2012

Determines the fill pattern for a shape's shadow.

Value | Description
0 | None (transparent fill)
1 | Solid foreground color
2 - 40 | Assorted patterns

Remarks

To set the fill pattern, enter a number from 0 to 40, which is an index into a collection of patterns. You can view the fill pattern collection in the Fill dialog box (on the Home tab, in the Shape group, click Fill, and then click Fill Options).

To get a reference to the ShdwPattern cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShdwPattern

To get a reference to the ShdwPattern cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowFill
Cell index: | visFillShdwPattern


ShdwScaleFactor Cell (Page Properties Section)

 Copy code hover
[image]

ShdwScaleFactor Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Specifies the percentage to enlarge or reduce a shape's shadow.

Remarks

Each shadow has a shadowed pin location, which is a point on the shadow that corresponds to the shape's pin. For example, if a shape's pin is in the center of the shape, then the shadowed pin location would be the point in the center of the shadow. When applying scale to simple shadows, magnification is centered at the shadowed pin location; when applying scale to oblique shadows, magnification is applied in the oblique direction.

This percentage is used when the shadow type for a shape is set to Page Default (ShapeShdwType cell equals visFSTPageDefault).

To set this behavior for an individual shape, use the ShapeShdwScaleFactor cell in the Fill Format section.

This value corresponds to the value in the Magnification box on the Shadows tab in the Page Setup dialog box (on the Design tab, click the Page Setup arrow).

To get a reference to the ShdwScaleFactor cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShdwScaleFactor

To get a reference to the ShdwScaleFactor cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageShdwScaleFactor


ShdwType Cell (Page Properties Section)

 Copy code hover
[image]

ShdwType Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Indicates the default shadow type for a page.

Value | Description | Automation constant
1 | Simple | visFSTSimple
2 | Oblique | visFSTOblique
3 | Inner | visFSTInner

Remarks

The shadow type described in this cell is used whenever the ShapeShdwType Cell (the shadow type for an individual shape on the page) is set to Page Default (visFSTPageDefault).

Simple shadow types are described as offset shadows in the user interface (UI). A simple shadow gives the effect of the shape being shadowed onto a parallel plane located some distance behind it. Oblique shadows are described as oblique shadows in the UI and give the effect of a shadow being cast onto a plane perpendicular to the shape.

For a list of predefined simple and oblique shadow types, see the Style list on the Shadows tab of the Page Setup dialog box (on the Design tab, click the Page Setup arrow).

To get a reference to the ShdwType cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

ShdwType

To get a reference to the ShapeShdwOffsetX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageShdwType


Size Cell (Character Section)

 Copy code hover
[image]

Size Cell (Character Section)
Send feedback

Published: July 16, 2012

Determines the size of the text in the shape's text block.

Remarks

The text's size is independent of the scale of the drawing. If the drawing is scaled, the text size remains the same.

To get a reference to the Size cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.Size[i]
where i = <1>, 2, 3...

To get a reference to the Size cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterSize


SketchAmount Cell (Additional Effect Properties Section)

 Copy code hover
[image]

SketchAmount Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the amount of distortion for a sketch effect, as an integer between 0 and 25.

Value | Description
0 | The shape has no sketch effect applied to it.
1-25 | The shape has sketch distortion applied to it, where a value of 1 is the most distortion and 25 is the least.

Remarks

To get a reference to the SketchAmount cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

SketchAmount

To get a reference to the SketchAmount cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visSketchAmount


SketchEnabled Cell (Additional Effect Properties Section)

 Copy code hover
[image]

SketchEnabled Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines whether a sketch effect is displayed on the shape or not, as a Boolean.

Remarks

To get a reference to the SketchEnabled cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

SketchEnabled

To get a reference to the SketchEnabled cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visSketchEnabled


SketchFillChange Cell (Additional Effect Properties Section)

 Copy code hover
[image]

SketchFillChange Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the amount of randomization of the shape's fill from the shape's geometry when using a sketch effect, as a percentage of the length of a section. If the value of the SketchFillChange cell is set to 0%, the bounding geometry of a shape's fill matches the shape's geometry. If the value is 100%, the bounding geometry of the shape's fill does not follow the geometry of the shape.

Remarks

For best results, the ideal range of values for the SketchFillChange cell is between 15% and 50%. A value below 15% is barely noticeable; a value greater than 50% is increasingly more randomized.

To get a reference to the SketchFillChange cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

SketchFillChange

To get a reference to the SketchFillChange cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visSketchFillChange


SketchLineChange Cell (Additional Effect Properties Section)

 Copy code hover
[image]

SketchLineChange Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the amount of randomization of the shape's line from the shape's geometry when using a sketch effect, as a percentage of the length of a section. If the value of the SketchLineChange cell is set to 0%, the geometry of the shape's line matches the shape's geometry. If the value is 100%, the geometry of the shape's line does not follow the geometry of the shape.

Remarks

For best results, the ideal range of values for the SketchLineChange cell is between 15% and 50%. A value below 15% is barely noticeable; a value greater than 50% could randomize the line too much.

To get a reference to the SketchLineChange cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

SketchLineChange

To get a reference to the SketchLineChange cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visSketchLineChange


SketchLineWeight Cell (Additional Effect Properties Section)

 Copy code hover
[image]

SketchLineWeight Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the additional thickness added to line weight as the result of a sketch effect, in points from 0 to 50. The thickness of a shape's line increases as the value of the SketchLineWeight cell increases.

Remarks

To get a reference to the SketchLineWeight cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

SketchLineWeight

To get a reference to the SketchLineWeight cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visSketchLineWeight


SketchSeed Cell (Additional Effect Properties Section)

 Copy code hover
[image]

SketchSeed Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Represents a randomization value used to determine the geometry of a sketch effect, as a positive integer. The value of the SketchSeed cell is randomly created when a sketch effect is applied to the shape.

Remarks

To get a reference to the SketchSeed cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

SketchSeed

To get a reference to the SketchSeed cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visSketchSeed


Snap Cell (Layers Section)

 Copy code hover
[image]

Snap Cell (Layers Section)
Send feedback

Published: July 16, 2012

Determines whether other shapes can snap to shapes assigned to the layer. Shapes assigned to the layer can snap to other shapes, but other shapes can't snap to them.

Value | Description
TRUE | Other shapes can snap to shapes on the layer.
FALSE | Other shapes cannot snap to shapes on the layer.

Remarks

You can also set the value of this cell using the Snap option in the Layer Properties dialog box (on the Home tab, in the Editing group, click Layers, and then click Layer Properties).

To get a reference to the Snap cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Layers.Snap[i] where i = <1>, 2, 3...

To get a reference to the Snap cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionLayer
Row index: | visRowLayer + i where i = 0, 1, 2...
Cell index: | visLayerSnap


SoftEdgesSize Cell (Additional Effect Properties Section)

 Copy code hover
[image]

SoftEdgesSize Cell (Additional Effect Properties Section)
Send feedback

Published: July 16, 2012

Determines the size of a soft edge effect, in points from 0.00 to 100.00. If the SoftEdgesSize cell has a value of 0, the shape does not have soft edges.

Remarks

To get a reference to the SoftEdgesSize cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

SoftEdgesSize

To get a reference to the SoftEdgesSize cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowOtherEffectProperties
Cell index: | visSoftEdgesSize


SortKey Cell (Actions Section)

 Copy code hover
[image]

SortKey Cell (Actions Section)
Send feedback

Published: July 16, 2012

A number that determines the order of actions that appear on a shortcut or action tag menu.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

The actions on an action tag or shortcut menu appear on the menu sorted from lowest to highest, with lower numbers appearing at the top of the menu. If two action rows have the same SortKey cell value, the order is determined by physical row order. The default is 0 (zero).

To get a reference to the SortKey cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Actions.name.SortKeywhere Actions.name is the name of the Actions row

To get a reference to the SortKey cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2...
Cell index: | visActionSortKey


SortKey Cell (Hyperlinks Section)

 Copy code hover
[image]

SortKey Cell (Hyperlinks Section)
Send feedback

Published: July 16, 2012

A number that determines the order of hyperlinks that appear on a shortcut menu.

Remarks

The hyperlinks on a shortcut menu appear on the menu sorted from lowest to highest, with lower numbers appearing at the top of the menu. If two hyperlink rows have the same SortKey cell value, the order is determined by physical row order. The default is 0 (zero).

To get a reference to the SortKey cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Hyperlink.name.SortKey where Hyperlink.name is the row name

To get a reference to the SortKey cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionHyperlink
Row index: | visRow1stHyperlink + i where i = 0, 1, 2...
Cell index: | visHLinkSortKey


SortKey Cell (Shape Data Section)

 Copy code hover
[image]

SortKey Cell (Shape Data Section)
Send feedback

Published: July 16, 2012

Evaluates to a string that influences the order in which items in the Shape Data window are listed.

Remarks

The calculation used to compare SortKey values is locale-specific and case insensitive. If SortKey values are equal, the shape data is listed in row order. Shape data that have no sort key are listed after shape data that contain a sort key.

Following is an example of using sort keys to display the shape data in the Shape Data window in the order: Item Number, Quantity, Price.

Row, Label, and SortKey refer to cells in the shape data row. In this case, the shape data rows have been named.

Row | Label | SortKey
Prop.Item | Item Number | 1
Prop.Price | Price | 3
Prop.Quan | Quantity | 2

To get a reference to the SortKey cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Prop.Name.SortKey where Prop.Name is the name of the custom property row

To get a reference to the SortKey cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionProp
Row index: | visRowProp + i where i = 0, 1, 2...
Cell index: | visCustPropsSortKey


Spacing Cell (Character Section)

 Copy code hover
[image]

Spacing Cell (Character Section)
Send feedback

Published: July 16, 2012

Controls the amount of space between two or more characters. Space can be added or subtracted in 1/20th point increments.

Remarks

You can also set the value of this cell by using the Text dialog box (on the Home tab, click the Font arrow).

To get a reference to the Spacing cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.Letterspace[i] where i = <1>, 2, 3...

To get a reference to the Spacing cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterspace


SpAfter Cell (Paragraph Section)

 Copy code hover
[image]

SpAfter Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Determines the amount of space inserted after each paragraph in the shape's text block, in addition to any space from the SpLine cell and, if it is the last paragraph in a text block, the BottomMargin cell.

Remarks

This value is independent of the scale of the drawing. If the drawing is scaled, the Space After setting remains the same.

To get a reference to the SpAfter cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para.SpAfter[i]
where i = <1>, 2, 3...

To get a reference to the SpAfter cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visSpaceAfter


SpBefore Cell (Paragraph Section)

 Copy code hover
[image]

SpBefore Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Determines the amount of space inserted before each paragraph in the shape's text block, in addition to any space from the SpLine cell if it is the first paragraph in a text block, the TopMargin cell.

Remarks

This value is independent of the scale of the drawing. If the drawing is scaled, the Space Before setting remains the same.

To get a reference to the SpBefore cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para.SpBefore[i]
where i = <1>, 2, 3...

To get a reference to the SpBefore cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visSpaceBefore


SpLine Cell (Paragraph Section)

 Copy code hover
[image]

SpLine Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Determines the distance between one line of text and the next, expressed as a percentage, where 100% is the height of a text line.

Value | Description
>0 | Absolute spacing, regardless of font size
=0 | Set solid (spacing = 100% of font size)
<0 | A percentage of font size (for example, -120% yields 120% spacing)

Remarks

To get a reference to the SpLine cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para. SpLine [i]
where i = <1>, 2, 3...

To get a reference to the SpLine cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visSpaceLine


Strikethru Cell (Character Section)

 Copy code hover
[image]

Strikethru Cell (Character Section)
Send feedback

Published: July 16, 2012

Determines whether the text is formatted as strikethrough.

Value | Description
TRUE | Text is formatted as strikethrough.
FALSE | Text is not formatted as strikethrough.

Remarks

You can also set the value of this cell by using the Text dialog box (on the Home tab, click the Font arrow).

To get a reference to the Strikethru cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.Strikethru[i] where i = <1>, 2, 3...

To get a reference to the Strikethru cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterStrikethru


Style Cell (Character Section)

 Copy code hover
[image]

Style Cell (Character Section)
Send feedback

Published: July 16, 2012

Shows the character formatting applied to a range of text in the shape's text block.

Style | Value | Automation constant
Bold | &H1 | visBold
Italic | &H2 | visItalic
Underline | &H4 | visUnderLine
Small caps | &H8 | visSmallCaps

Remarks

The Style cell contains formatting information applied to a sub-range of a shape's text if the Characters section contains multiple rows. Otherwise, it contains formatting information for all of the shape's text.

The value represents a binary number in which each bit indicates a character style. For example, a value of 3 represents text formatted in both italic and bold. If the value of Style is 0, the text is plain, or unformatted. You can test for a particular format using Boolean BIT* functions. See your programming documentation for details about these functions.

To get a reference to the Style cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Char.Style[i]
where i = <1>, 2, 3...

To get a reference to the Style cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterStyle

Example

Suppose the Color cell in the first row of a shape's Character section is set to this formula:

= IF(BITAND(Char.Style,1)=1,4,3)

Then if the first character of the shape's text is bold, the text covered by the first Character properties row will be blue (4); otherwise it will be green (3). This example assumes default colors are in effect.

The following is an example of setting the Style cell in a program. The first statement references the Style cell by name, and the second statement references the Style cell by index. Both statements apply italic to the text covered by the second row of a shape's Character section.


SubAddress Cell (Hyperlinks Section)

 Copy code hover
[image]

SubAddress Cell (Hyperlinks Section)
Send feedback

Published: July 16, 2012

Specifies a location within the target document to link to.

Remarks

For example, if the Address cell is "Drawing1.vsdx", the SubAddress cell can specify a page name such as "Page-3". If the Address cell is the Microsoft Excel file "Samples.xlsx", the value of this cell can be a worksheet or range within a worksheet, such as "Worksheet Functions" or "Sheet1!A1:D10". If the Address cell is "http://www.microsoft.com/office/", the value of this cell can be a named anchor within the document, such as "solutions".

You can also set the value of this cell in the Hyperlinks dialog box (in the Links group on the Insert tab, click Hyperlink).

To get a reference to the SubAddress cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Hyperlink.name.SubAddress where Hyperlink.name is the row name

To get a reference to the SubAddress cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionHyperlink
Row index: | visRow1stHyperlink + i where i = 0, 1, 2...
Cell index: | visHLinkSubAddress


TagName Cell (Action Tags Section)

 Copy code hover
[image]

TagName Cell (Action Tags Section)
Send feedback

Published: July 16, 2012

Name of the action tag that is used as a key to associate the action tag with its actions.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

The TagName cell in the Action Tags section works together with the TagName cell in the Actions section to associate an action tag with its actions. Rows in the Actions section also have a TagName cell, and those rows with the same TagName cell value as this cell define actions to take for this action tag.

To get a reference to the TagName cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

SmartTags.name.TagName
where SmartTags.name is the name of the action tag row

To get a reference to the TagName cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionSmartTag
Row index: | visRowSmartTag + i where i = 0, 1, 2...
Cell index: | visSmartTagName


TagName Cell (Actions Section)

 Copy code hover
[image]

TagName Cell (Actions Section)
Send feedback

Published: July 16, 2012

Contains the name of the action tag that this action is associated with.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

The TagName cell in the Actions section works together with the TagName cell in the Action Tags section to associate an action tag with its actions.

  • If the TagName cell in an Actions row is blank, the action appears on a shortcut menu, not on an action tag menu.

  • If a TagName cell value in the Actions row matches the TagName cell value in a Smart Tags row, the action appears on the action tag menu.

  • If an action's TagName cell has a value but it does not match the TagName value in any shape tag row, that action does not appear on any action tag menus or shortcut menus.

  • If several smart tag rows have the same TagName value, they will all show the same actions.

To get a reference to the TagName cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Actions.name.TagNamewhere Actions.name is the name of the Actions row

To get a reference to the TagName cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAction
Row index: | visRowAction + i where i = 0, 1, 2...
Cell index: | visActionTagName


TextBkgnd Cell (Text Block Format Section)

 Copy code hover
[image]

TextBkgnd Cell (Text Block Format Section)
Send feedback

Published: July 16, 2012

Determines the text background color for a shape.

Remarks

The TextBkgnd cell can have any value from 0 through 24, or 255. The values 0 and 255 (visTxtBlklOpaque) both indicate a transparent text background.

To enter a custom color, use the RGB or HSL function plus one—for example, RGB(255,127,255)+1. The value of a custom color is its RGB color, and RGB(r, g, b)+1, rather than a number, will be shown in the ShapeSheet window. When used in numeric operations, custom colors have values of 25 and above.

You can set the transparency of the text background color in the TextBkgndTrans cell.

To get a reference to the TextBkgnd cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

TextBkgnd

To get a reference to the TextBkgnd cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowText
Cell index: | visTxtBlkBkgnd


TextBkgndTrans Cell (Text Block Format Section)

 Copy code hover
[image]

TextBkgndTrans Cell (Text Block Format Section)
Send feedback

Published: July 16, 2012

Determines the transparency level for the background color of the shape's text block.

Value | Description
0 - 100 | Represents the percentage of transparency. The default is 0% (completely opaque).

Remarks

Values are rounded to the nearest half percent. A value of 100% is completely transparent. Although a shape that has a completely transparent text background appears the same on the drawing page as a shape that has no text background, it interacts with other objects on the page in the same way as if its transparency were 0%.

You can also set this value using the slider control on the Font tab of the Text dialog box (on the Home tab, click the Font arrow).

To get a reference to the TextBkgndTrans cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TextBkgndTrans

To get a reference to the TextBkgndTrans cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowText
Cell index: | visTxtBlkBkgndTrans


TextDirection Cell (Text Block Format Section)

 Copy code hover
[image]

TextDirection Cell (Text Block Format Section)
Send feedback

Published: July 16, 2012

Determines the direction of the characters in a text block.

Value | Direction | Automation constant
0 | Horizontal | visTxtBlkLeftToRight
1 | Vertical | visTxtBlkTopToBottom

Remarks

In Visio version 5.0 Japanese products, the value of this cell was stored in the VerticalText cell in the Miscellaneous section.

To get a reference to the TextDirection cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TextDirection

To get a reference to the TextDirection cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowText
Cell index: | visTxtBlkDirection


TextPosAfterBullet Cell (Paragraph Section)

 Copy code hover
[image]

TextPosAfterBullet Cell (Paragraph Section)
Send feedback

Published: July 16, 2012

Represents the distance between the first line of the paragraph and the bullet.

Remarks

This distance is added to the distance contained in the IndFirst cell, which is the default left indent. This value is independent of the scale of the drawing.

To get a reference to the TextPosAfterBullet cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Para.TextPosAfterBullet[i]
where i = <1>, 2, 3...

To get a reference to the TextPosAfterBullet cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionParagraph
Row index: | visRowParagraph + i where i = 0, 1, 2...
Cell index: | visTextPosAfterBullet


TheData Cell (Events Section)

 Copy code hover
[image]

TheData Cell (Events Section)
Send feedback

Published: July 16, 2012

Reserved for future use.


ThemeIndex Cell (Theme Properties Section)

 Copy code hover
[image]

ThemeIndex Cell (Theme Properties Section)
Send feedback

Published: July 16, 2012

Stores the enumeration of the built-in Microsoft Visio theme applied to the document, as an integer. When a new theme is chosen for the document, the ThemeIndex cell for the document and all pages and shapes it contains is updated with the index of the built-in theme.

Remarks

To get a reference to the ThemeIndex cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

ThemeIndex

To get a reference to the ThemeIndex cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowThemeProperties
Cell index: | visThemeIndex


TheText Cell (Events Section)

 Copy code hover
[image]

TheText Cell (Events Section)
Send feedback

Published: July 16, 2012

An event cell that is evaluated when a shape's text or text composition changes.

Remarks

Event cells are evaluated only when the event occurs, not upon formula entry. You can use the TheText cell to trigger recalculations, for example, to recalculate the text width and height with the TEXTWIDTH( ) and TEXTHEIGHT( ) functions.

To get a reference to the TheText cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TheText

To get a reference to the TheText cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowEvent
Cell index: | visEvtCellTheText


Tip Cell (Controls Section)

 Copy code hover
[image]

Tip Cell (Controls Section)
Send feedback

Published: July 16, 2012

Represents a descriptive text string that appears as a tool tip when a user pauses the pointer over a shape's control handle. The application automatically encloses the tip string in quotation marks in the cell, but the quotation marks are not displayed in the tool tip.

Remarks

To get a reference to the Tip cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Controls.name.Tipwhere Controls.name is the name of the controls row.

To get a reference to the Tip cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionControls
Row index: | visRowControl + i where i = 0, 1, 2...
Cell index: | visCtlTip


TopMargin Cell (Text Block Format Section)

 Copy code hover
[image]

TopMargin Cell (Text Block Format Section)
Send feedback

Published: July 16, 2012

Determines the distance between the top border of the text block and the first line of text it contains. The default is 4.0000 point. This value is independent of the scale of the drawing. If the drawing is scaled, the top margin remains the same.

Remarks

To get a reference to the TopMargin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TopMargin

To get a reference to the TopMargin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowText
Cell index: | visTxtBlkTopMargin


Transparency Cell (Character Section)

 Copy code hover
[image]

Transparency Cell (Character Section)
Send feedback

Published: July 16, 2012

Determines the transparency level for a range of a shape's text color.

Value | Description
0 - 100 | Represents the percentage of transparency. The default is 0% (completely opaque).

Remarks

Values are rounded to the nearest half percent. A value of 100% is completely transparent. Although a shape that has completely transparent text appears the same on the drawing page as a shape that has no text, it interacts with other objects on the page in the same way as if its transparency were 0%.

You can also set this value by using the slider control on the Font tab in the Text dialog box (on the Home tab, click the Font arrow).

If the Characters section contains multiple rows, the Transparency cell contains formatting information applied to a sub-range of a shape's text. Otherwise, it contains formatting information for all of the shape's text.

To get a reference to the Transparency cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Char.ColorTrans[i] where i = <1>, 2, 3...

To get a reference to the Transparency cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionCharacter
Row index: | visRowCharacter + i where i = 0, 1, 2...
Cell index: | visCharacterColorTrans


Transparency Cell (Image Properties Section)

 Copy code hover
[image]

Transparency Cell (Image Properties Section)
Send feedback

Published: July 16, 2012

Determines the transparency level for a layer color.

Value | Description
0 - 100 | Represents the percentage of transparency. The default is 0% (completely opaque).

Remarks

Values are rounded to the nearest half percent. A value of 100% is completely transparent. Although a layer that has completely transparent color appears the same on the drawing page as a layer that has no color, it interacts with other objects on the page in the same way as if its transparency were 0%. You can also set this value by using the slider control in the Layer Properties dialog box (on the Home tab, in the Editing group, click Layers, and then click Layer Properties).

To get a reference to the Transparency cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Transparency

To get a reference to the Transparency cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowImage
Cell index: | visImageTransparency


Transparency Cell (Layers Section)

 Copy code hover
[image]

Transparency Cell (Layers Section)
Send feedback

Published: July 16, 2012

Determines the transparency level for a layer color.

Value | Description
0 - 100 | Represents the percentage of transparency. The default is 0% (completely opaque).

Remarks

Values are rounded to the nearest half percent. A value of 100% is completely transparent. Although a layer that has completely transparent color appears the same on the drawing page as a layer that has no color, it interacts with other objects on the page in the same way as if its transparency were 0%. You can also set this value by using the slider control in the Layer Properties dialog box (on the Home tab, in the Editing group, click Layers, and then click Layer Properties).

To get a reference to the Transparency cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Layers.ColorTrans[i] where i = <1>, 2, 3...

To get a reference to the Transparency cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionLayer
Row index: | visRowLayer + i where i = 0, 1, 2...
Cell index: | visLayerColorTrans


TxtAngle Cell (Text Transform Section)

 Copy code hover
[image]

TxtAngle Cell (Text Transform Section)
Send feedback

Published: July 16, 2012

Determines the text block's current angle of rotation in relation to the x-axis of the shape. The default is 0 degrees.

Remarks

To get a reference to the TxtAngle cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TxtAngle

To get a reference to the TxtAngle cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowTextXForm
Cell index: | visXFormAngle


TxtHeight Cell (Text Transform Section)

 Copy code hover
[image]

TxtHeight Cell (Text Transform Section)
Send feedback

Published: July 16, 2012

Determines the height of the text block. The default formula is:

= Height * 1

Remarks

To get a reference to the TxtHeight cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TxtHeight

To get a reference to the TxtHeight cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowTextXForm
Cell index: | visXFormHeight


TxtLocPinX Cell (Text Transform Section)

 Copy code hover
[image]

TxtLocPinX Cell (Text Transform Section)
Send feedback

Published: July 16, 2012

Determines the x-coordinate of the text block's center of rotation in relation to the origin of the text block. The default formula is:

= TxtWidth * 0.5

This formula evaluates to the horizontal center of the text block.

Remarks

To get a reference to the TxtLocPinX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TxtLocPinX

To get a reference to the TxtLocPinX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowTextXForm
Cell index: | visXFormLocPinX


TxtLocPinY Cell (Text Transform Section)

 Copy code hover
[image]

TxtLocPinY Cell (Text Transform Section)
Send feedback

Published: July 16, 2012

Determines the y-coordinate of the text block's center of rotation relative to the origin of the text block. The default formula is:

= TxtHeight * 0.5

Remarks

To get a reference to the TxtLocPinY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TxtLocPinY

To get a reference to the TxtLocPinY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowTextXForm
Cell index: | visXFormLocPinY


TxtPinX Cell (Text Transform Section)

 Copy code hover
[image]

TxtPinX Cell (Text Transform Section)
Send feedback

Published: July 16, 2012

Determines the x-coordinate of the text block's center of rotation in relation to the origin of the shape. The default formula is:

= Width * 0.5

Remarks

To get a reference to the TxtPinX cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TxtPinX

To get a reference to the TxtPinX cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowTextXForm
Cell index: | visXFormPinX


TxtPinY Cell (Text Transform Section)

 Copy code hover
[image]

TxtPinY Cell (Text Transform Section)
Send feedback

Published: July 16, 2012

Determines the y-coordinate of the text block's center of rotation in relation to the origin of the shape. The default formula is:

= Height * 0.5

Remarks

To get a reference to the TxtPinY cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TxtPinY

To get a reference to the TxtPinY cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowTextXForm
Cell index: | visXFormPinY


TxtWidth Cell (Text Transform Section)

 Copy code hover
[image]

TxtWidth Cell (Text Transform Section)
Send feedback

Published: July 16, 2012

Determines the width of the text block. The default formula is:

= Width * 1

Remarks

To get a reference to the TxtWidth cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

TxtWidth

To get a reference to the TxtWidth cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowTextXForm
Cell index: | visXFormWidth


Type / C Cell (Connection Points Section)

 Copy code hover
[image]

Type / C Cell (Connection Points Section)
Send feedback

Published: July 16, 2012

Determines the connection point type.

Value | Type | Automation constant
0 | Inward | visCnnctTypeInward
1 | Outward | visCnnctTypeOutward
2 | Inward & Outward | visCnnctTypeInwardOutward

Remarks

You can also set the connection point type by choosing the Connector tool, selecting a shape, and then right-clicking a connection point. To do this, you need to run in developer mode.

To get a reference to the Type / C cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Connections.Type[ i ]
where i = <1>, 2, 3...

To get a reference to the Type / C cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionConnectionPts
Row index: | visRowConnectionPts + i where i = 0, 1, 2...
Cell index: | visCnnctType (non-extended rows) visCnnctC (extended rows)

For information about non-extended and extended rows, see Connection Points row.


Type Cell (Shape Data Section)

 Copy code hover
[image]

Type Cell (Shape Data Section)
Send feedback

Published: July 16, 2012

Specifies a data type for the shape data value.

Value | Description | Automation constant
0 | String. This is the default. | visPropTypeString
1 | Fixed list. Displays the list items in a drop-down combo box in the Define Shape Data dialog box. Specify the list items in the Format cell. Users can select only one item from the list. | visPropTypeListFix
2 | Number. Includes date, time, duration, and currency values as well as scalars, dimensions, and angles. Specify a format picture in the Format cell. | visPropTypeNumber
3 | Boolean. Displays FALSE and TRUE as items users can select from a drop-down list box in the Define Shape Data dialog box. | visPropTypeBool
4 | Variable list. Displays the list items in a drop-down combo box in the Define Shape Data dialog box. Specify the list items in the Format cell. Users can select a list item or enter a new item that is added to the current list in the Format cell. | visPropTypeListVar
5 | Date or time value. Displays days, months, and years, or seconds, minutes, and hours, or a combined date and time value. Specify a format picture in the Format cell. | visPropTypeDate
6 | Duration value. Displays elapsed time. Specify a format picture in the Format cell. | visPropTypeDuration
7 | Currency value. Uses the system's current Regional Settings. Specify a format picture in the Format cell. | visPropTypeCurrency

Remarks

To get a reference to the Type cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Prop.Name.Type where Prop.Name is the row name

To get a reference to the Type cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionProp
Row index: | visRowProp + i where i = 0, 1, 2...
Cell index: | visCustPropsType


Type Cell (Text Fields Section)

 Copy code hover
[image]

Type Cell (Text Fields Section)
Send feedback

Published: July 16, 2012

Specifies a data type for the text field value.

Value | Description
0 | String.
2 | Number. Includes date, time, duration, and currency values as well as scalars, dimensions, and angles. Specify a format picture in the Format cell.
5 | Date or time value. Displays days, months, and years, or seconds, minutes, and hours, or a combined date and time value. Specify a format picture in the Format cell.
6 | Duration value. Displays elapsed time. Specify a format picture in the Format cell.
7 | Currency value. Uses the system's current Regional Settings. Specify a format picture in the Format cell.

Remarks

You can also set the value of this cell using the Field dialog box (with a shape selected, on the Insert tab, in the Text group, click Field ).

To get a reference to the Type cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Fields.Type[i] where i = <1>, 2, 3...

To get a reference to the Type cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionTextField
Row index: | visRowField + i where i = 0, 1, 2...
Cell index: | visFieldType


UICategory Cell (Text Fields Section)

 Copy code hover
[image]

UICategory Cell (Text Fields Section)
Send feedback

Published: July 16, 2012

Determines the category of an inserted field in versions of Visio earlier than Visio 2000.

Remarks

This cell does not appear in the ShapeSheet window. Use this cell if you need to deal with backward capability issues such as saving a Visio version 2000 drawing in Visio version 5.0 file format.

To get a reference to the UICategory cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Fields.UICat[i]
where i = <1>, 2, 3...

To get a reference to the UICategory cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionTextField
Row index: | visRowField + i where i = 0, 1, 2...
Cell index: | visFieldUICategory


UICode Cell (Text Fields Section)

 Copy code hover
[image]

UICode Cell (Text Fields Section)
Send feedback

Published: July 16, 2012

Determines the code of an inserted field in versions of Visio earlier than Visio 2000.

Remarks

This cell does not appear in the ShapeSheet window. Use this cell if you need to deal with backward capability issues, such as saving a Visio version 2000 drawing in Visio version 5.0 file format.

To get a reference to the UICode cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Fields.UICod[i]
where i = <1>, 2, 3...

To get a reference to the UICode cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionTextField
Row index: | visRowField + i where i = 0, 1, 2...
Cell index: | visFieldUICode


UIFormat Cell (Text Fields Section)

 Copy code hover
[image]

UIFormat Cell (Text Fields Section)
Send feedback

Published: July 16, 2012

Determines the format of an inserted field in versions of Visio earlier than Visio 2000.

Remarks

This cell does not appear in the ShapeSheet window. Use this cell if you need to deal with backward capability issues, such as saving a Visio version 2000 drawing in Visio version 5.0 file format.

To get a reference to the UIFormat cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Fields.UIFmt[i]
where i = <1>, 2, 3...

To get a reference to the UIFormat cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionTextField
Row index: | visRowField + i where i = 0, 1, 2...
Cell index: | visFieldUIFormat


UIVisibility Cell (Page Properties Section)

 Copy code hover
[image]

UIVisibility Cell (Page Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the page name is exposed in the user interface (UI).

Value | Description | Automation constant
0 | Display the page name in the UI (the default). | visUIVNormal
1 | Do not display the page name in the UI. | visUIVHidden

Remarks

Setting the UIVisibility cell to visUIVHidden prevents the page from appearing anywhere in the UI where the string containing the page name appears. For example, the page would not be listed as an option in the Drawing Explorer or on the page tabs. The page remains accessible, however, if you use Automation or UI paths that do not include the page name, for example, the Print command.

This cell is intended for use with document pages; it is not intended for use with markup overlay pages, which have the UIVisibility cell set to visUIVHidden by default and should not be changed.

Note Note

To hide a page from the document's Print command, make it a background page (Type property is visTypeBackground) that is not used as a background by any page (shapes on background pages are printed when a page using it as a background is printed). The document's Print command only works with indexed pages, and background pages are not indexed.

To get a reference to the UIVisibility cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

UIVisibility

To get a reference to the UIVisibility cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowPage
Cell index: | visPageUIVisibility


UpdateAlignBox Cell (Miscellaneous Section)

 Copy code hover
[image]

UpdateAlignBox Cell (Miscellaneous Section)
Send feedback

Published: July 16, 2012

Recalculates the selection rectangle whenever a control handle is moved.

Remarks

To get a reference to the UpdateAlignBox cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

UpdateAlignBox

To get a reference to the UpdateAlignBox cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visUpdateAlignBox


UseGroupGradient Cell (Gradient Properties Section)

 Copy code hover
[image]

UseGroupGradient Cell (Gradient Properties Section)
Send feedback

Published: July 16, 2012

Determines whether the shape takes on a gradient when the shape is grouped together with other shapes, as a Boolean. The value of UseGroupGradient cell affects the shape fill only.

Remarks

To get a reference to the UseGroupGradient cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

UseGroupGradient

To get a reference to the UseGroupGradient cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowGradientProperties
Cell index: | visUseGroupGradient


Value Cell (Shape Data Section)

 Copy code hover
[image]

Value Cell (Shape Data Section)
Send feedback

Published: July 16, 2012

Contains the shape data item's value as entered in the Define Shape Data dialog box.

Remarks

Formulas entered in this cell are overridden by values entered in the Define Shape Data dialog box. This is true even if you use the GUARD function to protect the formula.

To get a reference to the Value cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

Prop.Name.Value where Prop.Name is the row name

To get a reference to the Value cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionProp
Row index: | visRowProp + i where i = 0, 1, 2...
Cell index: | visCustPropsValue


Value Cell (Text Fields Section)

 Copy code hover
[image]

Value Cell (Text Fields Section)
Send feedback

Published: July 16, 2012

Contains the function for a field.

Remarks

You can set the value of this cell using the Field dialog box (on the Insert tab, in the Text group, click Field).

To get a reference to the Value cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Fields.Value[i] where i = <1>, 2, 3...

To get a reference to the Value cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionTextField
Row index: | visRowField + i where i = 0, 1, 2...
Cell index: | visFieldCell


Value Cell (User-Defined Cells Section)

 Copy code hover
[image]

Value Cell (User-Defined Cells Section)
Send feedback

Published: July 16, 2012

Specifies a value for the corresponding user-defined cell.

Remarks

To refer to this value in another cell, specify the user-defined name entered in the row label User.Row.

To get a reference to the Value cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

User.Name.Value
where User.Name is the row name

To get a reference to the Value cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionUser
Row index: | visRowUser + i where i = 0, 1, 2...
Cell index: | visUserValue


VariationColorIndex Cell (Theme Properties Section)

 Copy code hover
[image]

VariationColorIndex Cell (Theme Properties Section)
Send feedback

Published: July 16, 2012

Determines the color index of the active theme variation on the page, as an integer.

Remarks

To get a reference to the VariationColorIndex cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

VariationColorIndex

To get a reference to the VariationColorIndex cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowThemeProperties
Cell index: | visVariationColorIndex


VariationStyleIndex Cell (Theme Properties Section)

 Copy code hover
[image]

VariationStyleIndex Cell (Theme Properties Section)
Send feedback

Published: July 16, 2012

Determines the style index of the active theme variation on the page, as an integer.

Remarks

To get a reference to the VariationStyleIndex cell by name from another formula, by value of the N attribute of a Cell element, or from a program using the CellsU property, use:

Cell name:

VariationStyleIndex

To get a reference to the VariationStyleIndex cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowThemeProperties
Cell index: | visVariationStyleIndex


VerticalAlign Cell (Text Block Format Section)

 Copy code hover
[image]

VerticalAlign Cell (Text Block Format Section)
Send feedback

Published: July 16, 2012

Determines the vertical alignment of text within the text block.

Value | Description | Automation constant
0 | Top | visVertTop
1 | Middle | visVertMiddle
2 | Bottom | visVertBottom

Remarks

To get a reference to the VerticalAlign cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

VerticalAlign

To get a reference to the VerticalAlign cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowText
Cell index: | visTxtBlkVerticalAlign


ViewMarkup Cell (Document Properties Section)

 Copy code hover
[image]

ViewMarkup Cell (Document Properties Section)
Send feedback

Published: July 16, 2012

Determines whether markup appears in the drawing window.

Value | Description
TRUE | Markup is displayed on the drawing.
FALSE | Markup is not displayed (the default).

Remarks

When markup tracking is turned on (AddMarkup cell is TRUE), the ViewMarkup cell is automatically set to TRUE and remains TRUE even after markup tracking has been turned off (AddMarkup cell is FALSE). The value in the ViewMarkup cell is ignored when the AddMarkup cell is TRUE.

The ViewMarkup cell is also set to TRUE when comments are inserted in a drawing (whether or not markup tracking is turned on) and must be TRUE to see comments in the drawing.

This cell corresponds to the Show Markup command in the Markup group on the Review tab.

To get a reference to the ViewMarkup cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

ViewMarkup

To get a reference to the ViewMarkup cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowDoc
Cell index: | visDocViewMarkup


Visible Cell (Layers Section)

 Copy code hover
[image]

Visible Cell (Layers Section)
Send feedback

Published: July 16, 2012

Specifies whether shapes belonging to the layer are visible on the drawing page.

Value | Description
TRUE | Shapes are visible.
FALSE | Shapes are hidden.

Remarks

This cell corresponds to the Visible option in the Layer Properties dialog box (on the Home tab, in the Editing group, click Layers , and then click Layer Properties ).

To get a reference to the Visible cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Layers.Visible[i] where i = <1>, 2, 3...

To get a reference to the Visible cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionLayer
Row index: | visRowLayer + i where i = 0, 1, 2...
Cell index: | visLayerVisible


WalkPreference Cell (Glue Info Section)

 Copy code hover
[image]

WalkPreference Cell (Glue Info Section)
Send feedback

Published: July 16, 2012

Determines whether an endpoint of a 1-D shape moves to a horizontal or vertical connection point on the shape it is glued to, using dynamic glue, when the shape is moved to an ambiguous position. By default, both endpoints of the 1-D shape move to horizontal connection points.

Value | Description | Automation constant
1 | The begin point of the 1-D shape moves to a vertical connection point, and the endpoint moves to a horizontal connection point (top-to-side or bottom-to-side connections). | visWalkPrefBegNS
2 | The begin point of the 1-D shape moves to a horizontal connection point, and the endpoint moves to a vertical connection point (side-to-top or side-to-bottom connections). | visWalkPrefEndNS

Remarks

This cell has no effect on dynamic connectors. A dynamic connector's behavior is determined by its routing style. See the RouteStyle cell for the default routing style for dynamic connectors on a page, or the ShapeRouteStyle for the routing style of a particular dynamic connector.

To get a reference to the WalkPreference cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

WalkPreference

To get a reference to the WalkPreference cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowMisc
Cell index: | visWalkPref


Width Cell (Shape Transform Section)

 Copy code hover
[image]

Width Cell (Shape Transform Section)
Send feedback

Published: July 16, 2012

Contains the width of the selected shape in drawing units. The default formula for determining the width of a 1-D shape is:

= SQRT((EndX - BeginX) ^ 2 + (EndY - BeginY) ^ 2)

Remarks

To get a reference to the Width cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Width

To get a reference to the Width cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowXFormOut
Cell index: | visXFormWidth


X Behavior Cell (Controls Section)

 Copy code hover
[image]

X Behavior Cell (Controls Section)
Send feedback

Published: July 16, 2012

Controls the type of behavior the x-coordinate of the control handle will exhibit after the handle is moved.

Value | Behavior | Definition | Automation constant
0 | Proportional | The control handle can be moved, and it also moves in proportion with the shape when it is stretched. | visCtlProportional
1 | Proportional locked | The control handle moves in proportion with the shape but the control handle itself cannot be moved. | visCtlLocked
2 | Offset from left edge | The control handle is offset a constant distance from the left side of the shape. | visCtlOffsetMin
3 | Offset from center | The control handle is offset a constant distance from the center of the shape. | visCtlOffsetMid
4 | Offset from right edge | The control handle is offset a constant distance from the right side of the shape. | visCtlOffsetMax
5 | Proportional, hidden | Same as 0, but the control handle is not visible. | visCtlProportionalHidden
6 | Proportional locked, hidden | Same as 1, but the control handle is not visible. | visCtlLockedHiddenv
7 | Offset from left edge, hidden | Same as 2, but the control handle is not visible. | visCtlOffsetMinHidden
8 | Offset from center, hidden | Same as 3, but the control handle is not visible. | visCtlOffsetMidHidden
9 | Offset from right edge, hidden | Same as 4, but the control handle is not visible. | visCtlOffsetMaxHidden

Remarks

To get a reference to the X Behavior cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Controls.name.XConwhere Controls.name is the name of the controls row.

To get a reference to the X Behavior cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionControls
Row index: | visRowControl + i where i = 0, 1, 2...
Cell index: | visCtlXCon


X Cell (Action Tags Section)

 Copy code hover
[image]

X Cell (Action Tags Section)
Send feedback

Published: July 16, 2012

The x-coordinate position in the shape's local coordinates around which the action tag button is placed.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

The X and Y cells define a point in the shape's local coordinates, and the X Justify and Y Justify cells define where to place the action tag button in relation to that point.

To get a reference to the X cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

SmartTags.name.X
where SmartTags.name is the name of the action tag row

To get a reference to the X cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionSmartTag
Row index: | visRowSmartTag + i where i = 0, 1, 2...
Cell index: | visSmartTag


X Cell (Annotation Section)

 Copy code hover
[image]

X Cell (Annotation Section)
Send feedback

Published: July 16, 2012

The x-coordinate of the comment marker in page coordinates.

Note Note

This cell is used for tracking comments only when opening a .vsd file in Microsoft Visio 2013 or when saving a .vsdx file in the .vsd file format. It is not used for tracking comments in .vsdx documents in Visio 2013.

Remarks

To get a reference to the X cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Annotation.X[i]
where i = <1>, 2, 3...

To get a reference to the X cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAnnotation
Row index: | visRowAnnotation + i where i = 0, 1, 2...
Cell index: | visAnnotationX


X Cell (Connection Points Section)

 Copy code hover
[image]

X Cell (Connection Points Section)
Send feedback

Published: July 16, 2012

Represents the x-coordinate for a connection point in local coordinates.

Remarks

To get a reference to the X cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Connections.Xi
where i = <1>, 2, 3...

To get a reference to the X cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionConnectionPts
Row index: | visRowConnectionPts + i where i = 0, 1, 2...
Cell index: | visX


X Cell (Controls Section)

 Copy code hover
[image]

X Cell (Controls Section)
Send feedback

Published: July 16, 2012

Represents the x-coordinate that indicates the location of a shape's control handle in local coordinates.

Remarks

To get a reference to the X cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Controls.name.X where Controls.name is the name of the controls row.

To get a reference to the X cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionControls
Row index: | visRowControl + i where i = 0, 1, 2...
Cell index: | visCtlX


X Cell (Geometry Section)

 Copy code hover
[image]

X Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Represents an x-coordinate on a shape in local coordinates. This table describes the X cell based on the row in which it's located.

Row | Description
MoveTo | If the MoveTo row is the first row in the section, the X cell represents the x-coordinate of the first vertex of a path. If the MoveTo row appears between two rows, the X cell represents the x-coordinate of the first vertex after the break in the path.
LineTo | The x-coordinate of the ending vertex of a straight line segment.
ArcTo | The x-coordinate of the ending vertex of an arc.
EllipticalArcTo | The x-coordinate of the ending vertex of an elliptical arc.
PolylineTo | The x-coordinate of the ending vertex of a polyline.
NURBSTo | The x-coordinate of the last control point of a nonuniform rational B-spline (NURBS).
SplineStart | The x-coordinate of a spline's second control point.
SplineKnot | The x-coordinate of a control point.
InfiniteLine | An x-coordinate of a point on the infinite line.
Ellipse | The x-coordinate of the center of the ellipse.

Remarks

To get a reference to the X cell by name from another formula, or from a program using the CellsU property, use:

Cell name: | Geometryi.Xj where i and j = <1>, 2, 3...
 | Geometryi.X1 (InfiniteLine and Ellipse rows) where i = <1>, 2, 3...

To get a reference to the X cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowVertex + j where j = 0, 1, 2...
 | visRowVertex (InfiniteLine and Ellipse rows)
Cell index: | visX (MoveTo, LineTo, ArcTo, EllipticalArcTo, NURBSTo, Polyline, SplineStart, and SplineKnot rows)
 | visInfiniteLineX1 (InfiniteLine row)
 | visEllipseCenterX (Ellipse row)


X Dynamics Cell (Controls Section)

 Copy code hover
[image]

X Dynamics Cell (Controls Section)
Send feedback

Published: July 16, 2012

Represents the x-coordinate for a control handle's anchor point in local coordinates.

Remarks

The anchor point is used for rubber-banding during dynamics.

To get a reference to the X Dynamics cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Controls.name.XDynwhere Controls.name is the name of the controls row.

To get a reference to the X Dynamics cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionControls
Row index: | visRowControl + i where i = 0, 1, 2...
Cell index: | visCtlXDyn


X Justify Cell (Action Tags Section)

 Copy code hover
[image]

X Justify Cell (Action Tags Section)
Send feedback

Published: July 16, 2012

The x-offset of the action tag button relative to the point defined by the X and Y cells.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Value | Description | Automation constant
0 | Left justified (the default). | visSmartTagXJustifyLeft
1 | Centered. | visSmartTagXJustifyCenter
2 | Right justified. | visSmartTagXJustifyRight

Remarks

The X Justify and Y Justify cells determine where the action tag button is placed in relation to the point defined in the X and Y cells.

To get a reference to the X Justify cell by name from another formula, or from a program by using the CellsU property, use:

Cell name:

SmartTags.name.XJustify
where SmartTags.name is the name of the action tag row

To get a reference to the X Justify cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionSmartTag
Row index: | visRowSmartTag + i where i = 0, 1, 2...
Cell index: | visSmartTagXJustify


XGridDensity Cell (Ruler & Grid Section)

 Copy code hover
[image]

XGridDensity Cell (Ruler & Grid Section)
Send feedback

Specifies the type of horizontal grid to use.

Value | Description | Automation constant
0 | Fixed | visGridFixed
2 | Coarse | visGridCoarse
4 | Normal (default) | visGridNormal
8 | Fine | visGridFine

Remarks

This cell corresponds to the horizontal Grid spacing option in the Ruler & Grid dialog box (on the View tab, click the Show arrow).

To get a reference to the XGridDensity cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

XGridDensity

To get a reference to the XGridDensity cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowRulerGrid
Cell index: | visXGridDensity


XGridOrigin Cell (Ruler & Grid Section)

 Copy code hover
[image]

XGridOrigin Cell (Ruler & Grid Section)
Send feedback

Specifies the horizontal coordinate of the grid origin.

Remarks

This cell corresponds to the horizontal Grid origin option in the Ruler & Grid dialog box (on the View tab, click the Show arrow.

To get a reference to the XGridOrigin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

XGridOrigin

To get a reference to the XGridOrigin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowRulerGrid
Cell index: | visXGridOrigin


XGridSpacing Cell (Ruler & Grid Section)

 Copy code hover
[image]

XGridSpacing Cell (Ruler & Grid Section)
Send feedback

Specifies the distance between horizontal lines in a fixed grid (XGridDensity = 0).

Remarks

This cell corresponds to the horizontal Minimum spacing option in the Ruler & Grid dialog box (on the View tab, click the Show arrow).

To get a reference to the XGridSpacing cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

XGridSpacing

To get a reference to the XGridSpacing cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowRulerGrid
Cell index: | visXGridSpacing


XRulerDensity Cell (Ruler & Grid Section)

 Copy code hover
[image]

XRulerDensity Cell (Ruler & Grid Section)
Send feedback

Specifies the horizontal subdivisions on the ruler for the page.

Value | Description | Automation constant
0 | Fixed | visRulerFixed
8 (&H8) | Coarse | visRulerCoarse
16 (&H10) | Normal (Default) | visRulerNormal
32 (&H20) | Fine | visRulerFine

Remarks

This cell corresponds to the horizontal Subdivisions option in the Ruler & Grid dialog box (on the View tab, click the Show arrow).

To get a reference to the XRulerDensity cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

XRulerDensity

To get a reference to the XRulerDensity cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowRulerGrid
Cell index: | visXRulerDensity


XRulerOrigin Cell (Ruler & Grid Section)

 Copy code hover
[image]

XRulerOrigin Cell (Ruler & Grid Section)
Send feedback

Specifies the zero point on the x-axis ruler for the page.

Remarks

This cell corresponds to the horizontal Ruler zero option in the Ruler & Grid dialog box (on the View tab, click the Show arrow).

To get a reference to the XRulerOrigin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

XRulerOrigin

To get a reference to the XRulerOrigin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowRulerGrid
Cell index: | visXRulerOrigin


Y Behavior Cell (Controls Section)

 Copy code hover
[image]

Y Behavior Cell (Controls Section)
Send feedback

Published: July 16, 2012

Controls the type of behavior the y-coordinate of the control handle will exhibit after the handle is moved. These formulas are available.

Value | Behavior | Definition | Automation constant
0 | Proportional | The control handle can be moved, and it also moves in proportion with the shape when it is stretched. | visCtlProportional
1 | Proportional locked | The control handle moves in proportion with the shape, but the control handle itself cannot be moved. | visCtlLocked
2 | Offset from bottom edge | The control handle is offset a constant distance from the bottom of the shape. | visCtlOffsetMin
3 | Offset from center | The control handle is offset a constant distance from the center of the shape. | visCtlOffsetMid
4 | Offset from top edge | The control handle is offset a constant distance from the top of the shape. | visCtlOffsetMax
5 | Proportional, hidden | Same as 0, but the control handle is not visible. | visCtlProportionalHidden
6 | Proportional locked, hidden | Same as 1, but the control handle is not visible. | visCtlLockedHiddenv
7 | Offset from left edge, hidden | Same as 2, but the control handle is not visible. | visCtlOffsetMinHidden
8 | Offset from center, hidden | Same as 3, but the control handle is not visible. | visCtlOffsetMidHidden
9 | Offset from right edge, hidden | Same as 4, but the control handle is not visible. | visCtlOffsetMaxHidden

Remarks

To get a reference to the Y Behavior cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Controls.name.YConwhere Controls.name is the name of the controls row.

To get a reference to the Y Behavior cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionControls
Row index: | visRowControl + i where i = 0, 1, 2...
Cell index: | visCtlYCon


Y Cell (Action Tags Section)

 Copy code hover
[image]

Y Cell (Action Tags Section)
Send feedback

Published: July 16, 2012

The y-coordinate position in the shape's local coordinates around which the action tag button is placed.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

The X and Y cells define a point in the shape's local coordinates, and the X Justify and Y Justify cells define where to place the action tag button in relation to that point.

To get a reference to the Y cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

SmartTags.name.Y
where SmartTags.name is the name of the action tag row

To get a reference to the Y cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionSmartTag
Row index: | visRowSmartTag + i where i = 0, 1, 2...
Cell index: | visSmartTagY


Y Cell (Annotation Section)

 Copy code hover
[image]

Y Cell (Annotation Section)
Send feedback

Published: July 16, 2012

The y-coordinate of the comment marker in page coordinates.

Note Note

This cell is used for tracking comments only when opening a .vsd file in Microsoft Visio 2013 or when saving a .vsdx file in the .vsd file format. It is not used for tracking comments in .vsdx documents in Visio 2013.

Remarks

To get a reference to the Y cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Annotation.Y [i]
where i = <1>, 2, 3...

To get a reference to the Y cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionAnnotation
Row index: | visRowAnnotation + i where i = 0, 1, 2...
Cell index: | visAnnotationY


Y Cell (Connection Points Section)

 Copy code hover
[image]

Y Cell (Connection Points Section)
Send feedback

Published: July 16, 2012

Represents the y-coordinate for a connection point in local coordinates.

Remarks

To get a reference to the Y cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Connections.Yi
where i = <1>, 2, 3...

To get a reference to the Y cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionConnectionPts
Row index: | visRowConnectionPts + i where i = 0, 1, 2...
Cell index: | visY


Y Cell (Controls Section)

 Copy code hover
[image]

Y Cell (Controls Section)
Send feedback

Published: July 16, 2012

Represents the y-coordinate that indicates the location of a shape's control handle in local coordinates.

Remarks

To get a reference to the Y cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Controls.name.Ywhere Controls.name is the name of the controls row.

To get a reference to the Y cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionControls
Row index: | visRowControl + i where i = 0, 1, 2...
Cell index: | visCtlY


Y Cell (Geometry Section)

 Copy code hover
[image]

Y Cell (Geometry Section)
Send feedback

Published: July 16, 2012

Represents a y-coordinate on a shape in local coordinates. This table describes the Y cell based on the row in which it's located.

Row | Description
NURBSTo | If the MoveTo row is the first row in the section, the Y cell represents the y-coordinate of the first vertex of a path. If the MoveTo row appears between two rows, the Y cell represents the y-coordinate of the first vertex after the break in the path.
LineTo | The y-coordinate of the ending vertex of a straight line segment.
ArcTo | The y-coordinate of the ending vertex of an arc.
EllipticalArcTo | The y-coordinate of the ending vertex of an elliptical arc.
PolylineTo | The y-coordinate of the ending vertex of a polyline.
NURBSTo | The y-coordinate of the last control point of a nonuniform rational B-spline (NURBS).
SplineStart | The y-coordinate of a spline's second control point.
SplineKnot | The y-coordinate of a control point.
InfiniteLine | A y-coordinate of a point on the infinite line.
Ellipse | The y-coordinate of the center of the ellipse.

Remarks

To get a reference to the Y cell by name from another formula, or from a program using the CellsU property, use:

Cell name: | Geometryi.Yj where i and j = <1>, 2, 3...
 | Geometryi.Y1 (InfiniteLine and Ellipse rows) where i = <1>, 2, 3...

To get a reference to the Y cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionFirstComponent + i where i = 0, 1, 2...
Row index: | visRowVertex + j where j = 0, 1, 2...
 | visRowVertex (InfiniteLine and Ellipse rows)
Cell index: | visY (MoveTo, LineTo, ArcTo, EllipticalArcTo, NURBSTo, Polyline, SplineStart, and SplineKnot rows)
 | visInfiniteLineY1 (InfiniteLine row)
 | visEllipseCenterY (Ellipse row)


Y Dynamics Cell (Controls Section)

 Copy code hover
[image]

Y Dynamics Cell (Controls Section)
Send feedback

Published: July 16, 2012

Represents the y-coordinate for a control handle's anchor point in local coordinates. The anchor point is used for rubber-banding during dynamics.

Remarks

To get a reference to the Y Dynamics cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

Controls.name.YDynwhere Controls.name is the name of the controls row.

To get a reference to the Y Dynamics cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionControls
Row index: | visRowControl + i where i = 0, 1, 2...
Cell index: | visCtlYDyn


Y Justify Cell (Action Tags Section)

 Copy code hover
[image]

Y Justify Cell (Action Tags Section)
Send feedback

Published: July 16, 2012

The y-offset of the action tag button relative to the point defined by the X and Y cells.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Value | Description | Automation constant
0 | Top justified (the default). | visSmartTagYJustifyTop
1 | Centered. | visSmartTagYJustifyMiddle
2 | Bottom justified. | visSmartTagYJustifyBottom

Remarks

The X Justify and Y Justify cells determine where the action tag button is placed in relation to the point defined in the X and Y cells.

To get a reference to the Y Justify cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

SmartTags.name.YJustify
where SmartTags.name is the name of the action tag row

To get a reference to the Y Justify cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionSmartTag
Row index: | visRowSmartTag + i where i = 0, 1, 2...
Cell index: | visSmartTagYJustify


YGridDensity Cell (Ruler & Grid Section)

 Copy code hover
[image]

YGridDensity Cell (Ruler & Grid Section)
Send feedback

Specifies the type of vertical grid to use.

Value | Description | Automation constant
0 | Fixed | visGridFixed
2 | Coarse | visGridCoarse
4 | Normal (default) | visGridNormal
8 | Fine | visGridFine

Remarks

This cell corresponds to the vertical Grid spacing option in the Ruler & Grid dialog box (on the View tab, click the Show arrow).

To get a reference to the YGridDensity cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

YGridDensity

To get a reference to the YGridDensity cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowRulerGrid
Cell index: | visYGridDensity


YGridOrigin Cell (Ruler & Grid Section)

 Copy code hover
[image]

YGridOrigin Cell (Ruler & Grid Section)
Send feedback

Specifies the vertical origin of the grid.

Remarks

This cell corresponds to the vertical Grid origin option in the Ruler & Grid dialog box (on the View tab, click the Show arrow).

To get a reference to the YGridOrigin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

YGridOrigin

To get a reference to the YGridOrigin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowRulerGrid
Cell index: | visYGridOrigin


YGridSpacing Cell (Ruler & Grid Section)

 Copy code hover
[image]

YGridSpacing Cell (Ruler & Grid Section)
Send feedback

Specifies the distance between vertical lines in a fixed grid (YGridDensity = 0).

Remarks

Corresponds to the vertical Minimum spacing option in the Ruler & Grid dialog box (on the View tab, click the Show arrow).

To get a reference to the YGridSpacing cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

YGridSpacing

To get a reference to the YGridSpacing cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowRulerGrid
Cell index: | visYGridSpacing


YRulerDensity Cell (Ruler & Grid Section)

 Copy code hover
[image]

YRulerDensity Cell (Ruler & Grid Section)
Send feedback

Specifies the vertical subdivisions on the ruler for the page.

Value | Description | Automation constant
0 | Fixed | visRulerFixed
8 (&H8) | Coarse | visRulerCoarse
16 (&H10) | Normal (Default) | visRulerNormal
32 (&H20) | Fine | visRulerFine

Remarks

This cell corresponds to the vertical Subdivisions option in the Ruler & Grid dialog box (on the View tab, click the Show arrow).

To get a reference to the YRulerDensity cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

YRulerDensity

To get a reference to the YRulerDensity cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowRulerGrid
Cell index: | visYRulerDensity


YRulerOrigin Cell (Ruler & Grid Section)

 Copy code hover
[image]

YRulerOrigin Cell (Ruler & Grid Section)
Send feedback

Specifies the zero point on the y-axis ruler for the page.

Remarks

This cell corresponds to the vertical Ruler zero option in the Ruler & Grid dialog box (on the View tab, click the Show arrow).

To get a reference to the YRulerOrigin cell by name from another formula, or from a program using the CellsU property, use:

Cell name:

YRulerOrigin

To get a reference to the YRulerOrigin cell by index from a program, use the CellsSRC property with the following arguments:

Section index: | visSectionObject
Row index: | visRowRulerGrid
Cell index: | visYRulerOrigin


Functions (Visio 2013 ShapeSheet Reference)

 Copy code hover
[image]

Functions (Visio 2013 ShapeSheet Reference)
Send feedback

Published: July 16, 2012

In this section

  • ABS Function (VisioShapeSheet)

  • ACOS Function

  • AND Function

  • ANG360 Function

  • ANGLEALONGPATH Function

  • ANGLETOLOC Function

  • ANGLETOPAR Function

  • ARG Function

  • ASIN Function

  • ATAN2 Function

  • ATAN Function

  • BITAND Function

  • BITNOT Function

  • BITOR Function

  • BITXOR Function

  • BKGPAGENAME Function

  • BLEND Function

  • BLOB Function

  • BLUE Function

  • BOUNDINGBOXDIST Function

  • BOUNDINGBOXRECT Function

  • BOUND Function

  • CALLOUTCOUNT Function

  • CALLOUTTARGETREF Function

  • CALLTHIS Function

  • CATEGORY Function

  • CEILING Function

  • CHAR Function

  • COMPANY Function

  • CONTAINERCOUNT Function

  • CONTAINERMEMBERCOUNT Function

  • CONTAINERSHEETREF Function

  • COSH Function

  • COS Function (VisioShapeSheet)

  • CREATOR Function

  • CY Function

  • DATA1 Function

  • DATA2 Function

  • DATA3 Function

  • DATETIME Function

  • DATEVALUE Function (VisioShapeSheet)

  • DATE Function (VisioShapeSheet)

  • DAYOFYEAR Function

  • DAY Function (VisioShapeSheet)

  • DECIMALSEP Function

  • DEFAULTEVENT Function

  • DEG Function

  • DEPENDSON Function

  • DESCRIPTION Function

  • DIRECTORY Function

  • DISTTOPATH Function

  • DOCCREATION Function

  • DOCLASTEDIT Function

  • DOCLASTPRINT Function

  • DOCLASTSAVE Function

  • DOCMD Function

  • DOOLEVERB Function

  • EVALCELL Function

  • EVALTEXT Function

  • FIELDPICTURE Function

  • FILENAME Function

  • FIND Function

  • FLOOR Function

  • FONT Function

  • FONTTOID Function

  • FORMATEX Function

  • FORMAT Function

  • FORMULAEXISTS Function

  • GETREF Function

  • GETVAL Function

  • GOTOPAGE Function

  • GRAVITY Function

  • GREEN Function

  • GUARD Function

  • HASCATEGORY Function

  • HELP Function

  • HOUR Function (VisioShapeSheet)

  • HSL Function

  • HUEDIFF Function

  • HUE Function

  • HYPERLINKBASE Function

  • HYPERLINK Function

  • ID Function

  • IFERROR Function

  • IF Function

  • INDEX Function

  • INTERSECTX Function

  • INTERSECTY Function

  • INTUP Function

  • INT Function

  • IS1D Function

  • ISERRNA Function

  • ISERROR Function (VisioShapeSheet)

  • ISERRVALUE Function

  • ISERR Function

  • ISTHEMED Function

  • KEYWORDS Function

  • LANGUAGE Function

  • LEFT Function (VisioShapeSheet)

  • LEN Function (VisioShapeSheet)

  • LISTMEMBERCOUNT Function

  • LISTORDER Function

  • LISTSEP Function

  • LISTSHEETREF Function

  • LN Function

  • LOCALFORMULAEXISTS Function

  • LOCTOLOC Function

  • LOCTOPAR Function

  • LOC Function (VisioShapeSheet)

  • LOG10 Function

  • LOOKUP Function

  • LOWER Function

  • LUMDIFF Function

  • LUM Function

  • MAGNITUDE Function

  • MANAGER Function

  • MASTERNAME Function

  • MAX Function

  • MID Function (VisioShapeSheet)

  • MINUTE Function (VisioShapeSheet)

  • MIN Function

  • MODULUS Function

  • MONTH Function (VisioShapeSheet)

  • MSOSHADE Function

  • MSOTINT Function

  • NAME Function

  • NA Function

  • NEARESTPOINTONPATH Function

  • NOT Function

  • NOW Function (VisioShapeSheet)

  • NURBS Function

  • OPENFILE Function

  • OPENGROUPWIN Function

  • OPENSHEETWIN Function

  • OPENTEXTWIN Function

  • OR Function

  • PAGECOUNT Function

  • PAGENAME Function

  • PAGENUMBER Function

  • PAR Function

  • PATHLENGTH Function

  • PATHSEGMENT Function

  • PI Function

  • PLAYSOUND Function

  • PNTX Function

  • PNTY Function

  • PNT Function

  • POINTALONGPATH Function

  • POLYLINE Function

  • POW Function

  • QUEUEMARKEREVENT Function

  • RAD Function

  • RAND Function

  • RECTSECT Function

  • RED Function

  • REF Function

  • REPLACE Function (VisioShapeSheet)

  • REPT Function

  • REWIDEN Function

  • RGB Function (VisioShapeSheet)

  • RIGHT Function (VisioShapeSheet)

  • ROUND Function (VisioShapeSheet)

  • RUNADDONWARGS Function

  • RUNADDON Function

  • RUNMACRO Function

  • SATDIFF Function

  • SAT Function

  • SECOND Function (VisioShapeSheet)

  • SEGMENTCOUNT Function

  • SETATREFEVAL Function

  • SETATREFEXPR Function

  • SETATREF Function

  • SETF Function

  • SHADE Function

  • SHAPETEXT Function

  • SHEETREF Function

  • SIGN Function

  • SINH Function

  • SIN Function (VisioShapeSheet)

  • SQRT Function

  • STRSAMEEX Function

  • STRSAME Function

  • SUBJECT Function

  • SUBSTITUTE Function

  • SUM Function

  • TANH Function

  • TAN Function (VisioShapeSheet)

  • TEXTHEIGHT Function

  • TEXTWIDTH Function

  • THEME Function

  • THEMECBV Function

  • THEMEGUARD Function

  • THEMERESTORE Function

  • THEMEVAL Function

  • TIMEVALUE Function (VisioShapeSheet)

  • TIME Function (VisioShapeSheet)

  • TINT Function

  • TITLE Function

  • TONE Function

  • TRIM Function

  • TRUNC Function

  • TYPEDESC Function

  • TYPE Function

  • UNICHAR Function

  • UPPER Function

  • USERUI Function

  • USE Function

  • VERSION Function

  • WEEKDAY Function (VisioShapeSheet)

  • YEAR Function (VisioShapeSheet)


ABS Function (VisioShapeSheet)

 Copy code hover
[image]

ABS Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the absolute value of a number.

Syntax

ABS(number)

Parameters

Name | Required/Optional | Data Type | Description
Number | Required | Decimal | The number whose absolute value you want to find.

Example

ABS(-1.24)

Returns 1.24.


ACOS Function

 Copy code hover
[image]

ACOS Function
Send feedback

Published: July 16, 2012

Returns the arccosine of number, for example, the angle whose cosine is number.

Syntax

ACOS(number)

Remarks

The input value must be in the range -1 <= number <= 1, or a #NUM! error is returned. The resulting angle is in the range 0 <= angle <= PI radians (0 <= angle <= 180 degrees).

Example

ACOS(0)

Returns 90 deg


AND Function

 Copy code hover
[image]

AND Function
Send feedback

Published: July 16, 2012

Returns TRUE (1) if all of the logical expressions supplied are TRUE. If any of the logical expressions are FALSE or 0, the AND function returns FALSE (0).

Syntax

AND(logical expression1,logical expression2,...,logical expressionN)

Parameters

Name | Required/Optional | Data Type | Description
logical expression | Required | String | A combination of constants, operators, functions, and references to ShapeSheet cells that results in a value. Any expression that evaluates to a non-zero value is considered to be TRUE.

Example

AND(Height > 1, PinX > 1)

Returns TRUE if both expressions are TRUE. Returns FALSE if either expression is FALSE.


ANG360 Function

 Copy code hover
[image]

ANG360 Function
Send feedback

Published: July 16, 2012

Normalizes an angle's range to be 0 <= result < 2PI radians (0 <= result < 360 degrees).

Syntax

ANG360(angle)

Parameters

Name | Required/Optional | Data Type | Description
angle | Required | Numeric | The angle to be normalized.

Remarks

If angle is not specified by using angular units, it is interpreted as radians. If angle cannot be converted to a value, a #VALUE! error is returned.

Example 1

ANG360(395 deg)

Returns 35 deg

Example 2

ANG360(-9.8 rad)

Returns 2.7664 rad

Example 3

ANG360(45)

Returns 58.31 deg (1.0177 rad)


ANGLEALONGPATH Function

 Copy code hover
[image]

ANGLEALONGPATH Function
Send feedback

Published: July 16, 2012

Returns the angle of the tangent to the path at a given point.

Version Information

Version Added: Visio 2010

Syntax

ANGLEALONGPATH(section,travel [,segment])

Parameters

Name | Required/Optional | Data Type | Description
section | Required | String | The Geometry section that represents the path, specified by a reference to its Path cell (for example, Geometry1.Path).
travel | Required | Double | The percentage along the path from begin point to end point. Must be between 0 and 1.
segment | Optional | Integer | The 1-based segment of the path at which to calculate the tangent angle.

Return Value

Double

Remarks

If you include a segment value, ANGLEALONGPATH returns the value for that segment only.

If you include a segment value, ANGLEALONGPATH determines the point of the tangent by using travel to calculate the percertage along segment.

If either section or segment does not exist, Microsoft Visio returns #REF!.


ANGLETOLOC Function

 Copy code hover
[image]

ANGLETOLOC Function
Send feedback

Published: July 16, 2012

Returns a transformed angle in the destination shape's local coordinate system. Converts an angle from local coordinates in a source shape to the local coordinates in a destination shape.

Syntax

ANGLETOLOC(srcAngle, srcRef, dstRef)

Parameters

Name | Required/Optional | Data Type | Description
srcAngle | Required | Numeric | An angle in the source coordinate system.
srcRef | Required | String | A reference to a cell in the source object, such as a shape, group, page, and so on.
dstRef | Required | String | A reference to a cell in the destination object, such as a shape, group, page, and so on.

Remarks

You can use the ANGLETOLOC function to set local angle cells in a shape in terms of an angle from another coordinate space.

This function works even when the source and destination shapes are within groups. It also adjusts for rotation and flips in the intermediate transformation.

The source and destination coordinates must be on the same page.


ANGLETOPAR Function

 Copy code hover
[image]

ANGLETOPAR Function
Send feedback

Published: July 16, 2012

Returns a transformed angle in the destination shape's parent coordinate system. Converts an angle from local coordinates in a source shape to the parent coordinates in a destination shape.

Syntax

ANGLETOPAR(srcAngle, srcRef, dstRef)

Parameters

Name | Required/Optional | Data Type | Description
srcAngle | Required | Numeric | An angle in the source coordinate system.
srcRef | Required | String | A reference to a cell in the source object, such as a shape, group, page, and so on.
dstRef | Required | String | A reference to a cell in the destination object, such as a shape, group, page, and so on.

Remarks

This function works even when the source and destination shapes are within groups. It also adjusts for rotation and flips in the intermediate transformation.

The source and destination coordinates must be on the same page.

If the destination is a page, which has no parent, the result is expressed in page's local coordinates.


ARG Function

 Copy code hover
[image]

ARG Function
Send feedback

Published: July 16, 2012

Specifies an argument that the calling cell can pass to a custom function, as well as the default value returned by the custom function if the calling cell does not pass in a value for the argument. Returns the value specified by the calling cell and the matching argName parameter.

Syntax

ARG(argName,[defaultValue])

Parameters

Name | Required/Optional | Data Type | Description
argName | Required | String | The name of an argument that the calling cell can pass into the function.
default Value | Optional | Numeric | The value returned by ARG if the calling cell did not pass in a value for the argName parameter.

Remarks

As a shape developer, you can create custom functions by placing an expression in one cell and calling that expression from one or more other cells. The expression can include literal strings, ShapeSheet functions, and cell references. The expression can also include specific arguments that are passed in by the calling cell.

The calling cell specifies the cell that contains the custom function as well as any arguments that it wants to pass to the function. The expression cell is evaluated and the result returned to the calling cell.

Example

The following example shows how to use the ARG function in conjunction with the EVALCELL function to find the middle value from a set of three values.

In the expression cell, place the following code that defines the custom function:

Copy code Copy code
User.MiddleValue = IF(ARG("A")>ARG("B"),IF(ARG("B")>ARG("C"),ARG("B"),IF(ARG("A")>ARG("C"),ARG("C"),ARG("A"))),IF(ARG("A")>ARG("C"),ARG("A"),IF(ARG("B")>ARG("C"),ARG("C"),ARG("B"))))

In the calling cells, place the following code that calls the custom function:

Copy code Copy code
User.Middle1 = EVALCELL(User.MiddleValue,"A",3,"B",9,"C",5)
User.Middle2 = EVALCELL(User.MiddleValue,"A",12,"B",0,"C",21)


ASIN Function

 Copy code hover
[image]

ASIN Function
Send feedback

Published: July 16, 2012

Returns the arcsine of a number, for example, the angle whose sine is number.

Syntax

ASIN(number)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Numeric | The sine of the angle.

Remarks

The input value must be in the range -1 <= number <= 1, or a #NUM! error is returned. The resulting angle is in the range -PI/2 <= angle <= PI/2 radians (-90 <= angle <= 90 degrees).

Example

ASIN(1)

Returns 90 deg


ATAN2 Function

 Copy code hover
[image]

ATAN2 Function
Send feedback

Published: July 16, 2012

Returns the angle between the vector represented by x,y and the direction of the x-axis. The result is a number in the current unit of measure for angles.

Syntax

ATAN2(y,x)

Parameters

Name | Required/Optional | Data Type | Description
y | Required | Numeric | The y-value of the point.
x | Required | Numeric | The x-value of the point.

Remarks

The arctangent is the angle measured counterclockwise from the positive x -axis to a line that intersects the origin (0,0) and the point represented by x and y. In Microsoft Visio, ATAN2(0,0) returns 0. To force the result of ATAN2 into a different angular measurement, use the DEG or RAD function.

The ATAN2 function is the antifunction of the TAN function. The ATAN2 function returns the angle whose angle is equal to y divided by x. If ATAN2(y,x) represents an angle in a right triangle, y is the "opposite side" and x is the "adjacent side," so the function could be written as ATAN2(opposite,adjacent).

Example 1

ATAN2(1.25,2.25)

Returns 29.0456 deg

Example 2

ATAN2(1,SQRT(3))

Returns 30 deg

Example 3

ATAN2(1,1)

Returns 45 deg


ATAN Function

 Copy code hover
[image]

ATAN Function
Send feedback

Published: July 16, 2012

Returns the arctangent of a number, for example, the angle whose tangent is number. The resulting angle is in the range -PI/2 <= angle <= PI/2 radians (-90 <= angle <= 90 degrees).

Syntax

ATAN(number)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Numeric | The tangent of the angle.

Example

ATAN(1)

Returns 45 deg


BITAND Function

 Copy code hover
[image]

BITAND Function
Send feedback

Published: July 16, 2012

Returns a 16-bit binary number in which each bit is set to 1 only if the corresponding bit in both binarynumber1 and binarynumber2 is 1. Otherwise, the bit is set to 0.

Syntax

BITAND(binarynumber1,binarynumber2)

Parameters

Name | Required/Optional | Data Type | Description
binary number1 | Required | Numeric | The first 16-bit binary number.
binary number2 | Required | Numeric | The second 16-bit binary number.

Remarks

You can use this function to test and change properties of a shape that are stored as bitmasks, for example, the shape's text format.

Example

BITAND(12,6)

Returns 4. The 12 = 0...01100. The 6 = 0...00110. Therefore, BITAND(12,6) = 0...00100.


BITNOT Function

 Copy code hover
[image]

BITNOT Function
Send feedback

Published: July 16, 2012

Returns a 16-bit binary number in which each bit is set to 1 only if the corresponding bit in binary number is 0. Otherwise, the bit is set to 0.

Syntax

BITNOT(binary number)

Parameters

Name | Required/Optional | Data Type | Description
binary number | Required | Numeric | A 16-bit binary number.

Return Value

16-bit Binary

Example

BITNOT(6)

Returns 65529. The 6 = 0...00110. Therefore, BITNOT(6) = 1...11001.


BITOR Function

 Copy code hover
[image]

BITOR Function
Send feedback

Published: July 16, 2012

Returns a 16-bit binary number in which each bit is set to 1 if the corresponding bit in either binary number1 or binary number2 is 1. The bit is set to 0 only if the corresponding bit is 0 in both binary number1 and binary number2.

Syntax

BITOR(binary number1,binary number2)

Parameters

Name | Required/Optional | Data Type | Description
binary number1 | Required | Numeric | The first 16-bit binary number.
binary number2 | Required | Numeric | The second 16-bit binary number.

Return Value

16-bit Binary

Example

BITOR(12,6)

Returns 14. The 12 = 0...01100. The 6 = 0...00110. Therefore, BITOR(12,6) = 0...01110.


BITXOR Function

 Copy code hover
[image]

BITXOR Function
Send feedback

Published: July 16, 2012

Returns a 16-bit binary number in which each bit is set to 1 if the corresponding bit in either but not both binary number1 and binary number2 is 1. Otherwise, the bit is set to 0.

Syntax

BITXOR(binary number1,binary number2)

Parameters

Name | Required/Optional | Data Type | Description
binary number1 | Required | Numeric | The first 16-bit binary number.
binary number2 | Required | Numeric | The second 16-bit binary number.

Return Value

16-bit Binary

Example

BITXOR(12,6)

Returns 10. The 12 = 0...01100. The 6 = 0...00110. Therefore, BITXOR(12,6) = 0...01010.


BKGPAGENAME Function

 Copy code hover
[image]

BKGPAGENAME Function
Send feedback

Published: July 16, 2012

Returns a background page name as a string.

Syntax

BKGPAGENAME (langID_opt)

Parameters

Name | Required/Optional | Data Type | Description
langID_opt | Optional | Numeric | Use to specify a language for the string the function returns. Use 0 (default value) to specify the local language. Use 750 to specify universal language.

Return Value

String

Remarks

If the page for which you are using the function doesn't have a background page, the string "<no background>" is returned.

If you pass an illegal language code, the local language is used.


BLEND Function

 Copy code hover
[image]

BLEND Function
Send feedback

Published: July 16, 2012

Blends two colors in the proportion specified by the float parameter.

Syntax

BLEND(color1,color2,float[0,1])

Parameters

Name | Required/Optional | Data Type | Description
color1 | Required | Numeric | The Visio color index or RGB value of the first color.
color2 | Required | Numeric | The Visio color index or RGB value of the second color.
float[0,1] | Required | Float | The proportion in which to blend color2 and color1, respectively. A real number from 0 to 1 inclusive.

Return Value

RGB

Remarks

The color returned is determined by the relative proportions in which to blend color2 and color1, respectively, as specified by the float parameter. For example, if float is 0.25, the color returned is composed 75% of color1 and 25% of color2.

Another way to think about it is that the float value corresponds to the point along the color spectrum from color1 to color2. Therefore, smaller numbers (closer to zero) for float produce blends closer to color1, while larger numbers (closer to 1) produce blends closer to color2.


BLOB Function

 Copy code hover
[image]

BLOB Function
Send feedback

Published: July 16, 2012

Decodes a base64 string and stores it as binary data.

Syntax

BLOB (bintext)

Parameters

Name | Required/Optional | Data Type | Description
bintext | Required | String | A base64 encoded string.


BLUE Function

 Copy code hover
[image]

BLUE Function
Send feedback

Published: July 16, 2012

Returns the blue component of a color. The return value is an integer in the range of 0 to 255, inclusive. The function returns 0 for invalid input.

Syntax

BLUE(expression)

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | String | An index of a color in the document's color table, an expression that resolves to a custom color (like RGB or HSL), or a reference to a cell that contains a color index or color result.

Return Value

Integer

Example 1

BLUE(Sheet.4!FillForegnd)

Returns the blue component of Sheet.4's fill foreground color.

Example 2

BLUE(13)

Returns 128 if the document uses the default Visio color palette, where cyan is the color at index 13.

Example 3

BLUE(RGB(10, 20, 30))

Returns 30.


BOUNDINGBOXDIST Function

 Copy code hover
[image]

BOUNDINGBOXDIST Function
Send feedback

Published: July 16, 2012

Returns the measurement of the specified part of the shape's bounding box.

Version Information

Version Added: Visio 2010

Syntax

BOUNDINGBOXDIST(Index)

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Number | The part of the shape's bounding box to measure and return. See Remarks for possible values.

Return Value

Number

Remarks

Index can be one of the following values.

Item | Value
Width | 0
Height | 1
Left edge to shape pin | 2
Shape pin to right edge | 3
Shape pin to top edge | 4
Bottom edge to shape pin | 5
Center of bounding box to PinX | 6
Center of bounding box to PinY | 7


BOUNDINGBOXRECT Function

 Copy code hover
[image]

BOUNDINGBOXRECT Function
Send feedback

Published: July 16, 2012

Returns the coordinate of the specified edge of the shape's bounding box.

Version Information

Version Added: Visio 2010

Syntax

BOUNDINGBOXRECT(Index)

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Integer | The edge of the shape's bounding box for which to get the coordinate. See Remarks for possible values.

Return Value

Number

Remarks

Index can be one of the following values.

Item | Value
Left edge | 0
Right edge | 1
Top edge | 2
Bottom edge | 3

If the shape has a parent, the return value is in the coordinate system of that parent.


BOUND Function

 Copy code hover
[image]

BOUND Function
Send feedback

Published: July 16, 2012

Constrains the value of a cell to a range or set of ranges.

Syntax

BOUND (value, type, ignore, value1, value2 [,ignore(n), value1(n), value2(n),...])

Parameters

Name | Required/Optional | Data Type | Description
value | Required | Numeric | The current value being constrained.
type | Required | Numeric | Whether the constraint is inclusive (0), exclusive (1), or disabled (2).
ignore | Required | Boolean | TRUE to ignore the range; FALSE to constrain the value of the cell to the range.
value1 | Required | Numeric | First value in a range.
value2 | Required | Numeric | Second value in a range.

Remarks

Use the BOUND function to restrict a cell's value to an upper and lower bound, for example, to control objects that should not be stretched above or below a minimum or maximum height. The constraint can be inclusive or exclusive with respect to the range or ranges. If the current value should not be constrained, set the type parameter to 2 (disabled).

You can define multiple ranges by supplying multiple occurrences of the ignore, value1, and value2 parameters. Use the ignore parameter to disable constraints by a particular range.

The formula containing the BOUND function does not get overwritten when its value changes; instead, the formula is preserved and the new value is placed into the value parameter.

Example 1

This example uses the BOUND function to force a control handle to stay within the bounding box of a shape.

Controls.X1 = BOUND(Width*0.5, 0, FALSE, Width*0, Width*1)

Controls.Y1 = BOUND(Height*0.5, 0, FALSE, Height*0, Height*1)

Example 2

This example uses the BOUND function to constrain a shape's width to 2 inches, 4 inches, or 6 inches.

Width = BOUND(, 0, FALSE, 2 in, 2 in, FALSE, 4 in, 4 in, FALSE, 6 in, 6 in)


CALLOUTCOUNT Function

 Copy code hover
[image]

CALLOUTCOUNT Function
Send feedback

Published: July 16, 2012

Returns the total number of callout shapes that are associated with the shape.

Version Information

Version Added: Visio 2010

Syntax

CALLOUTCOUNT()

Return Value

Integer


CALLOUTTARGETREF Function

 Copy code hover
[image]

CALLOUTTARGETREF Function
Send feedback

Published: July 16, 2012

Returns a sheet reference to the target shape of the callout shape.

Version Information

Version Added: Visio 2010

Syntax

CALLOUTTARGETREF()!

Return Value

ShapeSheet reference

Remarks

If the shape is not a callout shape, or if it is not associated with a target shape, CALLOUTTARGETREF returns #REF.

Example

CALLOUTTARGETREF()!Height

Returns the value in the Height cell of the shape that is associated with the callout.


CALLTHIS Function

 Copy code hover
[image]

CALLTHIS Function
Send feedback

Published: July 16, 2012

Calls a procedure in a Microsoft Visual Basic for Applications (VBA) project.

Syntax

CALLTHIS("procedure",["project"],[arg1,arg2,...])

Parameters

Name | Required/Optional | Data Type | Description
procedure | Required | String | The name of the procedure to call.
project | Optional | String | The project that contains the procedure.
arg | Optional | Number, String, Date, or Currency | Passed as parameters to the procedure.

Remarks

In the VBA project, procedure is defined as follows:

procedure( vsoShape As Visio.Shape [arg1 As type, arg2 As type...])

where vsoShape is a reference to the Shape object that contains the CALLTHIS formula being evaluated, and arg1, arg2... are the arguments specified in that formula.

Notice that vsoShape is very much like the "this" argument passed to a C++ member procedure; hence the name "CALLTHIS." In effect, a cell that contains a formula that includes CALLTHIS can be read as, "Call this procedure and pass it a reference to my shape."

If project is specified, Microsoft Visio scans all open documents for the one containing project and calls procedure in that project. If project is omitted or null (""), Visio assumes procedure is in the VBA project of the document that contains the CALLTHIS formula that is being evaluated.

Numbers in arg1, arg2... are passed in external units. For example, if you pass the value of the Height cell from a shape that is 3 cm tall, 3 is passed. To pass different units with a number, use the FORMATEX function or explicitly coerce units by adding a null number-unit pair, for example, 0 ft + Height.

The second comma in the CALLTHIS function is optional. It corresponds to the number of additional parameters added to your procedure. If you do not use any additional parameters, except (vsoShape as Visio.Shape) , do not add the second comma; use CALLTHIS("",). If you add two additional parameters, for example, use CALLTHIS("",,,).

The CALLTHIS function always evaluates to 0, and the call to procedure occurs during idle time after the recalculation process finishes. Procedure can return a value, but Visio ignores it. Procedure returns a value that Visio can recognize by setting the formula or result of another cell in the document, but not the cell that called procedure, unless you want to overwrite the CALLTHIS formula.

The CALLTHIS function differs from the RUNADDON function in that a document's project does not need to reference another project in order to call into that project.

Note Note

VBA code that is invoked when the Visio instance evaluates a CALLTHIS function in a formula should not close the document containing the cell using the function because an application error results and Visio terminates.

If you need to close the document containing the cell that uses the CALLTHIS function, use one of the following techniques:

  • Close the document from code that is not VBA.

  • Close the document from a project other than the one that is closing.

  • Post window messages to close windows in the document rather than closing the document.

For more information about running code in Visio, see About Security Settings and Running Code in Visio in this ShapeSheet Reference.

Example 1

CALLTHIS("p",,FORMATEX(Height,"#.00 u",,"cm"))

Calls the procedure named p located in a module and passes the value of Height in centimeters, such as 7.62 cm.

Example 2

CALLTHIS("q",,0 cm+Height,Width)

Calls the procedure named q located in a module and passes the cell's height in centimeters and width in internal units.

Example 3

Use the following procedure in the ThisDocument class module.

Use any of the following syntax in a shape's EventDblClick cell with the preceding procedures.

CALLTHIS("ThisDocument.A",)

CALLTHIS("ThisDocument.B",,"Click")

CALLTHIS("ThisDocument.C",,"Click", " OK.")


CATEGORY Function

 Copy code hover
[image]

CATEGORY Function
Send feedback

Published: July 16, 2012

Returns the text from the Category field of a document's properties.

Syntax

CATEGORY ( )


CEILING Function

 Copy code hover
[image]

CEILING Function
Send feedback

Published: July 16, 2012

Rounds a number away from 0 (zero) to the next instance of multiple. If multiple is not specified, the number rounds away from 0 to the next integer.

Syntax

CEILING(number, multiple)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Number | The number to round.
multiple | Required | Number | The multiple to round to.

Remarks

Number and multiple must have the same signs, or a #NUM! error is returned. If either number or multiple cannot be converted to a value, a #VALUE! error is returned. If either number or multiple is 0, the result is 0.

Example 1

CEILING(3.7)

Returns 4

Example 2

CEILING(-3.7)

Returns -4

Example 3

CEILING(3.7, 0.25)

Returns 3.75


CHAR Function

 Copy code hover
[image]

CHAR Function
Send feedback

Published: July 16, 2012

Returns the ANSI character for a number.

Syntax

CHAR(number)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Number | The number whose ANSI character you want to get.

Remarks

The resulting string is one character in length. The number parameter must be an integer between 1 and 255 (inclusive), or the function returns an error.

Example

CHAR(9)

Returns the tab character.


COMPANY Function

 Copy code hover
[image]

COMPANY Function
Send feedback

Published: July 16, 2012

Returns the text from the Company field of a document's properties.

Syntax

COMPANY ()


CONTAINERCOUNT Function

 Copy code hover
[image]

CONTAINERCOUNT Function
Send feedback

Published: July 16, 2012

Returns the total number of containers that include the shape as a member (including nested relationships).

Version Information

Version Added: Visio 2010

Syntax

CONTAINERCOUNT()

Return Value

Integer


CONTAINERMEMBERCOUNT Function

 Copy code hover
[image]

CONTAINERMEMBERCOUNT Function
Send feedback

Returns the total number of shapes in the container.

Version Information

Version Added: Visio 2010

Syntax

CONTAINERMEMBERCOUNT()

Return Value

Integer

Remarks

If the shape is not a container, CONTAINERMEMBERCOUNT returns -1.


CONTAINERSHEETREF Function

 Copy code hover
[image]

CONTAINERSHEETREF Function
Send feedback

Published: July 16, 2012

Returns a sheet reference to the specified container that contains the shape.

Version Information

Version Added: Visio 2010

Syntax

CONTAINERSHEETREF(index[, category])

Parameters

Name | Required/Optional | Data Type | Description
index | Required | Integer | The 1-based index of the container. See Remarks for more information.
category | Optional | String | The category of the container. See Remarks for more information.

Return Value

ShapeSheet reference

Remarks

The index of a container is calculated based on the z-order of containers from front to back.

Categories are user-defined strings that you can use to categorize shapes. You can define categories in the User.msvShapeCategories cell in the ShapeSheet for a shape. You can define multiple categories for a shape by separating the categories with semi-colons.

If the shape is not a member of a container, or if there is no container that matches both the specified index number and the category, CONTAINERSHEETREF returns #REF!.

Example

CONTAINERSHEETREF(1)!Height

Returns the value in the Height cell of the container that is most forward on the page to which the shape belongs.


COSH Function

 Copy code hover
[image]

COSH Function
Send feedback

Published: July 16, 2012

Returns the hyperbolic cosine of an angle.

Syntax

COSH(angle)

Parameters

Name | Required/Optional | Data Type | Description
angle | Required | Numeric | The angle of which to get the hyperbolic cosine.

Remarks

The COSH function uses radians unless you specify a different unit of measure in angle.

Example

COSH(45 deg)

Returns 1.3246.


COS Function (VisioShapeSheet)

 Copy code hover
[image]

COS Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the cosine of an angle.

Syntax

COS(angle)

Parameters

Name | Required/Optional | Data Type | Description
angle | Required | Numeric | The angle of which to get the cosine.

Remarks

The COS function uses radians unless you specify a different unit of measure in angle.

Example

COS(45 deg)

Returns 0.7071.


CREATOR Function

 Copy code hover
[image]

CREATOR Function
Send feedback

Published: July 16, 2012

Returns the text from the Author field of a document's properties.

CREATOR ()


CY Function

 Copy code hover
[image]

CY Function
Send feedback

Returns a currency value.

Syntax

CY(value, cyID)

Parameters

Name | Required/Optional | Data Type | Description
value | Optional | Number or String | A number or a string that includes currency-specific formatting. If not specified, the currency value is formatted according to the currency style in the system's Region and Language settings.
cyID | Optional | Number | A numeric currency ID or a three-character quoted string for the ISO 4217 abbreviation.

Remarks

To specify a different currency, you must include a valid cyID. For a list, see About currency constants.

If value is incompatible with the designated currency type, or if an invalid argument such as "not a number" is specified, a #VALUE! error is returned. If value is greater than 922,337,203,685,477.5807 or less than -922,337,203,685,477.5808, a #VALUE! error is returned.

For better precision with very large currency values that include fractions of a unit, such as 3.6 trillion, use string arguments for value.

Specifying an invalid cyID returns an error.

Example 1

If the user's Region and Language settings specify United States dollars:

CY(999998.993)

Returns $999,998.99

Example 2

CY(12345678.993, "USD")

Returns $12,345,678.99

Example 3

CY(12345678.993, "DEM")

Returns 12,345,678.99 DEM

Example 4

CY(12345678.7832, "XXX")

Returns 12,345,678.78


DATA1 Function

 Copy code hover
[image]

DATA1 Function
Send feedback

Published: July 16, 2012

Returns the text from the Data 1 box in the Shape Name dialog box for a shape (on the Developer tab, click Shape Name), as a string.

Syntax

DATA1 ()

Remarks

If the box is empty, the function returns an empty string.


DATA2 Function

 Copy code hover
[image]

DATA2 Function
Send feedback

Published: July 16, 2012

Returns the text from the Data 2 box in the Shape Name dialog box for a shape (on the Developer tab, click Shape Name), as a string.

Syntax

DATA2 ()

Remarks

If the box is empty, the function returns an empty string.


DATA3 Function

 Copy code hover
[image]

DATA3 Function
Send feedback

Published: July 16, 2012

Returns the text from the Data 3 box in the Shape Name dialog box for a shape (on the Developer tab, click Shape Name), as a string.

Syntax

DATA3 ()

Remarks

If the box is empty, the function returns an empty string.


DATETIME Function

 Copy code hover
[image]

DATETIME Function
Send feedback

Published: July 16, 2012

Returns the date and time value represented by datetime or expression.

Syntax

DATETIME("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | Any string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | String | Any expression that yields a date and time.
lcid | Optional | Number | Specifies the locale identifier to be used in evaluating a non-local datetime. The locale identifier is a number described in the system header files.

Return Value

Datetime

Remarks

If datetime is missing or cannot be interpreted as a valid date or time, DATETIME returns a #VALUE! error.

The returned value is formatted according to the short date style and time style in the system's current Regional Settings.

The DATETIME function also accepts a single number value for expression where the integer portion of the result represents the number of days since December 30, 1899, and the decimal portion represents the fraction of a day since midnight.

Example 1

DATETIME("May 30, 1997")+5 ed.

Returns the value representing 6/4/1997.

Example 2

FORMAT(DATETIME("5/20/1997 14:30:45"),"C")

Returns the string "Tuesday, May 20, 1997 2:30:45 PM."

Example 3

DATETIME("1:30 PM July 19")

Returns the value representing 7/19/2001 1:30:00 PM (assuming the current year is 2001).

Example 4

DATETIME(35580.6337)

Returns the value representing 5/30/1997 3:12:32 PM.


DATEVALUE Function (VisioShapeSheet)

 Copy code hover
[image]

DATEVALUE Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the date value represented by datetime or expression.

Syntax

DATEVALUE("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | Any string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | String | Any expression that yields a date and time.
lcid | Optional | Number | Specifies the locale identifier to be used in evaluating a non-local datetime. The locale identifier is a number described in the system header files.

Return Value

Datetime

Remarks

Any time component in datetime or expression is discarded.

If datetime is missing or cannot be converted to a valid result, DATEVALUE returns a #VALUE! error.

The returned value is displayed using the short date style set by the system's current Regional Settings.

The DATEVALUE function also accepts a single number value for expression where the integer portion of the result represents the days since December 30, 1899.

Example 1

DATEVALUE(NOW( ))+5 ed.

Returns the date five days from now.

Example 2

DATEVALUE("7/19/1995 12:30")

Returns the date.

Example 3

DATEVALUE("May 33, 1997")

Returns a #VALUE! error.

Example 4

DATEVALUE(35580.6337)

Returns 5/30/1997.


DATE Function (VisioShapeSheet)

 Copy code hover
[image]

DATE Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the date represented by year, month, and day formatted according to the short date style in the system's Regional Settings. The values for year, month, and day reflect the Gregorian calendar.

Syntax

DATE(year,month,day)

Parameters

Name | Required/Optional | Data Type | Description
year | Required | Integer | The year.
month | Required | Integer | The month.
day | Required | Integer | The day.

Example 1

DATE(1999,6,7)

Returns the value representing 6/7/1999.

Example 2

DATE(1999,6,7) + 4 ed.

Returns the value representing 6/11/1999.

Example 3

FORMAT(DATE(1999,10,14),"C")

Returns the value representing Tuesday, October 14, 1999.


DAYOFYEAR Function

 Copy code hover
[image]

DAYOFYEAR Function
Send feedback

Published: July 16, 2012

Returns an integer, 1 to 366, that represents the sequential day of the year in datetime or expression. The DAYOFYEAR function uses the Gregorian calendar.

Syntax

DAYOFYEAR("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | Any string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | String | Any expression that yields a date and time.
lcid | Optional | Number | Specifies the locale identifier to be used in evaluating a non-local datetime. The locale identifier is a number described in the system header files.

Return Value

Integer

Remarks

Any time component in datetime or expression is discarded.

The result corresponds to January 1 to December 31. No rounding is done. If datetime is missing or cannot be interpreted as a valid date or time, the function returns an error.

The DAYOFYEAR function also accepts a single number value for expression where the integer portion of the result represents the number of days since December 30, 1899.

Example 1

DAYOFYEAR("May 30, 1997 13:45:24")

Returns 150.

Example 2

DAYOFYEAR(DATEVALUE("May 30, 1997")+7 ed.)

Returns 157.

Example 3

DAYOFYEAR(35580.6337)

Returns 150.


DAY Function (VisioShapeSheet)

 Copy code hover
[image]

DAY Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns an integer, 1 to 31, representing the day in datetime or expression. The DAY function uses the Gregorian calendar.

Syntax

DAY("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | Any string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | String | Any expression that yields a date and time.
lcid | Optional | Number | Specifies the locale identifier to be used in evaluating a non-local datetime. The locale identifier is a number described in the system header files.

Return Value

Integer

Remarks

Any time component in datetime or expression is discarded.

No rounding is done. If datetime is missing or cannot be converted to a valid result, the function returns an error.

The DAY function also accepts a single number value for expression where the integer portion of the result represents the number of days since December 30, 1899.

Example 1

DAY("May 30, 1997 15:45:24")

Returns 30.

Example 2

DAY(DATEVALUE("May 30, 1997")+7 ed.)

Returns 6.

Example 3

DAY(35580.6337)

Returns 30.


DECIMALSEP Function

 Copy code hover
[image]

DECIMALSEP Function
Send feedback

Published: July 16, 2012

Returns the decimal separator string for the current user locale.

Syntax

DECIMALSEP( )

Example

SETF(GETREF(user.size), user.wholePart & DECIMALSEP() & user.fracPart)


DEFAULTEVENT Function

 Copy code hover
[image]

DEFAULTEVENT Function
Send feedback

Published: July 16, 2012

Performs the default event associated with the object.

Syntax

DEFAULTEVENT( )

Remarks

The following table lists the default event associated with several objects.

Object | Default event
Shape | Edit text.
Group | Do nothing.
OLE | Do primary verb.
Other | Do nothing.

In earlier versions of Visio, this function appears as _DEFAULTEVENT and the default event for a group is to open a group window.


DEG Function

 Copy code hover
[image]

DEG Function
Send feedback

Published: July 16, 2012

Converts the value of an angle from radians to degrees.

Syntax

DEG(angle)

Parameters

Name | Required/Optional | Data Type | Description
angle | Required | String | The value of the angle in radians.

Example

DEG(PI( )/4)

Returns 45


DEPENDSON Function

 Copy code hover
[image]

DEPENDSON Function
Send feedback

Published: July 16, 2012

Creates a cell reference dependency.

Syntax

DEPENDSON(cellref[,cellref2,...])

Parameters

Name | Required/Optional | Data Type | Description
cellref | Required | String | The first cell reference.
cellref2 | Optional | String | The second cell reference.

Remarks

This function always returns FALSE. It has no effect when used in an Event row or an Action cell.

Example

OPENTEXTWIN() + DEPENDSON(PinX,PinY)

Opens the text block for a shape whenever the shape's PinX or PinY cells change.


DESCRIPTION Function

 Copy code hover
[image]

DESCRIPTION Function
Send feedback

Published: July 16, 2012

Returns the text from the Description field of a document's properties.

Syntax

DESCRIPTION ()


DIRECTORY Function

 Copy code hover
[image]

DIRECTORY Function
Send feedback

Published: July 16, 2012

Returns the full path of the directory (folder) in which a document is saved, as a string. Returns an empty string if the document has not been saved.

Syntax

DIRECTORY ()


DISTTOPATH Function

 Copy code hover
[image]

DISTTOPATH Function
Send feedback

Published: July 16, 2012

Returns the shortest distance from the point represented by the specified coordinates to a point on the path.

Version Information

Version Added: Visio 2010

Syntax

DISTTOPATH(section,x,y)

Parameters

Name | Required/Optional | Data Type | Description
section | Required | String | The Geometry section that represents the path, specified by a reference to its Path cell (for example, Geometry1.Path).
x | Required | Double | The x-coordinate of the point.
y | Required | Double | The y-coordinate of the point.

Return Value

Double

Remarks

Microsoft Visio returns #REF! if section does not exist.

The returned value is positive if the point is to the left of the direction of travel; it is negative if the point is to the right of the direction of travel.


DOCCREATION Function

 Copy code hover
[image]

DOCCREATION Function
Send feedback

Published: July 16, 2012

Returns the date and time a document was created, as a serial value.

Syntax

DOCCREATION ()

Remarks

Use the FORMAT function to format the value.


DOCLASTEDIT Function

 Copy code hover
[image]

DOCLASTEDIT Function
Send feedback

Published: July 16, 2012

Returns, as a serial value, the date and the time that a document was last edited.

Syntax

DOCLASTEDIT()

Remarks

Use the FORMAT function to format the value.


DOCLASTPRINT Function

 Copy code hover
[image]

DOCLASTPRINT Function
Send feedback

Published: July 16, 2012

Returns the date and time a document was last printed, as a serial value.

Syntax

DOCLASTPRINT ()

Remarks

Use the FORMAT function to format the value.


DOCLASTSAVE Function

 Copy code hover
[image]

DOCLASTSAVE Function
Send feedback

Published: July 16, 2012

Returns the date and time a document was last saved, as a serial value.

Syntax

DOCLASTSAVE ()

Remarks

Use the FORMAT function to format the value.


DOCMD Function

 Copy code hover
[image]

DOCMD Function
Send feedback

Published: July 16, 2012

Performs the identified command.

Syntax

DOCMD(commandID)

Parameters

Name | Required/Optional | Data Type | Description
commandID | Required | Number | The command to perform.

Remarks

For a list of commands that are supported with the DOCMD function, see the topic "DoCmd/DOCMD commands" in the Microsoft Visio 2013 Automation Reference.

Example

DOCMD (1312)

Causes the Shape Data dialog box to appear in the user interface.


DOOLEVERB Function

 Copy code hover
[image]

DOOLEVERB Function
Send feedback

Published: July 16, 2012

Executes a verb for the OLE object.

Syntax

DOOLEVERB("verb")

Parameters

Name | Required/Optional | Data Type | Description
"verb" | Required | String | The verb to execute.

Remarks

In earlier versions of Visio, this function appears as _DOOLEVERB. Visio versions 4.0 and later accept either style.

Example

DOOLEVERB("edit")

Runs the OLE object program and displays the linked or embedded object so that it can be edited.


EVALCELL Function

 Copy code hover
[image]

EVALCELL Function
Send feedback

Published: July 16, 2012

Takes a reference to a cell that contains a custom function as well as one or more name-value pairs to pass to the custom function as arguments (optional). Returns the calculated result of the custom function given the specified arguments and values.

Syntax

EVALCELL(cellRef,[arg1Name,arg1],[arg2Name,arg2],…)

Parameters

Name | Required/Optional | Data Type | Description
cellRef | Required | String | A reference to the cell that contains the custom function. Cross-sheet references are allowed.
arg1Name | Optional | String | The name of the first argument to be passed to the custom function. Spaces are allowed.
arg1 | Optional | Varies | Value of the arg1 parameter.
arg2Name | Optional | String | The name of the second argument to be passed to the custom function. Spaces are allowed.
arg2 | Optional | Varies | Value of the arg2 parameter.

Return Value

Number

Remarks

The calling cell does not have to specify every argument used by the custom function.

Example

The following example shows how to use the EVALCELL function in conjunction with the ARG function to find the middle value from a set of three values.

In the expression cell, place the following code that defines the custom function:

Copy code Copy code
User.MiddleValue = IF(ARG("A")>ARG("B"),IF(ARG("B")>ARG("C"),ARG("B"),IF(ARG("A")>ARG("C"),ARG("C"),ARG("A"))),IF(ARG("A")>ARG("C"),ARG("A"),IF(ARG("B")>ARG("C"),ARG("C"),ARG("B"))))

In the calling cells, place the following code that calls the custom function:

Copy code Copy code
User.Middle1 = EVALCELL(User.MiddleValue,"A",3,"B",9,"C",5)
User.Middle2 = EVALCELL(User.MiddleValue,"A",12,"B",0,"C",21)


EVALTEXT Function

 Copy code hover
[image]

EVALTEXT Function
Send feedback

Published: July 16, 2012

Evaluates the text in shapename as if it were a formula and returns the result.

Syntax

EVALTEXT(shapename!theText)

Parameters

Name | Required/Optional | Data Type | Description
shapename!theText | Required | String | A cell that is triggered when the associated shape's text composition changes.

Return Value

String

Remarks

shapename can be used to refer to the text of a shape other than the current shape.

If there is no text, the result is zero. If the text cannot be evaluated, the function returns an error.

Example

EVALTEXT(Line.2!theText)

Evaluates the text contained in the shape Line.2. For example, if Line.2 contains "4 ft + 0.5 ft", returns the value 4.5 ft.


FIELDPICTURE Function

 Copy code hover
[image]

FIELDPICTURE Function
Send feedback

Published: July 16, 2012

Returns a format-picture string that matches the Microsoft Visio internal text field format code.

Syntax

FIELDPICTURE(code)

Parameters

Name | Required/Optional | Data Type | Description
code | Required | Number | A text field format code.

Return Value

String

Remarks

Format picture strings are used in the FORMAT function to define the expansion of values to dates, times, numbers, and unit labels.

Example

FIELDPICTURE(0)

Returns the format picture string "esc(0)", which specifies a number that has one decimal place and a lowercase unit description when used in the FORMAT function.


FILENAME Function

 Copy code hover
[image]

FILENAME Function
Send feedback

Published: July 16, 2012

Returns a document's file name as a string.

Syntax

FILENAME ()

Return Value

String


FIND Function

 Copy code hover
[image]

FIND Function
Send feedback

Published: July 16, 2012

Finds one text string contained within another text string, and returns the starting position of the text string you are seeking relative to its position in the text string that contains it.

Syntax

FIND (find_text, within_text ,[start_num], [ignore_case])

Parameters

Name | Required/Optional | Data Type | Description
find_text | Required | String | The text string you want to find.
format | Required | String | The text string that contains the text you want to find.
start_num | Optional | Number | The character at which to start the search. The first character in within_text is 1. If start_num is missing, it is assumed to be 1.
ignore_case | Optional | Boolean | By default, the FIND function is case-sensitive. If you want the FIND function to ignore case, set this argument to TRUE.

Return Value

Number

Remarks

If multiple matches are found, the FIND function returns the starting position of the first match in the string. The find_text argument does not consider any characters to be wildcards.

If find_text:

  • Is empty (""), FIND matches the first character in the search string (that is, the character numbered start_num or 1).

  • Does not appear in within_text, FIND returns the #VALUE! error value.

If start_num:

  • Is not greater than zero (0), FIND returns the #VALUE! error value.

  • Is greater than the length of within_text, FINDreturns the #VALUE! error value.

Example

FIND ("2003","January 1, 2003")

Returns 12.


FLOOR Function

 Copy code hover
[image]

FLOOR Function
Send feedback

Published: July 16, 2012

Rounds a number toward 0 (zero), to the next integer, or to the next instance of multiple.

Syntax

FLOOR(number, multiple)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Number | The number to round.
multiple | Required | Number | The multiple to which to round.

Return Value

Number

Remarks

If multiple is not specified, the number rounds toward 0 to the next integer.

Number and multiple must have the same signs, or a #NUM! error is returned. If either number or multiple cannot be converted to a value, a #VALUE! error is returned. If either number or multiple is 0, the result is 0.

Example 1

FLOOR(3.7)

Returns 3.

Example 2

FLOOR(-3.7)

Returns -3.

Example 3

FLOOR(3.7, 0.5)

Returns 3.5.


FONT Function

 Copy code hover
[image]

FONT Function
Send feedback

Published: July 16, 2012

Returns the integer value of the unique identifier for a font, specified by name.

Note Note

In most cases, the font identifier is system-specific. Although the font remains established once used in a file, the FONT function provides consistent access to a particular font across systems and versions of Visio. It is recommended that you use the FONT function to assign fonts instead of referring to font identifiers directly.

Version Information

Version Added: Visio 2013

Syntax

FONT("font_name_string")

Parameters

Name | Required/Optional | Data Type | Description
font_name_string | Required | string | The name of the font.

Return Value

Integer

Remarks

If the string provided for font_name_string does not match a known font, this function returns a #VALUE! error.

Example

FONT("Calibri")

Returns the integer value (4) representing the unique ID for the "Calibri" font.


FONTTOID Function

 Copy code hover
[image]

FONTTOID Function
Send feedback

Published: July 16, 2012

Returns the identifier (ID) of the specified font.

Note Note

It is recommended to use FONT function, which is similar to the FONTTOID function. In Microsoft Visio 2013, the FONT function was introduced to replace FONTTOID.

Syntax

FONTTOID(font_name)

Parameters

Name | Required/Optional | Data Type | Description
font_name | Required | String | The name of the font.


FORMATEX Function

 Copy code hover
[image]

FORMATEX Function
Send feedback

Published: July 16, 2012

Returns the result of expression evaluated in srcUnit as a string formatted according to format expressed in dstUnit.

Syntax

FORMATEX(expression,"format",[srcUnit],[dstUnit],[langID][,calID])

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | String | A combination of constants, operators, functions, and references to ShapeSheet cells that results in a value.
format | Required | String | The format picture used to format the string. For more information about format pictures, see About Format Pictures.
srcUnit | Optional | String | Units used to evaluate expression (in, cm, and so forth).
dstUnit | Optional | String | Units to use for the result of expression (in, cm, and so forth).
langID | Optional | Number | The language used when formatting Microsoft Office System date/time pictures.
calID | Optional | Number | The calendar used when formatting Microsoft Office System date/time pictures.

Return Value

String

Remarks

The type of the expression and the type specified in the format picture govern the behavior of the returned string. The format must be appropriate for the type of expression.

The srcUnit argument is used to scale untyped expression results, such as 3 + 4. If the result of expression has an explicit type, such as 3 ft + 8 ft, then srcUnit is ignored.

The dstUnit argument is used to specify the units used for the formatted result. If dstUnit is not specified, the units for the result of the expression are used.

Returns an error if the result of expression and the type expected in format are of a different kind, if there are syntax errors in format, or if it does not recognize the units passed as srcUnit or dstUnit.

Example

FORMATEX(5.5, "0.00 u", "cm", "ft")

Returns 0.18 feet.


FORMAT Function

 Copy code hover
[image]

FORMAT Function
Send feedback

Published: July 16, 2012

Returns the result of expression as a string formatted according to formatpicture.

Syntax

FORMAT(expression,"formatpicture")

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | String | A combination of constants, operators, functions, and references to ShapeSheet cells that results in a value.
formatpicture | Required | String | The format picture used to fomat the string.

Return Value

String

Remarks

The type of the expression and the type specified in the format picture govern the behavior of the returned string. The formatpicture must be appropriate for the type of expression. For more information about specifying format pictures, see About format pictures.

Returns an error if the result of expression and the type expected in formatpicture are of a different kind or if there are syntax errors in formatpicture.

Example 1

FORMAT(1cm/4, "0.000 u")

Returns "0.250 cm."

Example 2

FORMAT(1cm/4, "0.00 U")

Returns "0.25 CM."

Example 3

FORMAT(1cm/4, "0.0 u")

Returns "0.3 cm."


FORMULAEXISTS Function

 Copy code hover
[image]

FORMULAEXISTS Function
Send feedback

Published: July 16, 2012

Indicates whether the referenced cell contains a formula.

Syntax

FORMULAEXISTS (cellref)

Parameters

Name | Required/Optional | Data Type | Description
cellref | Required | String | The cell that you want to check for the presence of a formula.

Remarks

The FORMULAEXISTS function returns 1 if the cell contains a formula; if it does not contain a formula, it returns zero (0).


GETREF Function

 Copy code hover
[image]

GETREF Function
Send feedback

Published: July 16, 2012

References a cell and doesn't recalculate the formula when the referenced cell changes.

Syntax

GETREF(cellname)

Parameters

Name | Required/Optional | Data Type | Description
cellname | Required | String | The name of the cell to get a reference to.

Example

SETF(GETREF(PinX),5.1)

Sets the formula of the PinX cell to 5.1.


GETVAL Function

 Copy code hover
[image]

GETVAL Function
Send feedback

Published: July 16, 2012

Gets the value of a cell and doesn't recalculate the formula when the cell's value changes.

Syntax

GETVAL(cellname)

Parameters

Name | Required/Optional | Data Type | Description
cellname | Required | String | The name of the cell to get the value of.

Example

GETVAL(PinX) + GETVAL(PinY) + Width

Returns the sum of the value of the PinX, PinY, and Width cells.


GOTOPAGE Function

 Copy code hover
[image]

GOTOPAGE Function
Send feedback

Published: July 16, 2012

Displays the page that has the name pagename in the currently active window.

Syntax

GOTOPAGE("pagename")

Parameters

Name | Required/Optional | Data Type | Description
pagename | Required | String | The name of the page to go to.

Remarks

If a window is already displaying the page, that window becomes active. If pagename does not exist, the application attempts to navigate to http:// pagename /. If Visio is acting as an in-place server, the GOTOPAGE function has no effect.

You can use the HYPERLINK function to navigate to any DOS, UNC, or URL path.

In earlier versions of Visio products, this function appears as _GOTOPAGE. Visio versions 4.0 and later accept either style.


GRAVITY Function

 Copy code hover
[image]

GRAVITY Function
Send feedback

Published: July 16, 2012

Calculates a text block's correct angle of rotation for the indicated shape rotation to prevent the text from turning upside down.

Syntax

GRAVITY(angle,[limit1],[limit2])

Parameters

Name | Required/Optional | Data Type | Description
angle | Required | String | The shape's angle.
limit1 | Optional | String | First limit of rotation. Default is 90 degrees.
limit2 | Optional | String | Second limit of rotation. Default is 270 degrees.

Return Value

String

Remarks

The GRAVITY function is usually used in the TxtAngle cell.

The value returned is 180 degrees if angle is between the values specified by limit1 and limit2; otherwise the value returned is 0 degrees.

All of the arguments are automatically normalized between 0 and 360 degrees by the function. If an argument does not specify units, radians are assumed.

Example 1

GRAVITY(Angle)

Returns 180 degrees if angle is between 90 and 270 degrees; otherwise, returns 0 degrees.

Example 2

GRAVITY(2)

Returns 180 degrees, because 2 radians is between 90 and 270 degrees.

Example 3

GRAVITY(100 deg, 110 deg, 290 deg)

Returns 0 degrees.

Example 4

GRAVITY(100 deg, 290 deg, 110 deg)

Returns 0 degrees.


GREEN Function

 Copy code hover
[image]

GREEN Function
Send feedback

Published: July 16, 2012

Returns the green component of a color.

Syntax

GREEN(expression)

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | Varies | An index of a color in the document's color table, an expression that resolves to a custom color (such as RGB or HSL), or a reference to a cell that contains a color index or color result.

Return Value

Integer

Remarks

The return value is a number in the range 0 to 255, inclusive, or a cell reference that resolves to an index. If expression is invalid, it returns 0 (black).

Example 1

GREEN(Sheet.4!FillForegnd)

Returns the green component of Sheet.4's fill foreground color.

Example 2

GREEN(11)

Returns 128 if the document uses the default Visio color palette, where dark yellow is the color at index 11.

Example 3

GREEN(RGB(10, 20, 30))

Returns 20.


GUARD Function

 Copy code hover
[image]

GUARD Function
Send feedback

Published: July 16, 2012

Protects expression from deletion and change by actions performed in the drawing window, for example, moving, sizing, grouping, or ungrouping shapes.

Syntax

GUARD(expression)

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | String | A combination of constants, operators, functions, and references to ShapeSheet cells that results in a value.

Remarks

The cells most often affected by the GUARD function are Width, Height, PinX, and PinY.

Guarding a formula in any cell prevents that cell's value from being changed by actions in the drawing window. However, one action in the drawing window can affect several cells, and each of these cells must be guarded if you want to prevent unexpected changes to the shape's appearance.

Example

GUARD(TEXTWIDTH(TheText) + 0.5 in)

This expression in the Width cell of a shape's Shape Transform section prevents the expression (TEXTWIDTH(TheText) + 0.5 in) from being replaced with another value when the shape's width is changed in the drawing window. TheText is a cell that gets triggered when the associated shape's text composition changes.


HASCATEGORY Function

 Copy code hover
[image]

HASCATEGORY Function
Send feedback

Published: July 16, 2012

Returns TRUE if the specified string is found in the shape's category list.

Version Information

Version Added: Visio 2010

Syntax

HASCATEGORY(category)

Parameters

Name | Required/Optional | Data Type | Description
category | Required | String | The category to search for.

Return Value

Boolean

Remarks

Categories are user-defined strings that you can use to categorize shapes. You can define categories in the User.msvShapeCategories cell in the ShapeSheet for a shape. You can define multiple categories for a shape by separating the categories with semi-colons.


HELP Function

 Copy code hover
[image]

HELP Function
Send feedback

Published: July 16, 2012

Opens an HTML Help file with the specifed keyword in the Search box.

Syntax

HELP("filename.chm!keyword")

Parameters

Name | Required/Optional | Data Type | Description
filename.chm!keyword | Required | String | The filename of the Help file and the keyword to search for.

Remarks

If no keyword is specified, the HELP function opens the contents page of the Help file.

Example

HELP("visio.chm!shapesheet")

Opens the Visio Help file and displays a list of the topic(s) whose keyword is "shapesheet."


HOUR Function (VisioShapeSheet)

 Copy code hover
[image]

HOUR Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns an integer, 0 to 23, representing the hour of the day of datetime or expression.

Syntax

HOUR("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | A string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | Varies | An expression that yields a date and time.
lcid | Optional | Number | A locale identifier to be used in evaluating a nonlocal datetime. The locale identifier is a number described in the system header files.

Remarks

The date component in datetime and expression is discarded.

No rounding is done. If the datetime is missing or cannot be converted to a valid result, the function returns an error.

The returned value is formatted according to the time style set by the system's current Regional Settings.

The HOUR function also accepts a single number value for expression where the decimal portion of the result represents the fraction of a day since midnight.

Example 1

HOUR("15:45")

Returns 15.

Example 2

HOUR("May 30, 1997 3:45:24 PM")

Returns 15.

Example 3

HOUR(0.5)

Returns 12.

Example 4

HOUR("5/30/1997")

Returns 0.


HSL Function

 Copy code hover
[image]

HSL Function
Send feedback

Published: July 16, 2012

Returns a value representing an index in the document's color palette. It specifies a color by its hue, saturation, and luminosity components.

Syntax

HSL(hue,saturation,luminosity)

Parameters

Name | Required/Optional | Data Type | Description
hue | Required | Number | The color's hue, expressed as a number in the range 0 to 239, inclusive, or an expression that evaluates to such a number.
saturation | Required | Number | The color's saturation, expressed as a number in the range 0 to 240, inclusive, or an expression that evaluates to such a number.
luminosity | Required | Number | The color's luminosity, expressed as a number in the range 0 to 240, inclusive, or an expression that evaluates to such a number.

Return Value

Number

Remarks

If the color returned by the function does not already exist in the current document's color palette, it is added to the document's list of available colors.

The following table lists some standard colors and their hue, saturation, and luminosity values.

Color | Hue value | Saturation value | Luminosity value
Black | 0 | 0 | 24
Blue | 160 | 240 | 120
Green | 80 | 240 | 120
Cyan | 120 | 240 | 120
Red | 0 | 240 | 120
Magenta | 200 | 240 | 120
Yellow | 40 | 240 | 120
White | 0 | 0 | 240

Example 1

HSL(160,240,120)

Returns the index for the color blue.

Example 2

HSL(HUE(FillForegnd),SAT(FillForegnd),MIN(LUM(FillForegnd)+100,240))

Returns the index for a color that mirrors the fill foreground color with increased luminosity.


HUEDIFF Function

 Copy code hover
[image]

HUEDIFF Function
Send feedback

Published: July 16, 2012

Returns the difference in hue between color1 and color2.

Syntax

HUEDIFF(color1,color2)

Parameters

Name | Required/Optional | Data Type | Description
color1 | Required | Numeric | The Microsoft Visio color index or RGB value of the first color.
color2 | Required | Numeric | The Microsoft Visio color index or RGB value of the second color.


HUE Function

 Copy code hover
[image]

HUE Function
Send feedback

Published: July 16, 2012

Returns the value of a color's hue component.

Syntax

HUE(expression)

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | String | An expression that evaluates to a color.

Return Value

Number

Remarks

The return value is a number in the range 0 to 239, inclusive. The input is an index of a color in the document's color table, an expression that resolves to a custom color (like RGB or HSL), or a reference to a cell that contains a color index or color result. The function returns 0 for invalid input.

Example 1

HUE(Sheet.4!FillForegnd)

Returns the hue of Sheet.4's fill foreground color.

Example 2

HUE(7)

Returns 120 if the document uses the default Microsoft Visio color palette, where cyan is the color at index 7.

Example 3

HUE(HSL(10, 20, 30) )

Returns 10.


HYPERLINKBASE Function

 Copy code hover
[image]

HYPERLINKBASE Function
Send feedback

Published: July 16, 2012

Returns the text from the Hyperlink base field of a document's properties.

Syntax

HYPERLINKBASE ()

Return Value

String


HYPERLINK Function

 Copy code hover
[image]

HYPERLINK Function
Send feedback

Published: July 16, 2012

Navigates to the specified address, which can be a file, UNC, or URL path.

Syntax

HYPERLINK("address"[,"subaddress","extrainfo",window,"frame"])

Parameters

Name | Required/Optional | Data Type | Description
address | Required | String | A full path or a relative path.
subaddress | Optional | String | Specifies a location within address to link to. For example, if address is a Microsoft Visio file, subaddress can be a page name; if a Microsoft Excel file, subaddress can be a worksheet or range within a worksheet; if a URL for an HTML page, subaddress can be an anchor.
extrainfo | Optional | String | Passes information used in resolving the URL, such as the coordinates of an image map.
window | Optional | Boolean | Specifies whether the hyperlink is opened in a new window. The default value is FALSE.
frame | Optional | String | Specifies the name of a frame to target when Visio is open as an Active document in an ActiveX browser, such as Microsoft Internet Explorer 3.0 or later. The default is an empty string.

Remarks

If the document has no base path, Visio navigates according to the document path. If the document has not been saved, the hyperlink is undefined.

Relative paths are based on the Hyperlink base field specified in the Visio Properties dialog box.

You can use the GOTOPAGE function to navigate to pages of a document.

Example 1

HYPERLINK("C:\My Documents\Drawing1.vsdx")

Example 2

HYPERLINK("\\Server\Share\Drawing1.vsdx")

Example 3

HYPERLINK("http://www.microsoft.com")

Example 4

HYPERLINK("..\data.xlsx","sheet1!A1")


ID Function

 Copy code hover
[image]

ID Function
Send feedback

Published: July 16, 2012

Returns a shape's internal ID as a number.

Syntax

ID ()

Return Value

Number


IFERROR Function

 Copy code hover
[image]

IFERROR Function
Send feedback

Published: July 16, 2012

Returns the evaluated result of a primary expression, if it does not evaluate to an error. Otherwise, returns the evaluated result of an alternate expression.

Version Information

Version Added: Visio 2010

Syntax

IFERROR(primary expression, alternate expression)

Parameters

Name | Required/Optional | Data Type | Description
primary expression | Required | String | The first expression to evaluate.
alternate expression | Required | String | The alternate expression to evaluate if the primary expression evaluates to an error.

Return Value

Varies


IF Function

 Copy code hover
[image]

IF Function
Send feedback

Published: July 16, 2012

Returns valueiftrue if logicalexpression is TRUE. Otherwise, it returns valueiffalse.

Syntax

IF(logicalexpression,valueiftrue,valueiffalse)

Parameters

Name | Required/Optional | Data Type | Description
logicalexpression | Required | String | Expression to evaluate.
valueiftrue | Required | Varies | Value to return if logicalexpression is true.
valueiffalse | Required | Varies | Value to return if logicalexpression is false.

Return Value

Varies

Example

IF(Height > 1.25 in,5,7)

Returns 5 if the shape's height is greater than 1.25 inches. Returns 7 if the shape's height is less than or equal to 1.25 inches.


INDEX Function

 Copy code hover
[image]

INDEX Function
Send feedback

Published: July 16, 2012

Returns the substring at the zero-based location index in the list delimited by delimiter. Or, if the index is out of range, returns an empty string or the optional token provided as the errorvalue argument.

Syntax

INDEX(index,"list"[,[delimiter][,[errorvalue]]])

Parameters

Name | Required/Optional | Data Type | Description
index | Required | Number | The location that you want to find.
list | Required | String | The list in which you want to search.
delimiter | Optional | String | The string to use as a delimiter within list. A delimiter string can be more than one character in length and include multibyte characters. The default is a semicolon.
errorvalue | Optional | Number | A user-specified value to return if the index is out of range. The default is an empty string.

Remarks

If the list begins or ends with a delimiter, a null string is assumed to exist before or after the list. Consecutive delimiters imply a null string in between.

If the index is out of range, Visio returns an empty string or the optional token provided as the errorvalue argument.

Example 1

INDEX(3,"cat;rat;;goat")

Returns "goat".

Example 2

INDEX(54,";1;2;3;",,"ERROR")

Returns "ERROR".


INTERSECTX Function

 Copy code hover
[image]

INTERSECTX Function
Send feedback

Published: July 16, 2012

Returns the x-coordinate (in the local coordinate system) of the point where two lines intersect.

Syntax

INTERSECTX(x1,y1,angle1,x2,y2,angle2)

Parameters

Name | Required/Optional | Data Type | Description
x1 | Required | Number | The x-coordinate of a point on the first line.
y1 | Required | Number | The y-coordinate of a point on the first line.
angle1 | Required | Number | The value of the Angle cell for the first line.
x2 | Required | Number | The x-coordinate of a point on the second line.
y2 | Required | Number | The y-coordinate of a point on the second line.
angle2 | Required | Number | The value of the Angle cell for the second line.

Return Value

Number

Remarks

Each line is defined as a point ( x,y ) and an angle.

Microsoft Visio uses this function in the PinX cell of a shape glued to a rotated guide.

If the lines don't intersect, the function returns a divide-by-zero error (#DIV/0!), which Visio ignores, restoring the last known value for the point.

Example

INTERSECTX(VertGuide!PinX,VertGuide!PinY,VertGuide!Angle, HorzGuide!PinX,HorzGuide!PinY,HorzGuide!Angle)

Returns the x -coordinate of the intersection point of VertGuide and HorzGuide in page units.


INTERSECTY Function

 Copy code hover
[image]

INTERSECTY Function
Send feedback

Published: July 16, 2012

Returns the y-coordinate (in the local coordinate system) of the point where two lines intersect.

Syntax

INTERSECTX(x1,y1,angle1,x2,y2,angle2)

Parameters

Name | Required/Optional | Data Type | Description
x1 | Required | Number | The x-coordinate of a point on the first line.
y1 | Required | Number | The y-coordinate of a point on the first line.
angle1 | Required | Number | The value of the Angle cell for the first line.
x2 | Required | Number | The x-coordinate of a point on the second line.
y2 | Required | Number | The y-coordinate of a point on the second line.
angle2 | Required | Number | The value of the Angle cell for the second line.

Return Value

Number

Remarks

Each line is defined as a point ( x,y ) and an angle.

Microsoft Visio uses this function in the PinY cell of a shape glued to a rotated guide.

If the lines don't intersect, the function returns a divide-by-zero error (#DIV/0!), which Visio ignores, restoring the last known value for the point.

Example

INTERSECTY(VertGuide!PinX,VertGuide!PinY,VertGuide!Angle, HorzGuide!PinX,HorzGuide!PinY,HorzGuide!Angle)

Returns the y -coordinate of the intersection point of VertGuide and HorzGuide in page units.


INTUP Function

 Copy code hover
[image]

INTUP Function
Send feedback

Published: July 16, 2012

Rounds a number up to the next integer.

Syntax

INTUP(number)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Number | The number to round up.

Example 1

INTUP(3.2)

Returns 4.

Example 2

INTUP(-3.2)

Returns -3.

Example 3

INTUP(3)

Returns 3.


INT Function

 Copy code hover
[image]

INT Function
Send feedback

Published: July 16, 2012

Rounds a number down to the next integer.

Syntax

INT(number)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Number | The number to round down.

Example 1

INT(7.2)

Returns 7.

Example 2

INT(-7.2)

Returns -8.


IS1D Function

 Copy code hover
[image]

IS1D Function
Send feedback

Published: July 16, 2012

Returns TRUE if the shape is 1-D (one-dimensional); returns FALSE if the shape is 2-D (two-dimensional).

Version Information

Version Added: Visio 2010

Syntax

IS1D()

Return Value

Boolean

Remarks

If the sheet (shape) is a page or a document, the IS1D function returns #REF!.


ISERRNA Function

 Copy code hover
[image]

ISERRNA Function
Send feedback

Published: July 16, 2012

Returns TRUE if the value of cellreference is error type #N/A! (not available); otherwise, it returns FALSE. The ISERRNA function is used in formulas that refer to another cell.

Syntax

ISERRNA(cellreference)

Parameters

Name | Required/Optional | Data Type | Description
cellreference | Required | String | Reference to a cell.

Example 1

Cell | Formula | Value returned
Scratch.A1 | ="5 + 3" | "8"
Scratch.B1 | =ISERRNA(Scratch.A1) | FALSE

Returns FALSE because the value returned is available.

Example 2

Cell | Formula | Value returned
Scratch.A1 | =NA( ) | #N/A!
Scratch.B1 | =ISERRNA(Scratch.A1) | TRUE

Returns TRUE because the value returned is error type #N/A!


ISERROR Function (VisioShapeSheet)

 Copy code hover
[image]

ISERROR Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns TRUE if the value of cellreference is any error type; otherwise, it returns FALSE. The ISERROR function is used in formulas that refer to another cell.

Syntax

ISERROR(cellreference)

Parameters

Name | Required/Optional | Data Type | Description
cellreference | Required | String | Reference to a cell.

Example 1

Cell | Formula | Value returned
Scratch.A1 | =NA( ) | #N/A!
Scratch.B1 | =ISERROR(Scratch.A1) | TRUE

Returns TRUE because the #N/A! error is recognized by the ISERROR function. You can use ISERR to find all types but the #N/A! error.

Example 2

Cell | Formula | Value returned
Scratch.X1 | ="House" | #VALUE!
Scratch.B1 | =ISERROR(Scratch.X1) | TRUE

Returns TRUE because the #VALUE! error is recognized by the ISERROR function. To build an expression based on the #VALUE! error, use the ISERRVALUE function.


ISERRVALUE Function

 Copy code hover
[image]

ISERRVALUE Function
Send feedback

Published: July 16, 2012

Returns TRUE if the value of cellreference is error type #VALUE, where an argument in the formula is the wrong type. The ISERRVALUE function is used in logical expressions that refer to another cell.

Syntax

ISERRVALUE(cellreference)

Parameters

Name | Required/Optional | Data Type | Description
cellreference | Required | String | Reference to a cell.

Remarks

Scratch cells A through D won't return a #VALUE! error because the formula can contain numbers and letters in the same string. Cells X and Y must contain numbers only.

Example 1

Cell | Formula | Value returned
Scratch.X1 | = "House" | #VALUE!
Scratch.A1 | = If (ISERRVALUE(Scratch.X1),2,Scratch.X1) | 2

Returns 2 because the value returned is a #VALUE! error, and the expression instructs Microsoft Visio to return a 2 in place of the error.

Example 2

Cell | Formula | Value returned
Scratch.A1 | ="5 + 7" | 5 + 7
Scratch.B1 | =If (ISERRVALUE(Scratch.A1),2,Scratch.A1) | 5 + 7

Returns 12 because the value returned is not a #VALUE! error, and the expression instructs Visio to return the value of the original cell.


ISERR Function

 Copy code hover
[image]

ISERR Function
Send feedback

Published: July 16, 2012

Returns TRUE if the value of cellreference is any error type except #N/A; otherwise, it returns FALSE. The ISERR function is used in formulas that refer to another cell.

Syntax

ISERR(cellreference)

Parameters

Name | Required/Optional | Data Type | Description
cellreference | Required | String | Reference to a cell.

Example 1

Cell | Formula | Value returned
Scratch.A1 | =NA( ) | #N/A!
Scratch.B1 | =ISERR(Scratch.A1) | FALSE

Returns FALSE because the #N/A! error is not recognized by the ISERR function. Use ISERROR to find all error types.

Example 2

Cell | Formula | Value returned
Scratch.X1 | ="House" | #VALUE!
Scratch.A1 | =ISERR(Scratch.X1) | TRUE

Returns TRUE because the #VALUE! error is recognized by the ISERR function.


ISTHEMED Function

 Copy code hover
[image]

ISTHEMED Function
Send feedback

Published: July 16, 2012

Returns a Boolean value indicating whether a shape has a theme applied to it.

Version Information

Version Added: Visio 2013

Syntax

ISTHEMED()

Return Value

Boolean

Remarks

Note Note

The ISTHEMED function in Visio 2013 replaces the CELLISTHEMED function from previous versions of Visio.

The ISTHEMED function lets you assign appropriate parts of a theme's formatting to a shape but retain the ability to override other parts of the theme formatting with manually-applied formatting. If you subsequently reapply the theme, any manual formatting is overridden and the shape takes on all of the theme's formatting.

ISTHEMED evaluates to TRUE if the ColorSchemeIndex cell in the shape is greater than 0. If this cell is equal to 0, then ISTHEMED evaluates to FALSE. The theme of the DocumentSheet and PageSheet won't affect the value of the ISTHEMED function used in a ShapeSheet. Only if the ISTHEMED function shows up in the PageSheet does the page's theme matter.

Example

Cell | Formula | Result
Char.Font | IF(ISTHEMED(), THEMEVAL(), FONT("Calibri")) | If the shape has a themed applied to it, the shape text accepts the font formatting from the theme. If the shape is not themed, the shape text is formatted with the "Calibri" font.
LineColor | IF(ISTHEMED, RGB(255, 0, 0), RGB(0, 255, 0)) | If the shape has a themed applied to it, the shape's line color is red. If the shape is not themed, the shape's line color is green.


KEYWORDS Function

 Copy code hover
[image]

KEYWORDS Function
Send feedback

Published: July 16, 2012

Returns the text from the Keywords field of a document's properties.

Syntax

KEYWORDS ()

Return Value

String


LANGUAGE Function

 Copy code hover
[image]

LANGUAGE Function
Send feedback

Published: July 16, 2012

Allows comparison operations between different language representations. It is best used for converting Internet Engineering Task Force language tags (BCP 47) values to locale id (LCID) values.

Version Information

Version Added: Visio 2013

Syntax

LANGUAGE(lcid_or_bcp47)

Parameters

Name | Required/Optional | Data Type | Description
lcid_or_bcp47 | Required | String | The LCID or BCP 47 value for the language.

Return Value

Integer

Example

LANGUAGE("en-us")

Returns a value of '1033'.

LANGUAGE("es-es")

Returns a value of '3082'.


LEFT Function (VisioShapeSheet)

 Copy code hover
[image]

LEFT Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the left-most character or characters in a text string, based on the number of characters you specify.

Syntax

LEFT(text, [,num_chars_opt])

Parameters

Name | Required/Optional | Data Type | Description
text | Required | String | The text string that contains the characters you want to extract.
num_chars_opt | Optional | Numeric | The number of characters you want to extract.

Return Value

String

Remarks

The value of num_chars_opt must be greater than or equal to zero (0).

If num_chars_opt is greater than the length of the text, LEFT returns all of the text. If num_chars_opt is omitted, it is assumed to be 1.

Example

LEFT ("January 1, 2004", 3)

Returns the value "Jan".


LEN Function (VisioShapeSheet)

 Copy code hover
[image]

LEN Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the number of characters in a text string.

Syntax

LEN (text)

Parameters

Name | Required/Optional | Data Type | Description
text | Required | String | The character string whose length you want to find.

Return Value

Numeric

Example

LEN ("Seattle, WA")

Returns 11.


LISTMEMBERCOUNT Function

 Copy code hover
[image]

LISTMEMBERCOUNT Function
Send feedback

Published: July 16, 2012

Returns the number of member shapes in the list container shape.

Version Information

Version Added: Visio 2010

Syntax

LISTMEMBERCOUNT()

Return Value

Integer

Remarks

If the shape is not a list container, the LISTMEMBERCOUNT function returns -1.


LISTORDER Function

 Copy code hover
[image]

LISTORDER Function
Send feedback

Published: July 16, 2012

Returns the 1-based position of the shape in the list.

Version Information

Version Added: Visio 2010

Syntax

LISTORDER()

Return Value

Integer

Remarks

If the shape is not a list member, the LISTORDER function returns -1.


LISTSEP Function

 Copy code hover
[image]

LISTSEP Function
Send feedback

Published: July 16, 2012

Returns the list-separator string for the current user locale.

Syntax

LISTSEP ()

Return Value

String

Example

SETF(GETREF(user.extent), "MAX(Width" & ListSep() & "Height)")


LISTSHEETREF Function

 Copy code hover
[image]

LISTSHEETREF Function
Send feedback

Published: July 16, 2012

Returns a sheet reference to the list container shape that contains the shape.

Version Information

Version Added: Visio 2010

Syntax

LISTMEMBERCOUNT()

Return Value

ShapeSheet reference

Remarks

If the shape is not a list member, the LISTSHEETREF function returns #REF!.

Example

LISTSHEETREF(1)!Height

Returns the value in the Height cell of the list container shape that contains the shape.


LN Function

 Copy code hover
[image]

LN Function
Send feedback

Published: July 16, 2012

Returns the natural logarithm of a number. The number must be positive, or LN returns the error value #NUM.

Syntax

LN(number)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Numeric | The number whose natural logarithm you want to find.

Return Value

Numeric

Example

LN(42)

Returns 3.7377.


LOCALFORMULAEXISTS Function

 Copy code hover
[image]

LOCALFORMULAEXISTS Function
Send feedback

Published: July 16, 2012

Indicates whether the referenced cell contains a local formula.

Syntax

LOCALFORMULAEXISTS (cellref)

Parameters

Name | Required/Optional | Data Type | Description
cellref | Required | String | The cell that you want to check for the presence of a formula.

Return Value

Boolean

Remarks

The LOCALFORMULAEXISTS function returns 1 if the cell contains a local formula; if there is no formula, or if the formula is inherited, it returns 0 (zero).


LOCTOLOC Function

 Copy code hover
[image]

LOCTOLOC Function
Send feedback

Published: July 16, 2012

Returns a transformed point in local coordinates in the destination coordinate system.

Syntax

LOCTOLOC(srcPoint, srcRef, dstRef)

Parameters

Name | Required/Optional | Data Type | Description
srcPoint | Required | String | A point in local coordinates in the source coordinate system.
srcRef | Required | String | A reference to a cell in the source object.
dstRef | Required | String | A reference to a cell in the destination object.

Return Value

String

Remarks

The LOCTOLOC function converts a point from local coordinates in a source shape to local coordinates in a destination shape. You can use this function to construct a shape, for example, in terms of a point from another coordinate space. You can also use this function to transform a local point to page coordinates, or vice versa.

This function works even when the source and destination shapes are within groups. It also adjusts for rotation and flips in the intermediate transformation.

The source and destination coordinates must be on the same page.

Example

The following formula converts the local pin of the shape associated with the formula to a point on the page.

Copy code Copy code
LOCTOLOC(PNT(LocPinX, LocPinY), Width, ThePage!PageWidth)


LOCTOPAR Function

 Copy code hover
[image]

LOCTOPAR Function
Send feedback

Published: July 16, 2012

Returns a transformed point in parent coordinates in the destination coordinate system.

Syntax

LOCTOPAR(srcPoint, srcRef, dstRef)

Parameters

Name | Required/Optional | Data Type | Description
srcPoint | Required | String | A point in local coordinates in the source coordinate system.
srcRef | Required | String | A reference to a cell in the source object.
dstRef | Required | String | A reference to a cell in the destination object.

Return Value

String

Remarks

Converts a point from local coordinates in a source shape to parent coordinates in a destination shape. You can use the LOCTOPAR function to set parent coordinates in cells, such as PinX, PinY, BeginX, and BeginY in a shape using another point from another coordinate system.

This function works even when the source and destination shapes are within groups. It also adjusts for rotation and flips in the intermediate transformation.

The source and destination coordinates must be on the same page.

If the destination is a page, which has no parent, the result is expressed in the page's local coordinates.

Example

LOCTOPAR(PNT(LocPinX, LocPinY), Width, Sheet.4!Width)

Converts the local pin of the shape associated with the formula to parent coordinates of Sheet.4.


LOC Function (VisioShapeSheet)

 Copy code hover
[image]

LOC Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Takes a point defined in one shape's local coordinates and returns the equivalent point expressed in the local coordinates of the shape associated with the formula.

Syntax

LOC(point)

Parameters

Name | Required/Optional | Data Type | Description
point | Required | String | A point defined in one shape's local coordinates.

Return Value

String

Remarks

Local coordinates are measured from the lower-left corner of the shape's selection rectangle. Both shapes must be on the same page.

Example

LOC(PNT(Sheet.5!LocPinX, Sheet.5!LocPinY))

In this expression, PNT converts a set of local coordinates in Sheet.5 to a point. (Sheet.5 is another shape on the same drawing page.) LOC then converts that point to an equivalent point in the current shape's local coordinate system, relative to the lower-left corner of the selection rectangle of the current shape.

The 5 in Sheet.5 is the ID number for the shape, which is displayed in the Shape Name dialog box ( Developer tab).


LOG10 Function

 Copy code hover
[image]

LOG10 Function
Send feedback

Published: July 16, 2012

Returns the base 10 logarithm of a number. The number must be positive or LOG10 returns the error value #NUM.

Syntax

LOG10(number)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Numeric | The number whose base 10 logarithm you want to find.

Return Value

Numeric

Example

LOG10(42)

Returns 1.6232.


LOOKUP Function

 Copy code hover
[image]

LOOKUP Function
Send feedback

Published: July 16, 2012

Returns a zero-based index that indicates the location of the substring key in a list, or returns -1 if the target string contains the delimiter.

Syntax

LOOKUP("key","list"[,"delimiter"])

Parameters

Name | Required/Optional | Data Type | Description
key | Required | String | The string that you want to look up.
list | Required | String | The list in which you want to search.
delimiter | Optional | String | The string to use as a delimiter within list. A delimiter string can be more than one character in length and may include multibyte characters. The default is a semicolon.

Return Value

Numeric

Remarks

The LOOKUP function uses a case-insensitive search. If the list begins or ends with a delimiter, a null string is assumed to exist before or after the list. Consecutive delimiters imply a null string in between.

All the arguments must be strings or expressions that can be converted to strings. If they are not, an empty string is substituted for the offending argument.

Example 1

LOOKUP("rat","cat;rat;;goat")

Returns 1.

Example 2

LOOKUP("",";cat;rat;;goat")

Returns 0.

Example 3

LOOKUP("t","cat;rat;;goat","a")

Returns 3.


LOWER Function

 Copy code hover
[image]

LOWER Function
Send feedback

Published: July 16, 2012

Returns a string converted to lowercase.

Syntax

LOWER(expression)

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | Varies | A string, a cell reference, or an expression; the result is converted to a string which is then converted to lowercase.

Return Value

String

Remarks

The case conversion is locale-specific, based on the current user settings.

Example

LOWER("mIxEd CAse")

Returns "mixed case".


LUMDIFF Function

 Copy code hover
[image]

LUMDIFF Function
Send feedback

Published: July 16, 2012

Returns the difference in luminosity between color1 and color2.

Syntax

LUMDIFF(color1,color2)

Parameters

Name | Required/Optional | Data Type | Description
color1 | Required | Numeric | The Microsoft Visio color index or RGB value of the first color.
color2 | Required | Numeric | The Microsoft Visio color index or RGB value of the second color.


LUM Function

 Copy code hover
[image]

LUM Function
Send feedback

Published: July 16, 2012

Returns the value of a color's luminosity component.

Syntax

LUM(expression)

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | Numeric | The index of a color in the document's color table, or a reference to a cell that contains a color index.

Return Value

Number

Remarks

The return value is a number in the range 0 to 240, inclusive. The function returns 0 for invalid input.

Example 1

LUM(Sheet.4!FillForegnd)

Returns the luminosity of Sheet.4's fill foreground color.

Example 2

LUM(6)

Returns 120 if the document uses the default Visio color palette, where magenta is the color at index 6.

Example 3

LUM(HSL(10, 20, 30))

Returns 30.


MAGNITUDE Function

 Copy code hover
[image]

MAGNITUDE Function
Send feedback

Published: July 16, 2012

Returns the magnitude of the vector whose rise is A and whose run is B, multiplied by the respective constants constantA and constantB.

Syntax

MAGNITUDE(constantA,A,constantB,B)

Parameters

Name | Required/Optional | Data Type | Description
constantA | Required | Number | The constant by which to multiply the rise.
A | Required | Number | The rise.
constantB | Required | Number | The constant by which to multiply the run.
B | Required | Number | The run.

Remarks

MAGNITUDE is calculated according to the following formula:

SQRT((constantA * A)^2 + (constantB * B)^2)

Example

MAGNITUDE(1, 3, 1, 4)

Returns 5.


MANAGER Function

 Copy code hover
[image]

MANAGER Function
Send feedback

Published: July 16, 2012

Returns the text from the Manager field of a document's properties.

Syntax

MANAGER ()

Return Value

String


MASTERNAME Function

 Copy code hover
[image]

MASTERNAME Function
Send feedback

Published: July 16, 2012

Returns a sheet's master name as a string, or returns the string "<no master>" if the sheet doesn't have a master.

Syntax

MASTERNAME ([langID_opt])

Parameters

Name | Required/Optional | Data Type | Description
langID_opt | Optional | Number | Use to specify a language for the string the function returns. Use 0 (default value) to specify the local language. Use 750 to specify universal language.

Return Value

String

Remarks

If you pass an illegal language code, the local language is used.


MAX Function

 Copy code hover
[image]

MAX Function
Send feedback

Published: July 16, 2012

Returns the largest number from a list. Largest means closest to positive infinity.

Syntax

MAX(number1,number2,...,numberN)

Parameters

Name | Required/Optional | Data Type | Description
number1 | Required | Varies | The first number in the list.
number2 | Optional | Varies | The second number in the list.
numberN | Optional | Varies | The nth number in the list.

Return Value

Varies

Example

MAX(13 in,1 ft, 20 cm)

Returns 13 inches.


MID Function (VisioShapeSheet)

 Copy code hover
[image]

MID Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns a specific number of characters from a text string, starting at the position you specify, based on the number of characters you specify.

Syntax

MID (text, start_num, num_chars)

Parameters

Name | Required/Optional | Data Type | Description
text | Required | String | The text string that contains the characters you want to extract.
start_num | Required | Number | The position of the first character you want to extract. The first character in the text string is position 1.
num_chars | Required | Number | The number of characters to return.

Return Value

String

Remarks

If start_num is:

  • Greater than the length of text, MID returns "" (empty text).

  • Less than the length of text, but start_num plus num_chars exceeds the length of text, MID returns the characters up to the end of text.

  • Less than 1, MID returns the #VALUE! error value.

If num_chars is negative, MID returns the #VALUE! error value.

Example

MID ("SSN 999-99-9999",5,11)

Returns 999-99-9999.


MINUTE Function (VisioShapeSheet)

 Copy code hover
[image]

MINUTE Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns an integer from 0 to 59 that represents the minutes component of datetime or expression.

Syntax

MINUTE("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | Any string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | String | Any expression that yields a date and time.
lcid | Optional | Number | The locale identifier to be used in evaluating a nonlocal datetime. The locale identifier is a number described in the system header files.

Return Value

Integer

Remarks

The date component in datetime and expression is discarded.

No rounding is done. If datetime is missing or cannot be converted to a valid result, the function returns an error.

The returned value is formatted according to the time style set by the system's current Regional Settings.

The MINUTE function also accepts a single number value for expression where the decimal portion represents the fraction of a day since midnight.

Example 1

MINUTE("7/7/1999 13:45:24")

Returns 45.

Example 2

MINUTE(TIMEVALUE("Jan. 25, 1999 12:07:45")+6 em.)

Returns 13.

Example 3

MINUTE(0.575)

Returns 48.


MIN Function

 Copy code hover
[image]

MIN Function
Send feedback

Published: July 16, 2012

Returns the smallest number from a list. Smallest means closest to negative infinity.

Syntax

MIN(number1,number2,...,numberN)

Parameters

Name | Required/Optional | Data Type | Description
number1 | Required | Varies | The first number in the list.
number2 | Optional | Varies | The second number in the list.
numberN | Optional | Varies | The nth number in the list.

Return Value

Varies

Example

MIN(13 in,1 ft, 20 cm)

Returns 20 centimeters.


MODULUS Function

 Copy code hover
[image]

MODULUS Function
Send feedback

Published: July 16, 2012

Returns the remainder (modulus) that results when a number is divided by a divisor.

Syntax

MODULUS(number,divisor)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Number | The dividend.
divisor | Required | Number | The divisor.

Return Value

Number

Remarks

The result has the same sign as the divisor. A #DIV/0! error is returned if the divisor is 0.

In almost all situations, the MODULUS function should be used rather than the MOD function.

Example 1

MODULUS(5, 1.4)

Returns 0.8.

Example 2

MODULUS(5, -1.4)

Returns -0.6.

Example 3

MODULUS(-5, 1.4)

Returns 0.6.

Example 4

MODULUS(-5, -1.4)

Returns -0.8.


MONTH Function (VisioShapeSheet)

 Copy code hover
[image]

MONTH Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns an integer from 1 to 12 that represents a month.

Syntax

MONTH("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | Any string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | String | Any expression that yields a date and time.
lcid | Optional | Number | The locale identifier to be used in evaluating a nonlocal datetime. The locale identifier is a number described in the system header files.

Return Value

Integer

Remarks

The time component of datetime or expression is discarded.

No rounding is done. If the input string is missing or cannot be converted to a valid result, the MONTH function returns an error.

The returned value is formatted according to the short date style set by the system's current Regional Settings.

The MONTH function also accepts a single number value for expression where the integer portion of the result represents the number of days since December 30, 1899.

Example 1

MONTH("May 30, 1999 13:45:24")

Returns 5.

Example 2

MONTH(DATEVALUE("May 30, 1999")+7 ed.)

Returns 6.

Example 3

MONTH(35580.6337)

Returns 5.


MSOSHADE Function

 Copy code hover
[image]

MSOSHADE Function
Send feedback

Published: July 16, 2012

Modifies the color by decreasing its luminosity by the specified percentage.

Version Information

Version Added: Visio 2010

Syntax

MSOSHADE(color,-deltaLum)

Parameters

Name | Required/Optional | Data Type | Description
color | Required | RGB | The standard RGB (red, green, blue) color value or reference to a color.
-deltaLum | Required | Integer | The percentage change toward white (-100%) or black (100%) from the color value.

Remarks

The closer the color value is to white or black, the smaller the change to the shade that is produced by a specific -deltaLum value.


MSOTINT Function

 Copy code hover
[image]

MSOTINT Function
Send feedback

Published: July 16, 2012

Modifies the color by increasing its luminosity by the specified percentage.

Version Information

Version Added: Visio 2010

Syntax

MSOTINT(color,deltaLum)

Parameters

Name | Required/Optional | Data Type | Description
color | Required | RGB | The standard RGB (red, green, blue) color value or reference to a color.
deltaLum | Required | Integer | The percentage change toward white (-100%) or black (100%) from the color value.

Remarks

The closer the color value is to white or black, the smaller the change to the tint that is produced by a specific deltaLum value.


NAME Function

 Copy code hover
[image]

NAME Function
Send feedback

Published: July 16, 2012

Returns a sheet's name as a string.

Syntax

NAME (langID_opt)

Parameters

Name | Required/Optional | Data Type | Description
langID_opt | Optional | Number | Use to specify a language for the string the function returns. Use 0 (default value) to specify the local language. Use 750 to specify universal language.

Return Value

String

Remarks

If you pass an illegal language code, the local language is used.


NA Function

 Copy code hover
[image]

NA Function
Send feedback

Published: July 16, 2012

Returns the error value #NA!.

Use the NA function in a ShapeSheet cell where information is missing, so that the cell's default value is not used in calculations.

Syntax

NA( )

Return Value

String

Remarks

NA is the error value that means "no value available."


NEARESTPOINTONPATH Function

 Copy code hover
[image]

NEARESTPOINTONPATH Function
Send feedback

Published: July 16, 2012

Returns the percentage of the distance along the path of the point that is nearest to the specified coordinates, as a value between 0 and 1.

Version Information

Version Added: Visio 2010

Syntax

NEARESTPOINTONPATH(section,x,y)

Parameters

Name | Required/Optional | Data Type | Description
section | Required | String | The Geometry section that represents the path, specified by a reference to its Path cell (for example, Geometry1.Path).
x | Required | Double | The x-coordinate of the specified point.
y | Required | Double | The y-coordinate of the specified point.

Return Value

Double

Remarks

If section does not exist, Microsoft Visio returns #REF!.


NOT Function

 Copy code hover
[image]

NOT Function
Send feedback

Published: July 16, 2012

Returns TRUE (1) if logicalexpression is FALSE. Otherwise, it returns FALSE (0).

Syntax

NOT(logicalexpression)

Parameters

Name | Required/Optional | Data Type | Description
logicalexpression | Required | String | The logical expression to evaluate.

Return Value

Boolean

Example

NOT(Height > 0.75 in)

Returns 1 if Height is less than or equal to 0.75 inches. Returns 0 if Height is greater than 0.75 inches.


NOW Function (VisioShapeSheet)

 Copy code hover
[image]

NOW Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the current date and time value.

Syntax

NOW ( )

Return Value

Datetime

Remarks

NOW is automatically recalculated every minute.

Example 1

NOW( )

Returns the current date and time, such as 9/27/2010 12:03:30 PM.

Example 2

FORMAT(NOW(),"dd MMM., yyyy hh:mm")

Returns the current date and time formatted as 27 Sep., 2010 12:03.

Example 3

NOW()+2EW.

Returns the current date and time plus two elapsed weeks, such as 10/11/10 12:03:30 PM.


NURBS Function

 Copy code hover
[image]

NURBS Function
Send feedback

Published: July 16, 2012

Returns a nonuniform rational B-spline (NURBS). This function is used in the E cell in the NURBSTo geometry rows.

Syntax

NURBS(knotLast, degree, xType, yType, x1, y1, knot1, weight1, ...)

Parameters

Name | Required/Optional | Data Type | Description
knotLast | Required | string | The last knot.
degree | Required | Numeric | The spline's degree.
xType | Required | Numeric | Specifies how to interpret the x input data. If xType is 0, all x input data is interpreted as a percentage of Width. If xType is 1, all x input data is interpreted as local coordinates.
yType | Required | Numeric | Specifies how to interpret the y input data. If yType is 0, all y input data is interpreted as a percentage of Height. If yType is 1, all y input data is interpreted as local coordinates.
x1 | Required | String | An x-coordinate.
y1 | Required | String | A y-coordinate.
knot1 | Required | String | A knot on the B-spline.
weight1 | Required | String | A weight on the B-spline.

Remarks

For every x argument, there must be a y argument; otherwise, an error is returned.

You must specify at least one x, y, knot, and weight argument; otherwise, Visio returns an error.


OPENFILE Function

 Copy code hover
[image]

OPENFILE Function
Send feedback

Published: July 16, 2012

Opens a Microsoft Visio document, if it's not already open, and activates the document window.

Syntax

OPENFILE("filename")

Parameters

Name | Required/Optional | Data Type | Description
filename | Required | String | The name of the file, including file path, you want to open.

Remarks

Multiple OPENFILE function calls are queued and executed in order of evaluation. If the current Visio document is activated for visual (in-place) editing, a new Visio instance is launched with the requested file name.

This function always returns FALSE.

In earlier versions of the Visio application, this function appears as _OPENFILE. Visio versions 4.0 and later accept either style.

Example

OPENFILE("C:/MyFile.vsdx")

Opens the specified file "MyFile.vsdx" in a new window, or activates the window if the file is already open.


OPENGROUPWIN Function

 Copy code hover
[image]

OPENGROUPWIN Function
Send feedback

Published: July 16, 2012

Opens the group in the group window. If the object is not a group, this function does nothing.

Syntax

OPENGROUPWIN( )

Remarks

In earlier versions of Visio, this function appears as _OPENGROUPWIN. Visio versions 4.0 and later accept either style.


OPENSHEETWIN Function

 Copy code hover
[image]

OPENSHEETWIN Function
Send feedback

Published: July 16, 2012

Opens the ShapeSheet window in a new window.

Syntax

OPENSHEETWIN( )

Remarks

In earlier versions of Visio, this function appears as _OPENSHEETWIN. Visio versions 4.0 and later accept either style.


OPENTEXTWIN Function

 Copy code hover
[image]

OPENTEXTWIN Function
Send feedback

Published: July 16, 2012

Opens the shape's text block so that the text can be edited.

Syntax

OPENTEXTWIN( )

Remarks

In earlier versions of Visio, this function appears as _OPENTEXTWIN. Visio versions 4.0 and later accept either style.


OR Function

 Copy code hover
[image]

OR Function
Send feedback

Published: July 16, 2012

Returns TRUE (1) if any of the logical expressions passed as parameters are TRUE.

Syntax

OR(logicalexpression1,logicalexpression2,...,logicalexpressionN)

Parameters

Name | Required/Optional | Data Type | Description
logicalexpression1 | Required | String | The first expression whose truth you want to evaluate.
logicalexpression2 | Required | String | The second expression whose truth you want to evaluate.
logicalexpressionN | Required | String | The Nth expression whose truth you want to evaluate.

Return Value

Boolean

Remarks

Any expression that evaluates to a non-zero value is considered TRUE. If all of the logical expressions are FALSE or equal 0, this function returns FALSE.

Example

OR(Height > 1,PinX > 1)

Returns TRUE (1) if either expression is TRUE. Returns FALSE (0) only if both expressions are FALSE.


PAGECOUNT Function

 Copy code hover
[image]

PAGECOUNT Function
Send feedback

Published: July 16, 2012

Returns the number of foreground pages in a document.

Syntax

PAGECOUNT ()

Return Value

Number


PAGENAME Function

 Copy code hover
[image]

PAGENAME Function
Send feedback

Published: July 16, 2012

Returns the page name as a string.

Syntax

PAGENAME (langID_opt)

Parameters

Name | Required/Optional | Data Type | Description
langID_opt | Optional | Number | Use to specify a language for the string the function returns. Use 0 (default value) to specify the local language. Use 750 to specify universal language.

Return Value

String

Remarks

If you pass an illegal language code, the local language is used.


PAGENUMBER Function

 Copy code hover
[image]

PAGENUMBER Function
Send feedback

Published: July 16, 2012

Returns the number of the page that contains the shape.

Syntax

PAGENUMBER()

Return Value

Number

Remarks

If the current page is a background page (unnumbered), or if an error occurs, the PAGENUMBER function returns zero.


PAR Function

 Copy code hover
[image]

PAR Function
Send feedback

Published: July 16, 2012

Returns the x,y coordinates of a point in the coordinate system of the shape's parent.

Syntax

PAR(point)

Parameters

Name | Required/Optional | Data Type | Description
point | Required | Number, Number | The coordinates of the point in the coordinate system of the current shape.

Remarks

In Microsoft Visio, a point is a single value that embodies a pair of x - and y -coordinates. If the shape is in a group, its parent is the group. If the shape is not in a group, its parent is the page.

Example

PAR(PNT(PinX,PinY))

In this expression, PNT converts a pair of coordinates in the current shape into a point. PAR then converts the point into a pair of coordinates in relation to the lower-left corner of the page or group that contains the current shape.


PATHLENGTH Function

 Copy code hover
[image]

PATHLENGTH Function
Send feedback

Published: July 16, 2012

Returns the length of the path that is defined in the specified Geometry section.

Version Information

Version Added: Visio 2010

Syntax

PATHLENGTH(section[,segment])

Parameters

Name | Required/Optional | Data Type | Description
section | Required | String | The Geometry section that represents the path, specified by a reference to its Path cell (for example, Geometry1.Path).
segment | Optional | Integer | The 1-based segment of the path to measure.

Return Value

Double

Remarks

If section or segment does not exist, Microsoft Visio returns #REF!.

If you include a segment value, PATHLENGTH returns the length of that segment only.


PATHSEGMENT Function

 Copy code hover
[image]

PATHSEGMENT Function
Send feedback

Published: July 16, 2012

Returns the 1-based segment number at the specified percentage mark along the specified path.

Syntax

PATHSEGMENT(section,travel)

Parameters

Name | Required/Optional | Data Type | Description
section | Required | String | The Geometry section that represents the path, specified by a reference to its Path cell (for example, Geometry1.Path).
travel | Required | Double | The percentage of the path traversed, from the begin point to the end point. Must be between 0 and 1.

Return Value

Integer


PI Function

 Copy code hover
[image]

PI Function
Send feedback

Published: July 16, 2012

Returns the mathematical constant pi, which is approximately 3.1415926535898.

Syntax

PI( )

Return Value

Number

Example

(14 in / 2)^2 * PI( )

Returns 153.9380 inches, the area of a circle whose diameter is 14 inches.


PLAYSOUND Function

 Copy code hover
[image]

PLAYSOUND Function
Send feedback

Published: July 16, 2012

Plays a sound file or system sound.

Syntax

PLAYSOUND("filename"|"alias",isAlias,beep,synch)

Parameters

Name | Required/Optional | Data Type | Description
filename | Required | String | The name of the sound file you want to play.
alias | Required | String | A system sound represented by an alias.
isAlias | Required | Boolean | Specifies whether the preceding expression is an alias or file name; use a non-zero value to specify an alias.
beep | Required | Boolean | Specifies whether Microsoft Visio beeps when sound can't be played; use a non-zero number to beep.
synch | Required | Boolean | Determines whether sounds are played asynchronously (0) or synchronously (1).

Remarks

You should usually play sounds asynchronously so that Visio can continue processing while it plays the sound. To string several sounds together, play them synchronously, or some might fail to play.

Example 1

PLAYSOUND("chord.wav", 0, 0, 0)

Plays the wave audio file chord.wav asynchronously with no warning beep.

Example 2

PLAYSOUND("SystemExclamation", 1, 0, 0)

Plays the system exclamation sound asynchronously with no warning beep.


PNTX Function

 Copy code hover
[image]

PNTX Function
Send feedback

Published: July 16, 2012

Returns the x-coordinate of a point.

Syntax

PNTX(point)

Parameters

Name | Required/Optional | Data Type | Description
point | Required | Number | The x-coordinate of the point.

Return Value

Number

Example

PNTX(PNT(7,12))

Returns 7.


PNTY Function

 Copy code hover
[image]

PNTY Function
Send feedback

Published: July 16, 2012

Returns the y-coordinate of a point.

Syntax

PNTX(point)

Parameters

Name | Required/Optional | Data Type | Description
point | Required | Number | The y-coordinate of the point.

Return Value

Number

Example

PNTY(PNT(7,12))

Returns 12.


PNT Function

 Copy code hover
[image]

PNT Function
Send feedback

Published: July 16, 2012

Returns the point represented by the coordinates x and y as a single value.

Syntax

PNT(x,y)

Parameters

Name | Required/Optional | Data Type | Description
x,y | Required | Number, Number | The coordinates of the point in the coordinate system of the current shape.

Return Value

Point

Remarks

Converting coordinates to points allows you to change a shape's geometry without having to manipulate x- and y-coordinates separately.

Example

PNT(PinX,PinY)

Returns the point represented by PinX and PinY.


POINTALONGPATH Function

 Copy code hover
[image]

POINTALONGPATH Function
Send feedback

Published: July 16, 2012

Returns the coordinates of a point on, or offset from, the path.

Version Information

Version Added: Visio 2010

Syntax

POINTALONGPATH(section,travel[,offset][,segment])

Parameters

Name | Required/Optional | Data Type | Description
section | Required | String | The Geometry section that represents the path, specified by a reference to its Path cell (for example, Geometry1.Path).
travel | Required | Double | The percentage of the path traversed, from the begin point to the end point that identifies the point. Must be between 0 and 1.
offset | Optional | Double | The distance that the point is offset from the path. See Remarks for more information.
segment | Optional | Integer | The 1-based segment of the path in which to calculate the coordinates.

Return Value

Point

Remarks

If section or segment does not exist, Microsoft Visio returns #REF!.

Positive offset values specify points to the left of the direction of travel.

Negative offset values specify points to the right of the direction of travel.

A Point represents an ordered pair of geometric coordinates (x,y) as a single value.


POLYLINE Function

 Copy code hover
[image]

POLYLINE Function
Send feedback

Published: July 16, 2012

Returns a polyline. This function is used in the A cell of PolyLineTo geometry rows.

Syntax

POLYLINE(xType, yType, x1, y1...)

Parameters

Name | Required/Optional | Data Type | Description
xType | Required | Boolean | Specifies how to interpret the x input data. If xType is 0, the input x-data is interpreted as a percentage of Width. If xType is 1, the input x-data is interpreted as a local coordinate.
yType | Required | Boolean | Specifies how to interpret the y-input data. If yType is 0, the input y-data is interpreted as a percentage of Height. If yType is 1, the input y-data is interpreted as a local coordinate.
x1 | Required | Number | An x-coordinate.
y1 | Required | Number | A y-coordinate.

Remarks

For every x argument, there must be a y argument; otherwise, an error is returned.

Example

POLYLINE (0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0)

Returns a rectangle of dimensions Width x Height.


POW Function

 Copy code hover
[image]

POW Function
Send feedback

Published: July 16, 2012

Returns a number raised to the power of an exponent.

Syntax

POW(number,exponent)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Number | The number to raise to the power of an exponent.
exponent | Required | Number | The exponent.

Remarks

Both number and exponent may be non-integers, and they may be negative. If number is not 0 and exponent is 0, this function returns 1. If number is 0 and exponent is negative, this function returns 0.0. If both number and exponent are 0, or if number is negative and exponent is not an integer, this function returns 0.0. If both number and exponent are negative, this function returns -1.#IND.

Example

POW(5,2)

Returns 25.


QUEUEMARKEREVENT Function

 Copy code hover
[image]

QUEUEMARKEREVENT Function
Send feedback

Published: July 16, 2012

Causes the application to fire a marker event to your add-on, Microsoft Visual Basic for Applications (VBA) code, or COM add-in.

Syntax

QUEUEMARKEREVENT (event_string )

Parameters

Name | Required/Optional | Data Type | Description
event_string | Required | String | The string to pass to your event handler.

Remarks

The QUEUEMARKEREVENT function provides developers with a way to notify their code from a ShapeSheet cell, and pass solution-specific information. When the cell containing the formula with the QUEUEMARKEREVENT function is evaluated, the application fires a marker event and passes event_string to all event handlers that are listening to the MarkerEvent event.

For more information about marker events, see the QueueMarkerEvent method and MarkerEvent event topics in the Microsoft Visio Automation Reference.

Example

QUEUEMARKEREVENT ("MyCustomNotification")

Causes the application to fire a marker event, and passes the string "MyCustomNotification" to event handlers that are listening to the MarkerEvent event.


RAD Function

 Copy code hover
[image]

RAD Function
Send feedback

Published: July 16, 2012

Converts the value of an angle from degrees to radians.

Syntax

RAD(angle)

Parameters

Name | Required/Optional | Data Type | Description
angle | Required | Number | The angle to convert.

Example

RAD(45)

Returns 0.7854.


RAND Function

 Copy code hover
[image]

RAND Function
Send feedback

Published: July 16, 2012

Returns a random floating point number from 0.0 to 1.0. It returns a different number each time the function is evaluated, which is once per minute according to the system clock.

Syntax

RAND( )

Return Value

Float

Remarks

You can use this function to create animation effects by setting the properties of shapes to random values.

Example

RAND( )

Returns a decimal fraction, such as 0.3503.


RECTSECT Function

 Copy code hover
[image]

RECTSECT Function
Send feedback

Published: July 16, 2012

Calculates the sector of a rectangle associated with x and y and returns an integer 0 to 4, indicating the sector.

Syntax

RECTSECT(width,height,x,y,option)

Parameters

Name | Required/Optional | Data Type | Description
width | Required | String | Width of the rectangle.
height | Required | String | Height of the rectangle.
x | Required | String | An x-coordinate.
y | Required | String | A y-coordinate.
option | Required | Boolean | Specifies how points that fall on the diagonals are treated. Set the value to 0 to use the left and right sectors for points on a diagonal. Set the value to 1 to use the top and bottom sectors for points on a diagonal.

Remarks

Consider a rectangle that has a width and a height , and a point ( x,y ) from the center point of the rectangle. Draw diagonal lines through the corners of the rectangle to divide it into four sectors and a center point. The sectors 0 through 4 represent the center-point, right, top, left, and bottom respectively.

Example

RECTSECT(1 in, 2 in, 1 in, -7 in, 0)

Returns 4.


RED Function

 Copy code hover
[image]

RED Function
Send feedback

Published: July 16, 2012

Returns the red component of a color.

Syntax

RED(expression)

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | Varies | An index of a color in the document's color table, an expression that resolves to a custom color (like RGB or HSL), or a reference to a cell that contains a color index or color result.

Return Value

Number

Remarks

The return value is a number in the range 0 to 255, inclusive, or a cell reference that resolves to an index. If expression is invalid, this function returns 0 (black).

Example 1

RED(22)

Returns 51 if the document uses the default Microsoft Office Visio color palette, where dark gray is the color at index 22.

Example 2

RED(Char.Color)

Returns the value of the red component of the current font color.

Example 3

RED(RGB(10, 20, 30))

Returns 10.


REF Function

 Copy code hover
[image]

REF Function
Send feedback

Published: July 16, 2012

The REF function returns the error value #REF!.

Syntax

REF( )

Return Value

String

Example

REF( )

Returns #REF!.


REPLACE Function (VisioShapeSheet)

 Copy code hover
[image]

REPLACE Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Replaces part of a text string, based on the number of characters you specify, with a different text string.

Syntax

REPLACE (old_text, start_num, num_chars, new_text)

Parameters

Name | Required/Optional | Data Type | Description
old_text | Required | String | The text in which you want to replace some characters.
start_num | Required | Number | The position of the character in old_text that you want to replace with new_text. The first character in the string is position 1.
num_chars | Required | Number | The number of characters in old_text that you want to replace
new_text | Required | String | The text that will replace characters in old_text.

Return Value

String

Remarks

Use the REPLACE function when you want to replace text that occurs in a specific location in a text string. If you want to replace specific text in a text string, use the SUBSTITUTE function.

Example

REPLACE ("01/03/2002",9,2,"03")

Returns 01/03/2003.


REPT Function

 Copy code hover
[image]

REPT Function
Send feedback

Published: July 16, 2012

Repeats text a given number of times.

Syntax

REPT (text, number_times)

Parameters

Name | Required/Optional | Data Type | Description
text | Required | String | The text you want to repeat.
number_times | Required | Number | A positive number specifying the number of times to repeat text.

Remarks

If number_times is:

  • Zero (0), REPT returns "" (empty text).

  • Not an interger, it is truncated.

Example

REPT ("*", 5)

Returns *****.


REWIDEN Function

 Copy code hover
[image]

REWIDEN Function
Send feedback

Published: July 16, 2012

Converts a formula that produces 16-bit character codes that are widened single-byte or multibyte character-set codes into a string of 16-bit Unicode character codes, using the specified character sets.

Syntax

REWIDEN(srcCharSet, dstCharSet, text)

Parameters

Name | Required/Optional | Data Type | Description
srcCharSet | Required | String | The character set in the source document.
dstCharSet | Required | String | The character set in the destination document.
text | Required | String | The text to convert.

Remarks

The REWIDEN function is used in automatic conversion of Visio 2002 documents to Visio 2003 documents. Other use is not recommended.


RGB Function (VisioShapeSheet)

 Copy code hover
[image]

RGB Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns a value representing an index in the document's color palette. It specifies a color by its red, green, and blue components, where each is a number in the range 0 to 255, inclusive, or an expression that evaluates to such a number.

Syntax

RGB(red,green,blue)

Parameters

Name | Required/Optional | Data Type | Description
red | Required | Number | The red component.
green | Required | Number | The green component.
blue | Required | Nmber | The blue component.

Return Value

Number

Remarks

If the color returned by the function does not already exist in the current document's color palette, it is added to the palette.

The following table lists some standard colors and their red, green, and blue values.

Color | Red value | Green value | Blue value
Black | 0 | 0 | 0
Blue | 0 | 0 | 255
Green | 0 | 255 | 0
Cyan | 0 | 255 | 255
Red | 255 | 0 | 0
Magenta | 255 | 0 | 255
Yellow | 255 | 255 | 0
White | 255 | 255 | 255

Example 1

RGB(0,0,255)

Returns the index for the color blue.

Example 2

RGB(RED(Sheet.1!FillForegnd),120,0)

Returns the index for a color whose red component mirrors Sheet.1's fill foreground.


RIGHT Function (VisioShapeSheet)

 Copy code hover
[image]

RIGHT Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the last character or characters in a text string, based on the number of characters you specify.

Syntax

RIGHT(text [,num_chars_opt])

Parameters

Name | Required/Optional | Data Type | Description
text | Required | String | The text string containing the characters you want to extract.
num_chars_opt | Optional | Number | The number of characters you want to extract. The default is 1.

Return Value

String

Remarks

The value of num_chars_opt must be greater than or equal to zero (0).

If num_chars_opt is greater than the length of the text, RIGHT returns all of the text. If num_chars_opt is omitted, it is assumed to be 1.

Example

RIGHT ("January 1, 2004", 4)

Returns the value 2004.


ROUND Function (VisioShapeSheet)

 Copy code hover
[image]

ROUND Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Rounds a number to the precision represented by numberofdigits.

Syntax

ROUND(number,numberofdigits)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Number | The number to round off.
numberofdigits | Required | Number | The number of decimal places of precision.

Remarks

If numberofdigits is greater than 0, number is rounded by numberofdigits to the right of the decimal. If numberofdigits is 0, number is rounded to an integer. If numberofdigits is less than 0, number is rounded by numberofdigits to the left of the decimal.

Example 1

ROUND(123.654,2)

Returns 123.65.

Example 2

ROUND(123.654,0)

Returns 124.

Example 3

ROUND(123.654,-1)

Returns 120.


RUNADDONWARGS Function

 Copy code hover
[image]

RUNADDONWARGS Function
Send feedback

Published: July 16, 2012

Runs string and passes the command line arguments to the program as a string.

Syntax

RUNADDONWARGS("string","arguments")

Parameters

Name | Required/Optional | Data Type | Description
string | Required | String | The name of an add-on.
arguments | Required | String | Arguments to pass to your program.

Remarks

In practice, arguments should be 50 or fewer characters. Use the RUNADDONWARGS function to bind a program, such as an add-on, to a cell, for example, to an Action or Events cell.

The RUNADDONWARGS function can only run add-ons that are members of the application's Addons collection. To be present in that collection, an add-on must be an EXE file or VSL file that is:

  • Installed in the application's Startup or Addons path.

  • Added programmatically by using the Add method of the Addons collection.

For more information about running code in Visio, see About Security Settings and Running Code in Visio in this ShapeSheet Reference.

In earlier versions of Visio, this function appears as _RUNADDONWARGS. Visio application versions 4.0 and later accept either style.

Example

RUNADDONWARGS("GRAPHMKR.EXE","/GraphMaker=Stack")

Launches the add-on Graphmkr.exe and passes it the argument /GraphMaker=Stack.


RUNADDON Function

 Copy code hover
[image]

RUNADDON Function
Send feedback

Published: July 16, 2012

Executes an add-on or a macro in a Microsoft Visual Basic for Applications (VBA) project.

Syntax

RUNADDON("string")

Parameters

Name | Required/Optional | Data Type | Description
string | Required | String | The name of an add-on in the Addons collection or a macro in a VBA project.

Remarks

If the project of the document that contains the RUNADDON function call (or another project if it is referenced) does not have a macro (a procedure with no arguments) named string, Microsoft Visio runs the add-on named string. If no add-on named string can be found, Visio does nothing and reports no error. (You can use the TraceFlags property to monitor the procedures and add-ons that Visio attempts to run.)

When you call a procedure in a standard module, it is recommended that you prefix the string with the module name that contains the procedure (for example, moduleName.procName), because more than one module can have a procedure with the same name.

To call a procedure in a project other than the project of the document that contains the RUNADDON function call, use the syntax projName.modName.procName (you must have explicitly set a reference to projName in your VBA project).

Note Note

Beginning with Visio 2002, the RUNADDON function cannot execute a string containing arbitrary VBA code. Code that was formerly passed to the RUNADDON function can be moved to a procedure in a document's VBA project that is called from the RUNADDON function.

For more information about running code in Visio, see About Security Settings and Running Code in Visio in this ShapeSheet Reference.

In earlier versions of Visio, this function appears as _RUNADDON. Visio versions 4.0 and later accept either style.

Example 1

RUNADDON("Calendar.exe")

Launches an add-on called Calendar.exe.

Example 2

RUNADDON("Array Shapes")

Launches the (VSL-implemented) add-on whose name is Array Shapes.

Example 3

RUNADDON("ThisDocument.ReportStatistics")

Calls the ReportStatistics macro in the ThisDocument module in the document project containing this function call.

Note Note

To invoke a macro in the ThisDocument module, you must preface the string with "ThisDocument" as shown.

Example 4

RUNADDON("ModuleName.ReportStatistics")

Calls the ReportStatistics macro in ModuleName in the document project that contains this function call.


RUNMACRO Function

 Copy code hover
[image]

RUNMACRO Function
Send feedback

Published: July 16, 2012

Calls a macro in a Microsoft Visual Basic for Applications (VBA) project.

Syntax

RUNMACRO (macroname [, projname_opt])

Parameters

Name | Required/Optional | Data Type | Description
macroname | Required | String | The name of the macro to call.
projname_opt | Optional | String | The project that contains the macro.

Remarks

If a project is specified, Microsoft Visio scans all open documents for the one containing projname_opt and calls macroname in that project. If projname_opt is omitted or null (""), macroname is assumed to be in the VBA project of the document that contains the RUNMACRO formula being evaluated.

The RUNMACRO function differs from the CALLTHIS function in that it does not pass a reference to the shape that owns the formula being evaluated to macroname. Like CALLTHIS, the RUNMACRO function doesn't require a reference to projname_opt to call into it.

VBA code that is invoked when the Visio instance evaluates a RUNMACRO function in a formula should not close the document containing the cell using the function because an application error results and Visio terminates.

If you need to close the document containing the cell that uses the RUNMACRO function, use one of the following techniques:

  • Close the document from code that is not VBA.

  • Close the document from a project other than the one that is closing.

  • Post window messages to close windows in the document rather than closing the document.

For more information about running code in Visio, see About security settings and running code in Visio in this ShapeSheet Reference.

Example

The following example invokes a macro called MyTest in the ThisDocument class module of the VBA project containing the RUNMACRO formula.

RUNMACRO ("ThisDocument.MyTest")


SATDIFF Function

 Copy code hover
[image]

SATDIFF Function
Send feedback

Published: July 16, 2012

Returns the difference in saturation between color1 and color2.

Syntax

SATDIFF(color1,color2)

Parameters

Name | Required/Optional | Data Type | Description
color1 | Required | Numeric | The Microsoft Visio color index or RGB value of the first color.
color2 | Required | Numeric | The Microsoft Visio color index or RGB value of the second color.

Return Value

Numeric


SAT Function

 Copy code hover
[image]

SAT Function
Send feedback

Published: July 16, 2012

Returns the value of a color's saturation component.

Syntax

SAT(expression)

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | Varies | An index of a color in the document's color table, an expression that resolves to a custom color (like RGB or HSL), or a reference to a cell that contains a color index or color result.

Return Value

Numeric

Remarks

The return value is a number in the range 0 to 240, inclusive. The function returns 0 for invalid input.

Example 1

SAT(Sheet.4!FillForegnd)

Returns the saturation of Sheet.4's fill foreground color.

Example 2

SAT(8)

Returns 240 if the document uses the default Visio color palette, where dark red is the color at index 8.

Example 3

SAT(HSL(10, 20, 30))

Returns 20.


SECOND Function (VisioShapeSheet)

 Copy code hover
[image]

SECOND Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns an integer, 0 to 59, that represents the seconds component of datetime or expression.

Syntax

SECOND("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | Any string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | String | Any expression that yields a date and time.
lcid | Optional | Numeric | The locale identifier to be used in evaluating a nonlocal datetime. The locale identifier is a number described in the system header files.

Return Value

Integer

Remarks

The date component in datetime or expression is discarded.

No rounding is done. If datetime is missing or cannot be converted to a valid result, this function returns an error.

The SECOND function also accepts a single number value for expression where the decimal portion of the result represents the fraction of a day since midnight.

Example 1

SECOND("05/30/1997 13:45:32")

Returns 32.

Example 2

SECOND(TIMEVALUE("May 30, 1996 12:07:45") + 7 es.)

Returns 52.

Example 3

SECOND(0.6337)

Returns 32.


SEGMENTCOUNT Function

 Copy code hover
[image]

SEGMENTCOUNT Function
Send feedback

Published: July 16, 2012

Returns the number of line segments that make up the path.

Syntax

SEGMENTCOUNT(pathRef)

Parameters

Name | Required/Optional | Data Type | Description
pathRef | Required | Integer | The Geometry section that represents the path, specified by a reference to Path cell (for example, Geometry1.Path).

Return Value

Integer

Remarks

Line jumps are not included in the total number of segments returned.


SETATREFEVAL Function

 Copy code hover
[image]

SETATREFEVAL Function
Send feedback

Published: July 16, 2012

Used in the set_expression parameter of the SETATREF function to indicate that set_expression should be evaluated before assigning to the reference parameter in SETATREF.

Syntax

SETATREFEVAL(expr)

Parameters

Name | Required/Optional | Data Type | Description
expr | Required | Varies | An expression that is evaluated when the SETATREF function redirects set_expression to another cell.

Remarks

When assigning the set_expression parameter of the SETATREF function to a referenced cell, Microsoft Visio writes set_expression to the cell as an expression by default. However, if any portion of the set_expression parameter is wrapped by the SETATREFEVAL function, Visio evaluates the expression and replaces the SETATREFEVAL function with its result prior to resolving the SETATREF expression.

Example

For an example, see the SETATREF function.


SETATREFEXPR Function

 Copy code hover
[image]

SETATREFEXPR Function
Send feedback

Published: July 16, 2012

Stores a value that is set through an action in the user interface (UI) or Automation.

Syntax

SETATREFEXPR ([expr_opt])

Parameters

Name | Required/Optional | Data Type | Description
expr_opt | Optional | Varies | An expression that is replaced by the value or expression being assigned to the referenced cell in the SETATREF function. If not indicated, its initial value is 0 (zero).

Remarks

The value of a SETATREFEXPR expression can also be set from a SETATREF function in another cell that references the cell containing the SETATREFEXPR expression.

You are not limited to using the SETATREFEXPR function as a parameter to the SETATREF function.

Example 1

The following example uses the SETATREFEXPR function to ensure that a shape is as wide as its text.

Width =MAX(TEXTWIDTH(TheText),SETATREFEXPR())

Example 2

The following example shows how you can use the SETATREFEXPR function to cause your shapes to snap to a custom grid. The SETATREFEXPR formulas are placed in the PinX and PinY cells, causing the shape's pin to snap to the grid defined in User.GridX and User.GridY.

User.GridX =2 in

User.GridY =2 in

PinX =INT(SETATREFEXPR()/User.GridX + .5)*User.GridX

PinY =INT(SETATREFEXPR()/User.GridY + .5)*User.GridY

Example 3

For an example using the SETATREFEXPR function with the SETATREF function, see the SETATREF function.


SETATREF Function

 Copy code hover
[image]

SETATREF Function
Send feedback

Published: July 16, 2012

Redirects updated values resulting from actions in the user interface (UI) or Automation to another cell.

Syntax

SETATREF(reference [,set_expression [,ignore_eval]])

Parameters

Name | Required/Optional | Data Type | Description
reference | Required | String | A reference to the cell where updates are redirected.
set_expression | Optional | String | An expression that is assigned to reference.
ignore_eval | Optional | Boolean | If TRUE, the SETATREF function evaluates to (0) zero; if FALSE (the default) the SETATREF function evaluates to the value of reference.

Remarks

When a user action in the drawing window, or an Automation method, causes Microsoft Visio to update a cell containing a SETATREF formula, the value is instead redirected to the cell referenced by the SETATREF formula (reference). The formula in the cell containing the SETATREF function remains intact.

If set_expression is omitted, the value set in the UI or by using Automation is assigned to the referenced cell; otherwise, the contents of set_expression are assigned to the referenced cell. This allows the new value to be modified or transformed before being assigned to the referenced cell.

The SETATREF function has two related functions:

  • The SETATREFEXPR function, which you can use to represent the new value within set_expression. For example, a set_expression of SETATREFEXPR()-2 in. could be used to subtract 2 inches from the SETATREFEXPR result.

  • The SETATREFEVAL function, which you can use to indicate that some portion of set_expression should be evaluated and replaced by its result.

The SETATREF function is designed for use in cells that can be changed by user actions in the drawing window. The following cells are supported:

  • ShapeTransform section—Width, Height, Angle, PinX, and PinY cells

  • Text Transform section—TxtWidth, TxtHeight, TxtAngle, TxtPinX, and TxtPinY cells

  • 1-D Endpoints section—BeginX, BeginY, EndX, and EndY cells

  • Controls section—Controls.X and Controls.Y cells

  • Shape Data section

Because SETATREF changes the location where cell values change, it affects event firing. If a cell contains SETATREF, the FormulaChanged and CellChanged events fire for the cell that is referenced by SETATREF, not the cell containing SETATREF. If a cell containing SETATREF also contains SETATREFEXPR, the FormulaChanged event also fires for the cell containing SETATREF because a function parameter is changed.

Other important points to note about the SETATREF function include the following:

  • SETATREF functions can chain up to 10 references to other SETATREF functions.

  • Cells can contain other expressions in addition to the SETATREF function, including multiple occurrences of SETATREF in a single cell.

  • If shapes are glued, Visio follows the SETATREF reference chain within the same sheet and places glue formulas in the referenced cell.

  • Automation recognizes the SETATREF function and follows the chain of referenced cells.

  • Like GUARD, SETATREF does not protect cells from changes made by using the SETF function in the ShapeSheet.

Example1

Let's say that a shape has a custom property called Width, and that the Width cell in the Shape Transform section contains the following formula:

=SETATREF(Prop.Width)

If a user were to change the shape's width in the UI, the new value is assigned to the Prop.Width cell, not to the Width cell in the ShapeTransform section; the formula in the Width cell remains unchanged. You can also set the shape's width by using shape data.

Example2

Visio solutions often have shapes that have a hierarchical relationship, requiring child shapes to move when a parent shape is moved. Following is an example of how you might manage this relationship using the SETATREF function in the ShapeSheet.

The following formulas are contained in the Shape Transform section of the child shape. Also, we define user cells called User.DeltaX and User.DeltaY, which track the offset dimension from ParentShape. This allows the child shape to move when the parent shape is moved, and also to preserve the hierarchical relationship if the child shape is moved.

PinX =SETATREF(User.DeltaX, SETATREFEVAL(SETATREFEXPR() - ParentShape!PinX)) + ParentShape!PinX

PinY =SETATREF(User.DeltaY, SETATREFEVAL(SETATREFEXPR() - ParentShape!PinY)) + ParentShape!PinY

When the child shape is moved using the UI, the new PinX and PinY values are set as the parameter in the SETATREFEXPR function. The SETATREF function evaluates the formula enclosed in SETATREFEVAL and replaces PinX and PinY with their results, and then the resulting formula is assigned to the user cells referenced in the SETATREF function—User.DeltaX and User.DeltaY. Lastly, the values returned by SETATREF (User.DeltaX or User.DeltaY) are added to the pin location of ParentShape to calculate the child shape's pin location.


SETF Function

 Copy code hover
[image]

SETF Function
Send feedback

Published: July 16, 2012

Sets a cell's formula.

Syntax

SETF( GETREF(cell), formula)

Parameters

Name | Required/Optional | Data Type | Description
cell | Required | String | The cell whose formula to set.
formula | Required | String | The formula to use.

Remarks

When evaluated, the result of the expression in formula becomes the new formula in cell. If formula is enclosed in quotation marks, the quoted expression is written to cell. To set cell to a string, enclose formula in three sets of quotation marks.

The target cell must be specified using a GETREF() reference or as a string to avoid circularity. Using GETREF is preferred, because Microsoft Visio can adjust references when the shape is moved to a different document.

If cell is not specified using GETREF or as a string, the function returns an error, and no cell's formula is changed. If formula contains a syntax error, the function returns an error, and the formula in cell is not changed.

Example 1

SETF( GETREF(Scratch.A1), 1.5 in * 6 + 1 ft)

Sets the formula of Scratch.A1 to 21 inches.

Example 2

SETF( GETREF(Scratch.A1), "1.5 in * 6 + 1 ft")

Sets the formula of Scratch. A1 to the expression 1.5 in*6+1 ft.

Example 3

SETF( GETREF(Scratch.A1), """Say """"ahh""""""")

Sets the formula of Scratch.A1 to the string "Say ""ahh""" which evaluates to Say "ahh".


SHADE Function

 Copy code hover
[image]

SHADE Function
Send feedback

Published: July 16, 2012

Modifies the color by decreasing its luminosity by the amount (positive or negative) specified in the int parameter.

Syntax

SHADE(color,int)

Parameters

Name | Required/Optional | Data Type | Description
color | Required | Numeric | The Microsoft Visio color index or RGB value of the color.
int | Required | Integer | The amount by which to decrease the luminosity of the color. Can be positive or negative.

Return Value

RGB

Remarks

The upper and lower limits of luminosity are 0 and 240 respectively. There is no limit on the size of the integer you can pass for the int parameter, but luminosity never exceeds these limits.


SHAPETEXT Function

 Copy code hover
[image]

SHAPETEXT Function
Send feedback

Published: July 16, 2012

Gets the text from a shape.

Syntax

SHAPETEXT (shapename!TheText[,flag])

Parameters

Name | Required/Optional | Data Type | Description
shapename!TheText | Required |  | A reference to the cell named TheText in the target shape. Shapename! is the name of the shape from which you want to retrieve the text.
flag | Optional | Numeric | A bit that specifies the format of the text. The default flag (0) shows the text exactly as it is shown in the shape.

Return Value

String

Remarks

You can use any combination of the following flags with the SHAPETEXT function.

Flag | Description
0 | Show text exactly as shown in shape.
1 | Include discretionary hyphens.
2 | Don't include expanded text in fields.
4 | Convert tabs to a single space.
8 | Convert tabs to a set of spaces.
16 | Convert carriage returns and line feeds to spaces.
32 | Convert typographer quotes to regular quotes.
64 | Convert adjacent white space to a single space.

Example 1

SHAPETEXT(sheetN!theText)

Returns the text of the shape named sheetN, exactly as it is shown in the shape.

Example 2

SHAPETEXT(theText)

Returns the text of the current shape exactly as it is shown in the shape.

Example 3

SHAPETEXT(theText, 84)

Returns the text of the current shape. It also converts adjacent white space to a single space (64), converts carriage returns and line feeds to spaces (16), and converts tabs to a single space (4). The sum of these flags is 84.


SHEETREF Function

 Copy code hover
[image]

SHEETREF Function
Send feedback

Published: July 16, 2012

Returns a reference to the sheet (shape) that is specified in sheetref, or, if there is no sheetref qualifier, to the current sheet.

Version Information

Version Added: Visio 2010

Syntax

<sheetref>! SHEETREF()

Return Value

ShapeSheet reference

Remarks

You can use this function in other functions that take a sheet reference token.


SIGN Function

 Copy code hover
[image]

SIGN Function
Send feedback

Published: July 16, 2012

Returns a value that represents the sign of a number.

Syntax

SIGN(number,fuzz)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Numeric | The number for which you want to determine the sign.
fuzz | Optional | Numeric | Specifies how close to zero the number must be in order to be considered equal to zero.

Return Value

Numeric

Remarks

The SIGN function returns 1 if number is positive, 0 if number is zero, or -1 if number is negative.

Specifyin a fuzz value helps avoid floating-point roundoff errors when a calculation is almost zero. If you do not specify a fuzz value, Visio uses 1E-9 (0.000000001). You may want to supply a different value when you scale drawings or when you want an exact comparison.

Example 1

SIGN(-5)

Returns -1.

Example 2

SIGN(0)

Returns 0.

Example 3

SIGN(0.00000000001)

Returns 0.

Example 4

SIGN(0.00000000001,0)

Returns 1.


SINH Function

 Copy code hover
[image]

SINH Function
Send feedback

Published: July 16, 2012

Returns the hyperbolic sine of an angle.

Syntax

SINH(angle)

Parameters

Name | Required/Optional | Data Type | Description
angle | Required | Numeric | The angle of which to get the hyperbolic sine.

Return Value

Number

Remarks

The SINH function uses radians unless you specify a different unit of measure in angle.

Example

SINH(45 deg)

Returns 0.8687.


SIN Function (VisioShapeSheet)

 Copy code hover
[image]

SIN Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the sine of an angle.

Syntax

SIN(angle)

Parameters

Name | Required/Optional | Data Type | Description
angle | Required | Numeric | The angle of which to get the sine.

Return Value

Number

Remarks

The SIN function uses radians unless you specify a different unit of measure in angle.

Example

SIN(45 deg)

Returns 0.7071.


SQRT Function

 Copy code hover
[image]

SQRT Function
Send feedback

Published: July 16, 2012

Returns the square root of a number.

Syntax

SQRT(number)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Numeric | The number whose square root you want to find.

Return Value

Numeric

Remarks

If number is negative, the SQRT function returns the error value #NUM!.

Example

SQRT(2)

Returns 1.4142.


STRSAMEEX Function

 Copy code hover
[image]

STRSAMEEX Function
Send feedback

Published: July 16, 2012

Determines whether two strings are the same.

Syntax

STRSAMEEX ("string1", "string2", localeID, flag)

Parameters

Name | Required/Optional | Data Type | Description
string1 | Required | String | The first string to compare.
string2 | Required | String | The second string to compare.
localeID | Required | Numeric | The locale ID code.
flag | Required | Numeric | A bit that specifies the type of comparison.

Return Value

Boolean

Remarks

STRSAMEEX returns TRUE if both input strings are the same and FALSE if they aren't. Use this function to compare multi-byte strings or to do comparisons that use case rules for a specific locale.

You can use a combination of any of the following flags with the STRSAMEEX function.

Flag | Description
1 | Ignore case.
2 | Ignore non-spacing characters.
4 | Ignore symbols.
4096 | Treat punctuation the same as symbols.
65536 | Don't differentiate between Hiragana and Katakana characters.
131072 | Don't differentiate between a single-byte character and the same character as a double-byte character.


STRSAME Function

 Copy code hover
[image]

STRSAME Function
Send feedback

Published: July 16, 2012

Determines whether strings are the same. It returns TRUE if they are the same and FALSE if they aren't.

Syntax

STRSAME ("string1", "string2", ignoreCase)

Parameters

Name | Required/Optional | Data Type | Description
string1 | Required | String | The first string to compare.
string2 | Required | String | The second string to compare.
ignoreCase | Optional | Boolean | TRUE to ignore the case and FALSE to compare the case. The default is FALSE.

Return Value

Boolean

Remarks

To compare multi-byte strings or to do comparisons using case rules for a specific locale, use the STRSAMEEX function.

Example 1

STRSAME("cat","dog")

Returns FALSE.

Example 2

STRSAME("cat","cat")

Returns TRUE.

Example 3

STRSAME("cat","cat", TRUE)

Returns TRUE.

Example 4

STRSAME("cat","CAT")

Returns FALSE.

Example 5

STRSAME("cat","CAT", TRUE)

Returns TRUE.

Example 6

STRSAME("cät,"CAT", TRUE)

Returns FALSE.

Example 7

STRSAME("cät,"CÄT", TRUE)

Returns TRUE.


SUBJECT Function

 Copy code hover
[image]

SUBJECT Function
Send feedback

Published: July 16, 2012

Returns the text from the Subject field of a document's properties.

Syntax

SUBJECT ()

Return Value

String


SUBSTITUTE Function

 Copy code hover
[image]

SUBSTITUTE Function
Send feedback

Published: July 16, 2012

Replaces part of a text string with a different text string.

Syntax

SUBSTITUTE (text, old_text, new_text[, start_num][,ignore_case_opt)

Parameters

Name | Required/Optional | Data Type | Description
text | Required | String | The text or the reference to a cell containing text for which you want to substitute characters.
old_text | Required | String | The text you want to replace.
new_text | Required | String | The text you want to use to replace old_text.
start_num_opt | Optional | Numeric | Specifies which occurences of old_text to replace.
ignore_case_opt | Optional | Boolean | FALSE if case-sensitive; otherwise, TRUE. The default is FALSE.

Return Value

String

Remarks

If you specify start_num_opt, only that occurrence of old_text is replaced. Otherwise, every occurrence of old_text in text is changed to new_text.

Use the SUBSTITUTE function when you want to replace specific text in a text string. If you want to replace text that occurs in a specific location in a text string, use the REPLACE function.

Example

SUBSTITUTE ("1 January 2003", "January", "JAN")

Returns "1 JAN 2003".

SUBSTITUTE ("1 January 2003","january","JAN")

Returns "1 January 2003". No change is made because the text search is case-sensitive.


SUM Function

 Copy code hover
[image]

SUM Function
Send feedback

Published: July 16, 2012

Returns the sum of a list of numbers.

Syntax

SUM(number1,number2,...,[numberN])

Parameters

Name | Required/Optional | Data Type | Description
number1 | Required | Numeric | The first number.
number2 | Required | Numeric | The second number.
numberN | Optional | Numeric | The nth number.

Return Value

Numeric

Example

SUM(5,7,12)

Returns 24.


TANH Function

 Copy code hover
[image]

TANH Function
Send feedback

Published: July 16, 2012

Returns the hyperbolic tangent of an angle.

Syntax

TANH(angle)

Parameters

Name | Required/Optional | Data Type | Description
angle | Required | Numeric | The angle of which to get the hypbolic tangent.

Return Value

Numeric

Remarks

The TANH function uses radians unless you specify a different unit of measure in angle.

Example

TANH(-45)

Returns -0.6558.


TAN Function (VisioShapeSheet)

 Copy code hover
[image]

TAN Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the tangent of an angle.

Syntax

TAN(angle)

Parameters

Name | Required/Optional | Data Type | Description
angle | Required | Numeric | The angle of which to get the tangent.

Return Value

Numeric

Remarks

The TAN function uses radians unless you specify a different unit of measure in angle.

Example

TAN(45 deg)

Returns 1.


TEXTHEIGHT Function

 Copy code hover
[image]

TEXTHEIGHT Function
Send feedback

Published: July 16, 2012

Returns the height of the composed text in a shape where no text line exceeds maximumwidth.

Syntax

TEXTHEIGHT(shapename!TheText[,maximumwidth])

Parameters

Name | Required/Optional | Data Type | Description
shapename!theText | Required | String | A reference to the cell named TheText in the target shape. shapename! is the name of the shape from which you want to retrieve the text.
maximumwidth | Optional | Numeric | The maximum width of the text block.

Return Value

String

Remarks

The returned value includes the height of the text including the space before and after text, the line spacing in text, and the top and bottom text block margins. This function is commonly used to adjust the height of a shape to fit the text it contains.

Example

TEXTHEIGHT(TheText,(Width - 0.5 in))

Returns the height of the text when wrapped to the width of the shape minus 0.5 inches.


TEXTWIDTH Function

 Copy code hover
[image]

TEXTWIDTH Function
Send feedback

Published: July 16, 2012

Returns the width of the composed text in a shape.

Syntax

TEXTWIDTH(shapename!TheText[,maximumwidth])

Parameters

Name | Required/Optional | Data Type | Description
shapename!theText | Required | String | A reference to the cell named TheText in the target shape. shapename! is the name of the shape from which you want to retrieve the text.
maximumwidth | Optional | Numeric | The maximum width of the text block.

Return Value

String

Remarks

The TEXTWIDTH function is commonly used to adjust the width of a shape to fit the text it contains.

If sheetN! is omitted, the default shape is the current shape.

If maximumwidth is specified, the result is the longest line of text that fits within maximumwidth. If maximumwidth is omitted, the result is the total width of the text.

Example

TEXTWIDTH(TheText)

Returns the total length of the text in the current shape.


THEME Function

 Copy code hover
[image]

THEME Function
Send feedback

Published: July 16, 2012

Gets the current theme's format settings.

Syntax

THEME()

Example

Copy code Copy code
Shape.FillForegnd = THEME("FillColor")

Assigns the fill color of the current theme to the shape.


THEMECBV Function

 Copy code hover
[image]

THEMECBV Function
Send feedback

Published: July 16, 2012

Returns an RGB value or an integer that represents an index in the document's color palette, where the color (number) passed in as an argument has been modified by the specified tint or shade value stored in the gradient settings of the active theme.

Version Information

Version Added: Visio 2013

Syntax

THEMECBV(color, gradient_stop_number)

Parameters

Name | Required/Optional | Data Type | Description
color | Required | Number | A number representing an index in the document's color palette.
gradient_stop_number | Required | Number | The gradient stop (tint or shade) stored in the gradient settings of the active theme to apply to the color.

Return Value

Number

Remarks

Note Note

The THEMECBV function does nothing to the color passed in as an argument if the QuickStyle that is assigned to the shape does not have a gradient.

The gradient settings in a theme are a series of numbered gradient stops that correspond to a "lightening" (tint) or "darkening" (shade). These shades and tints are applied to a base color to create a gradient color effect.

The THEMECBV function takes a color input and outputs the color after it has been modified by the tint or shade of the specified gradient stop. The tints and shades come from the theme's definition, if the current quick style contains a gradient fill. If the active Quick Style does not specify a gradient fill or the shape is set to No Theme, then this formula simply returns the color that was passed in for the first argument.

Example

THEMECBV(FillForegnd, 5)

Returns the color created by applying the tint or shade in the fifth gradient stop of the gradient to the color specified in the FillForegnd cell.

THEMECBV(RGB(255,0,0), 2)

Returns a shade or tint of red created by applying the second gradient stop to a base color of red.


THEMEGUARD Function

 Copy code hover
[image]

THEMEGUARD Function
Send feedback

Published: July 16, 2012

Guards the formatting cells of a shape to ensure that they use appropriate aspects of the current theme.

Syntax

THEMEGUARD()

Remarks

Applying the THEMEGUARD function to a cell does not guard against manual formatting in the same way that applying the GUARD function does. If you apply formatting to the shape in the user interface or programmatically, by means of Automation, the THEMEGUARD formula is overridden, unless you include the SETATREFEXPR function in the formula to store the manual formatting value.

Example

Copy code Copy code
Shape.FillForegnd = THEMEGUARD(THEME("AccentColor2")

Specifies that the shape take the Accent 2 color from the current theme, rather than the main theme fill color.


THEMERESTORE Function

 Copy code hover
[image]

THEMERESTORE Function
Send feedback

Published: July 16, 2012

Stores the local formatting value of a shape when you apply a theme so that you can restore the local formatting if the user subsequently removes the theme.

Syntax

THEMERESTORE()

Example

Copy code Copy code
Shape.FillForegnd = THEME("FillColor") + THEMERESTORE(RGB(255,102,0)

Restores local fill color formatting previously applied to a shape when the current theme is removed.


THEMEVAL Function

 Copy code hover
[image]

THEMEVAL Function
Send feedback

Published: July 16, 2012

Retrieves values from the active theme.

Version Information

Version Added: Visio 2013

Syntax

THEMEVAL(["theme_value"][,default])

Parameters

Name | Required/Optional | Data Type | Description
"theme_value" | Optional | String | The name of a cell in the theme definition to get a value from.
default | Optional | Various | A default value if the document is not themed (there is no theme definition).

Remarks

If the THEMEVAL function does not receive any arguments, it returns the themed value of the host cell. This is the value stored in the definition of the current theme. The host cell must be capable of being themed to return a value; if the cell is not capable of being themed, THEMEVAL returns an error.

If the THEMEVAL function receives a single argument, it retrieves the value from the theme definition passed in as the argument. The argument passed in for the first parameter must be an integer or one of the exact strings listed in the table below.

The THEMEVAL function can also accept an integer for the first parameter, as a value between 1 and 8. Using integer values retrieves a color by index from the color scheme of the theme. Thus, a value of '1' will return the "Dark" color from the theme, '2' returns the "Light" color, '3' returns the "Accent 1" color, etc.

If the THEMEVAL function receives two arguments, it retrieves the value from the theme definition passed in as the first argument. However, if the document has No Theme applied to it, then the THEMEVAL function uses the value specified as the second argument.

Possible arguments for the "theme_value" parameter
Value | Description
"Dark" | Retrieves Dark RGB color from the theme definition.
"Light" | Retrieves Light RGB color from the theme definition.
"BackgroundColor" | Retrieves Background RGB color from the theme definition.
"AccentColor" | Retrieves Accent1 RGB color from the theme definition.
"AccentColor2" | Retrieves Accent2 RGB color from the theme definition.
"AccentColor3" | Retrieves Accent3 RGB color from the theme definition.
"AccentColor4" | Retrieves Accent4 RGB color from the theme definition.
"AccentColor5" | Retrieves Accent5 RGB color from the theme definition.
"AccentColor6" | Retrieves Accent6 RGB color from the theme definition.
"LinePattern" | Retrieves LinePattern cell value from the theme definition.
"LineWeight" | Retrieves LineWeight cell value from the theme definition.
"LineColor" | Retrieves LineColor cell value from the theme definition.
"LineCap" | Retrieves LineCap cell value from the theme definition.
"LineBegin" | Retrieves BeginArrow cell value from the theme definition.
"LineEnd" | Retrieves EndArrow cell value from the theme definition.
"LineColorTrans" | Retrieves LineColorTrans cell value from the theme definition.
"LineCompoundtype" | Retrieves CompoundType cell value from the theme definition.
"LineBegin" | Retrieves BeginArrow cell value from the theme definition.
"LineEnd" | Retrieves EndArrow cell value from the theme definition.
"LineBeginSize" | Retrieves BeginArrowSize cell value from the theme definition.
"LineEndSize" | Retrieves EndArrowSize cell value from the theme definition.
"LineRounding" | Retrieves Rounding cell value from the theme definition.
"ConnectorColor" | Retrieves LineColor cell value from the theme definition.
"ConnectorPattern" | Retrieves LinePattern cell value from the theme definition.
"ConnectorWeight" | Retrieves LineWeight cell value from the theme definition.
"ConnectorTransparency" | Retrieves LineColorTrans cell value from the theme definition.
"ConnectorRounding" | Retrieves Rounding cell value from the theme definition.
"ConnectorBegin" | Retrieves BeginArrow cell value from the theme definition.
"ConnectorEnd" | Retrieves EndArrow cell value from the theme definition.
"ConnectorBeginSize" | Retrieves BeginArrowSize cell value from the theme definition.
"ConnectorEndSize" | Retrieves EndArrowSize cell value from the theme definition.
"FillColor" | Retrieves FillForegnd cell value from the theme definition.
"FillColor2" | Retrieves FillBkgnd cell value from the theme definition.
"FillTransparency" | Retrieves FillForegndTrans cell value from the theme definition.
"FillPattern" | Retrieves FillPattern cell value from the theme definition.
"LineGradientEnabled" | Retrieves LineGradientEnabled cell value from the theme definition.
"LineGradientDir" | Retrieves LineGradientDir cell value from the theme definition.
"LineGradientAngle" | Retrieves LineGradientAngle cell value from the theme definition.
"FillGradientEnabled" | Retrieves FillGradientEnabled cell value from the theme definition.
"FillGradientDir" | Retrieves FillGradientDir cell value from the theme definition.
"FillGradientAngle" | Retrieves FillGradientAngle cell value from the theme definition.
"RotateGradientWithShape" | Retrieves RotateGradientWithShape cell value from the theme definition.
"UseGroupGradient" | Retrieves UseGroupGradient cell value from the theme definition.
"ShadowType" | Retrieves ShapeShdwType cell value from the theme definition.
"ShadowColor" | Retrieves ShdwColor cell value from the theme definition.
"ShadowTransparency" | Retrieves ShdwColorTrans cell value from the theme definition.
"ShadowMagnification" | Retrieves ShapeShdwScaleFactor cell value from the theme definition.
"ShadowBlur" | Retrieves ShapeShdwBlur cell value from the theme definition.
"ShadowXOffset" | Retrieves ShapeShdwOffsetX cell value from the theme definition.
"ShadowYOffset" | Retrieves ShapeShdwOffsetY cell value from the theme definition.
"ShadowDirection" | Retrieves ShapeShdwObliqueAngle cell value from the theme definition.
"ShadowPattern" | Retrieves ShdwPattern cell value from the theme definition.
"BevelTopType" | Retrieves BevelTopType cell value from the theme definition.
"BevelTopWidth" | Retrieves BevelTopWidth cell value from the theme definition.
"BevelTopHeight" | Retrieves BevelTopHeight cell value from the theme definition.
"BevelMaterial" | Retrieves BevelMaterialType cell value from the theme definition.
"BevelLighting" | Retrieves BevelLightingType cell value from the theme definition.
"BevelLightingAngle" | Retrieves BevelLightingAngle cell value from the theme definition.
"BevelContourColor" | Retrieves BevelContourColor cell value from the theme definition.
"BevelContourSize" | Retrieves BevelContourSize cell value from the theme definition.
"ReflectionBlur" | Retrieves ReflectionBlur cell value from the theme definition.
"ReflectionDist" | Retrieves ReflectionDist cell value from the theme definition.
"ReflectionSize" | Retrieves ReflectionSize cell value from the theme definition.
"ReflectionTrans" | Retrieves ReflectionTrans cell value from the theme definition.
"SoftEdgesSize" | Retrieves SoftEdgesSize cell value from the theme definition.
"GlowSize" | Retrieves GlowSize cell value from the theme definition.
"GlowColor" | Retrieves GlowColor cell value from the theme definition.
"GlowTransparency" | Retrieves GlowColorTrans cell value from the theme definition.
"SketchAmount" | Retrieves SketchAmount cell value from the theme definition.
"SketchEnabled" | Retrieves SketchEnabled cell value from the theme definition.
"SketchFillChange" | Retrieves SketchFillChange cell value from the theme definition.
"SketchLineChange" | Retrieves SketchLineChange cell value from the theme definition.
"SketchLineWeight" | Retrieves SketchLineWeight cell value from the theme definition.
"LatinFont" | Retrieves Font cell value from the theme definition.
"TextColor" | Retrieves Color cell value from the theme definition.
"TextStyle" | Retrieves the Character.Style cell value from the theme definition.
"ComplexFont" | Retrieves ComplexScriptFont cell value from the theme definition.
"AsianFont" | Retrieves AsianFont cell value from the theme definition.
"FillStop[x]Color" | Retrieves Color cell value in row x from the theme definition.
"FillStop[x]Transparency" | Retrieves ColorTrans cell value in row x from the theme definition.
"FillStop[x]Position" | Retrieves Position cell value in row x from the theme definition.
"LineStop[x]Color" | Retrieves Color cell value in row x from the theme definition.
"LineStop[x]Transparency" | Retrieves ColorTrans cell value in row x from the theme definition.
"LineStop[x]Position" | Retrieves Position cell value in row x from the theme definition.

Example

THEMEVAL("5")

Returns the "Accent 3" color from the theme definition.

THEMEVAL("LineWeight", "0.7 pt.")

Returns the value of the "LineWeight" cell from the theme definition. If the shape containing this function has No Theme applied to it, the function returns '0.7 pt.'.


TIMEVALUE Function (VisioShapeSheet)

 Copy code hover
[image]

TIMEVALUE Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the time value represented by datetime or expression, based on the system's Region and Language settings.

Syntax

TIMEVALUE("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | Any string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | Varies | Any expression that yields a date and time.
lcid | Optional | Number | The locale identifier to be used in evaluating a nonlocal datetime. The locale identifier is a number described in the system header files.

Remarks

Any date component in datetime or expression is discarded.

If datetime is missing or cannot be converted to a valid result, this function returns a #VALUE! error.

The TIMEVALUE function also accepts a single number value for expression where the decimal portion of the result represents the fraction of a day since midnight.

Example 1

TIMEVALUE("6:00 AM")

Returns the value representing 6:00 AM.

Example 2

TIMEVALUE("14:30")+4 eh.+30 em.

Returns the value representing 19:00:00.

Example 3

TIMEVALUE("11 AM, July 1, 1997")

Returns the value representing 11:00 AM.

Example 4

TIMEVALUE(0.6337)

Returns the value representing 15:12:32.

Example 5

TIMEVALUE("7:89")

Returns a #VALUE! error.


TIME Function (VisioShapeSheet)

 Copy code hover
[image]

TIME Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns the time represented by hour, minute, and second.

Syntax

TIME(hour,minute,second)

Parameters

Name | Required/Optional | Data Type | Description
hour | Required | Numeric | The hour component.
minute | Required | Numeric | The minute comonent.
second | Required | Numeric | The second component.

Return Value

Numeric

Example 1

TIME(15,30,30)

Returns the value representing 15:30:30.

Example 2

FORMAT(TIME(15,30,30),"HH:mm")

Returns the value representing 15:30.

Example 3

TIME(15,30,30) + 8 eh.

Returns the value representing 23:30:30.


TINT Function

 Copy code hover
[image]

TINT Function
Send feedback

Published: July 16, 2012

Modifies the color by increasing its luminosity by the amount (positive or negative) specified in the int parameter.

Syntax

TINT(color,int)

Parameters

Name | Required/Optional | Data Type | Description
color | Required | Numeric | The Microsoft Visio color index or RGB value of the color.
int | Required | Integer | The amount by which to increase the luminosity of the color. Can be positive or negative.

Return Value

RGB

Remarks

The upper and lower limits of luminosity are 0 and 240 respectively. There is no limit on the size of the integer you can pass for the int parameter, but luminosity never exceeds these limits.


TITLE Function

 Copy code hover
[image]

TITLE Function
Send feedback

Published: July 16, 2012

Returns the text from the Title field of a document's properties.

Syntax

TITLE ()

Return Value

String


TONE Function

 Copy code hover
[image]

TONE Function
Send feedback

Published: July 16, 2012

Modifies the color by decreasing its saturation by the amount specified in the int parameter.

Syntax

TONE(color,int)

Parameters

Name | Required/Optional | Data Type | Description
color | Required | Numeric | The Microsoft Visio color index or RGB value of the color.
int | Required | Integer | The amount by which to decrease the saturation of the color. Can be positive or negative.

Return Value

RGB

Remarks

The upper and lower limits of saturation are 0 and 240 respectively. There is no limit on the size of the integer you can pass for the int parameter, but saturation never exceeds these limits.


TRIM Function

 Copy code hover
[image]

TRIM Function
Send feedback

Published: July 16, 2012

Removes all space from text, except for single spaces between words.

Syntax

TRIM (text)

Parameters

Name | Required/Optional | Data Type | Description
text | Required | String | The text from which you want to remove spaces.

Return Value

String

Remarks

You can use the TRIM function on text that you have received from another application that may have irregular spacing.

Example

TRIM ("January 1, 2003 ")

Returns "January 1, 2003".


TRUNC Function

 Copy code hover
[image]

TRUNC Function
Send feedback

Published: July 16, 2012

Returns a number truncated to the specified number of digits.

Syntax

TRUNC(number,numberofdigits)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Numeric | The number to truncate.
numberofdigits | Required | Numeric | The number of digits to which to truncate number.

Return Value

Numeric.

Remarks

If numberofdigits is greater than 0, number is truncated to numberofdigits to the right of the decimal. If numberofdigits is 0, number is truncated to an integer. If numberofdigits is less than 0, number is truncated to numberofdigits to the left of the decimal.

Example 1

TRUNC(123.654,2)

Returns 123.65.

Example 2

TRUNC(123.654,0)

Returns 123.

Example 3

TRUNC(123.654,-1)

Returns 120.


TYPEDESC Function

 Copy code hover
[image]

TYPEDESC Function
Send feedback

Published: July 16, 2012

Returns a string that describes an object's internal type.

Syntax

TYPEDESC ()

Return Value

String

Remarks

The following table lists descriptive strings for internal objects.


TYPE Function

 Copy code hover
[image]

TYPE Function
Send feedback

Published: July 16, 2012

Returns an object's internal type as a number.

Syntax

TYPE ()

Return Value

Number

Remarks

The following table lists internal object types as numbers.

Object | Number
Page | 70
Group | 71
Shape | 72
Style | 74
Guide | 77
Foreign | 78
Document | 79


UNICHAR Function

 Copy code hover
[image]

UNICHAR Function
Send feedback

Published: July 16, 2012

Returns the Unicode character from a number.

Syntax

UNICHAR (number)

Parameters

Name | Required/Optional | Data Type | Description
number | Required | Integer | An integer between 1 and 65,535 (inclusive), or the function returns an error.

Remarks

The resulting string is one Unicode character (two characters) in length.

Example

UNICHAR(65)

Returns A (Latin Capital Letter A)


UPPER Function

 Copy code hover
[image]

UPPER Function
Send feedback

Published: July 16, 2012

Returns a string converted to uppercase.

Syntax

UPPER(expression)

Parameters

Name | Required/Optional | Data Type | Description
expression | Required | Varies | A string, a cell reference, or an expression; the result is converted to a string, which is then converted to uppercase.

Remarks

The case conversion is locale-specific, based on the current user settings.

Example

UPPER("mIxEd CAse")

Returns "MIXED CASE".


USERUI Function

 Copy code hover
[image]

USERUI Function
Send feedback

Published: July 16, 2012

Evaluates one of the two expressions depending on the value of state.

Syntax

USERUI(state,defaultexpression,userexpression)

Parameters

Name | Required/Optional | Data Type | Description
state | Required | Boolean | Determines which expression to evaluate.
defaultexpression | Required | String | The default expression.
userexpression | Required | String | An expression supplied by the user.

Remarks

If state is 0, the USERUI function evaluates the defaultexpression. If state is 1, it evaluates the userexpression.

Example

USERUI(1, if(Width>6in, 6in, Width), Width*0.75)

Evaluates the expression Width*.075 and returns the result.


USE Function

 Copy code hover
[image]

USE Function
Send feedback

Published: July 16, 2012

Applies the line pattern, fill pattern, or line end called name to the shape when placed in the LinePattern, FillPattern, BeginArrow, or EndArrow cell.

Syntax

USE("name")

Parameters

Name | Required/Optional | Data Type | Description
name | Required | String | Any string that is a valid master name.

Return Value

Number

Remarks

If a master named name is present on the document stencil of the document, the pattern is applied as a line pattern, fill pattern, begin arrow, or end arrow.

This function always returns 254.

Example

USE("Railroad Tracks")

Formats the shape by applying the master pattern named Railroad Tracks to the shape containing the formula.


VERSION Function

 Copy code hover
[image]

VERSION Function
Send feedback

Published: July 16, 2012

Returns an integer that matches the major version of the currently active Microsoft Visio application.

Version Information

Version Added: Visio 2010

Syntax

VERSION()

Return Value

Integer

Remarks

You can use the VERSION function to write ShapeSheet formulas that are evaluated differently depending on the version of Visio in which they are evaluated.


WEEKDAY Function (VisioShapeSheet)

 Copy code hover
[image]

WEEKDAY Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns an integer, 1 to 7, representing the weekday in datetime or expression.

Syntax

WEEKDAY("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | Any string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | Varies | Any expression that yields a date and time.
lcid | Optional | Numeric | The locale identifier to be used in evaluating a nonlocal datetime. The locale identifier is a number described in the system header files.

Return Value

Integer

Remarks

The time component in datetime or expression is discarded.

The result corresponds to Monday (1) through Sunday (7). No rounding is done. If datetime is missing or cannot be interpreted as a valid date or time, the function returns a #VALUE! error.

The WEEKDAY function also accepts a single number value for expression where the integer portion of the result represents the number of days since December 30, 1899.

Example 1

WEEKDAY("May 30, 1999")

Returns 7.

Example 2

WEEKDAY(DATEVALUE("May 30, 1999")+2 ed.)

Returns 2.

Example 3

WEEKDAY(35880.6337)

Returns 4.


YEAR Function (VisioShapeSheet)

 Copy code hover
[image]

YEAR Function (VisioShapeSheet)
Send feedback

Published: July 16, 2012

Returns an integer that represents the Gregorian year in datetime or expression, formatted according to the short date style set by the system's current Region and Language settings.

Syntax

YEAR("datetime"|expression[,lcid])

Parameters

Name | Required/Optional | Data Type | Description
datetime | Required | String | Any string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression | Required | Varies | Any expression that yields a date and time.
lcid | Optional | Numeric | The locale identifier to be used in evaluating a nonlocal datetime. The locale identifier is a number described in the system header files.

Return Value

Integer

Remarks

The time component in datetime or expression is discarded.

No rounding is done. If datetime is missing or cannot be interpreted as a valid date or time, YEAR returns an error.

The YEAR function also accepts a single number value for expression where the integer portion of the result represents the number of days since December 30, 1899.

Example 1

YEAR("10/27/2007 13:45:24")

Returns 2007.

Example 2

YEAR(DATEVALUE("Dec. 25, 2006") + 7 ed.)

Returns 2007.

Example 3

YEAR(35580.6337)

Returns 1997.


Rows (Visio 2013 ShapeSheet Reference)

 Copy code hover
[image]

Rows (Visio 2013 ShapeSheet Reference)
Send feedback

Published: July 16, 2012

In this section

  • Actions Row (Actions Section)

  • ArcTo Row (Geometry Section)

  • Connection Points Row (Connection Points Section)

  • Controls Row (Controls Section)

  • Ellipse Row (Geometry Section)

  • EllipticalArcTo Row (Geometry Section)

  • Gradient Stop Row (Fill Gradient Section)

  • Gradient Stop Row (Line Gradient Section)

  • Hyperlink Row (Hyperlinks Section)

  • InfiniteLine Row (Geometry Section)

  • LineTo Row (Geometry Section)

  • MoveTo Row (Geometry Section)

  • NURBSTo Row (Geometry Section)

  • PolylineTo Row (Geometry Section)

  • RelCubBezTo Row (Geometry Section)

  • RelEllipticalArcTo Row (Geometry Section)

  • RelLineTo Row (Geometry Section)

  • RelMoveTo Row (Geometry Section)

  • RelQuadBezTo Row (Geometry Section)

  • Shape Data Row (Shape Data Section)

  • Smart Tags Row (Action Tags Section)

  • SplineKnot Row (Geometry Section)

  • SplineStart Row (Geometry Section)

  • User-defined Cells Row (User-defined Cells Section)


Actions Row (Actions Section)

 Copy code hover
[image]

Actions Row (Actions Section)
Send feedback

Published: July 16, 2012

Contains cells that specify the actions associated with a custom command on a shortcut or action tag menu. The Actions section contains one Actions row for each action.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Actions rows are named Actions.name and contain the following cells. For more details, see the specific cell topics.

Cell | Description
Action | Contains the formula to be executed when a user chooses an item on a shortcut or action tag menu.
Menu | Defines the name of the menu item that appears on a action tag or shortcut menu.
TagName | The logical name of the action tag in which this action should appear.
ButtonFace | Identifies the icon that appears next to an item on a shortcut or action tag menu.
SortKey | A number that determines the order of menu items on a action tag or shortcut menu.
Checked | Indicates whether the menu item is checked on a action tag or shortcut menu.
Disabled | Indicates whether a menu item on a shortcut or action tag menu is disabled.
ReadOnly | Indicates whether the menu item is read-only (cannot be clicked).
Invisible | Indicates whether the menu item is visible on the action tag or shortcut menu.
BeginGroup | Indicates whether to insert a separator into the menu, above the menu item.

Remarks

You can add as many Actions.name rows as you need, assign meaningful names to the rows, and set cell values. To add a custom command to an existing Actions section, right-click a row and click Insert Row on the shortcut menu.

You can reference these cells by their row name, which appears in a ShapeSheet window in red text. To assign a meaningful name to an Actions.name row, click the row, and then type a name such as Custom, for example, to create the row name Actions.Custom. You can then reference the Menu cell by using Actions.Custom.Menu.

The row name you enter must be unique within the section.


ArcTo Row (Geometry Section)

 Copy code hover
[image]

ArcTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains the x- and y-coordinates and bow of a circular arc.

An ArcTo row contains the following cells.

Cell | Description
X | The x-coordinate of the ending vertex of an arc.
Y | The y-coordinate of the ending vertex of an arc.
A | The distance from the arc's midpoint to the midpoint of its chord.

Remarks

Arcs drawn in Visio are elliptical arcs, even if they are based on a circle. By default, drawn arcs are represented by an EllipticalArcTo row in a ShapeSheet window. To show an ArcTo row in a ShapeSheet window, you must draw an arc, and then change the EllipticalArcTo row type to an ArcTo row type; in effect you are changing an elliptical arc to a circular arc.

To change a row type, right-click a row, and then click Change Row Type on the shortcut menu.


Connection Points Row (Connection Points Section)

 Copy code hover
[image]

Connection Points Row (Connection Points Section)
Send feedback

Contains the x- and y-coordinates, horizontal and vertical direction, and type for a single connection point on a shape. Coordinates of connection points are measured from the origin of the shape. A shape contains one Connection Points row for each connection point.

If Connection Points rows are named, those names appear as Connections.name in the ShapeSheet window. Connection Points rows contain the following cells. For more details, see the specific cell topics.

Cell | Description
X | The x-coordinate for a connection point in local coordinates.
Y | The y-coordinate for a connection point in local coordinates.
DirX/A | The x-component for the required alignment vector of a matching connection point. It is also used to orient the attached leg of a dynamic connector. This cell takes a floating point value.
DirY/B | The y-component for the required alignment vector of a matching connection point. It is also used to orient the attached leg of a dynamic connector. This cell takes a floating point value.
Type/C | The connection point type (0 = inward; 1 = outward; 2 = inward + outward).
D | A scratch cell that you can use for entering or testing formulas. To access this cell, right-click a row, and then click Change Row Type on the shortcut menu.

Remarks

Cells in the Connections.name row are labeled DirX/A, DirY/B, and Type/C because these rows can be extended or non-extended rows.

Most connection points (all connection points created through the user interface) are non-extended and have DirX, DirY, and Type cells. Their row type is visTagCnnctPt or visTagCnnctNamed.

In non-extended rows the DirX and DirY cells together define a direction vector that influences the rotation of shapes involved in connections using the connection point. If both are zero the point is directionless. Connection points are of the following types:

  • Inward (0), which means that shapes glue to them. This is the default.

  • Outward (1), which means these connection points will glue to inward connection points.

  • Both inward and outward (2), in which case the direction is the inward direction, which is reversed if used as an outward connection.

Extended rows have A, B, C, and D cells and behave like directionless non-extended rows of type Inward. Extended rows are not commonly used, but you might use them to associate data with a connection point in the A, B, C, and D cells. Their row type is visTagCnnctPtABCD or visTagCnnctNamedABCD. Extended rows can be identified by the presence of a formula in the D cell.

You can add as many Connections.name rows as you need, assign meaningful names to the rows, and set cell values. To add a connection point to an existing Connection Points section, right-click a row and click Insert Row on the shortcut menu.

You can reference Connection Points row cells by their row name, which appears in a ShapeSheet window in red text. To change the row name, click it, and then type a name such as Custom, for example, to create the row name Connections.Custom. You can then reference the X cell using Connections.Custom.X, for example, or Connections.X1 if you want to use the row number.

The row name you enter must be unique within the section. When you create a name for one row in the Connection Points section, Microsoft Office Visio names all the rows in the section with the default name, Connections.Row_n.

Named Connection Points rows are not compatible with versions of Visio earlier than 5.0. When saving a Visio drawing file with named Connection Points rows to an earlier format, references to named Connection Points rows are converted to indexed references, and the row names are lost.


Controls Row (Controls Section)

 Copy code hover
[image]

Controls Row (Controls Section)
Send feedback

Published: July 16, 2012

Contains cells that define the x- and y-coordinates and behavior of each control handle defined for a shape. A shape will contain one Controls row for each control handle.

Controls rows are named Controls.name and contain the following cells. For more details, see the specific cell topics.

Cell | Description
x | Represents the x-coordinate that indicates the location of a shape's control handle in local coordinates.
y | Represents the y-coordinate that indicates the location of a shape's control handle in local coordinates.
X Dynamics | Represents the x-coordinate for a control handle's anchor point in local coordinates.
Y Dynamics | Represents the y-coordinate for a control handle's anchor point in local coordinates.
X Behavior | Controls the type of behavior the x-coordinate of the control handle will exhibit after the handle is moved.
Y Behavior | Controls the type of behavior the y-coordinate of the control handle will exhibit after the handle is moved.
Can Glue | Determines whether a control handle can be glued to other shapes.
Tip | Represents a descriptive text string that appears as a ToolTip when a user pauses the pointer over a shape's control handle.

Remarks

You can add as many Controls.name rows as you need, assign meaningful names to the rows, and set cell values. To add control handles to an existing Controls section, right-click a row and click Insert Row on the shortcut menu.

You can reference these cells by their row name, which appears in a ShapeSheet window in red text. To assign meaningful names to Controls.name rows, click the row and then type Custom, for example, to create the row name Controls.Custom. You can then reference the X cell using Controls.Custom.X.

The row name you enter must be unique within the section.


Ellipse Row (Geometry Section)

 Copy code hover
[image]

Ellipse Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains the x- and y-coordinates of the ellipse's center point and two points on the ellipse.

An Ellipse row contains the following cells.

Cell | Description
X | The x-coordinate of the center point.
Y | The y-coordinate of the center point.
A | The x-coordinate of one point on the ellipse; paired with y-coordinate represented by the B cell.
B | The y-coordinate of one point on the ellipse; paired with x-coordinate represented by the A cell.
C | The x-coordinate of another point on the ellipse; paired with y-coordinate represented by the D cell.
D | The y-coordinate of another point on the ellipse; paired with y-coordinate represented by the C cell.

Remarks

A geometry section that contains an Ellipse or an InfiniteLine row should not contain any other rows.


EllipticalArcTo Row (Geometry Section)

 Copy code hover
[image]

EllipticalArcTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains x- and y-coordinates of an elliptical arc's endpoint, x- and y-coordinates of the control points on the arc, angle from the x-axis to the ellipse's major axis, and ratio between the ellipse's major and minor axes.

An EllipticalArcTo row contains the following cells.

Cell | Description
X | The x-coordinate of the ending vertex on an arc.
Y | The y-coordinate of the ending vertex on an arc.
A | The x-coordinate of the arc's control point; a point on the arc. The control point is best located about halfway between the beginning and ending vertices of the arc. Otherwise, the arc may grow to an extreme size in order to pass through the control point, with unpredictable results.
B | The y-coordinate of an arc's control point.
C | The angle of an arc's major axis relative to the x-axis of its parent.
D | The ratio of an arc's major axis to its minor axis. Despite the usual meaning of these words, the "major" axis does not have to be greater than the "minor" axis, so this ratio does not have to be greater than 1. Setting this cell to a value less than or equal to 0 or greater than 1000 can lead to unpredictable results.


Gradient Stop Row (Fill Gradient Section)

 Copy code hover
[image]

Gradient Stop Row (Fill Gradient Section)
Send feedback

Published: July 16, 2012

Contains the color, transparency, and position of a gradient stop for a fill gradient.

A Gradient Stop row contains the following cells.

Cell | Description
Color | The color value of the gradient stop. This value can be expressed as the index number of a color in the document palette or by using the RGB, THEMEVAL, or HSL functions (for example).
ColorTrans | The amount of transparency of the gradient color, as a percentage.
Position | The position of the gradient stop along the direction of the fill gradient, as a percentage from the point of origin of the gradient to the edge of the area of the fill.


Gradient Stop Row (Line Gradient Section)

 Copy code hover
[image]

Gradient Stop Row (Line Gradient Section)
Send feedback

Published: July 16, 2012

Contains the color, transparency, and position of a gradient stop for a line gradient.

A Gradient Stop row contains the following cells.

Cell | Description
Color | The color value of the gradient stop. This value can be expressed as the index number of a color in the document palette or by using the RGB, THEMEVAL, or HSL functions (for example).
ColorTrans | The amount of transparency of the gradient color, as a percentage.
Position | The position of the gradient stop along the direction of the line gradient, as a percentage from the point of origin of the gradient to the outer edge of the line.


Hyperlink Row (Hyperlinks Section)

 Copy code hover
[image]

Hyperlink Row (Hyperlinks Section)
Send feedback

Published: July 16, 2012

Contains the information for a single hyperlink associated with a shape. A shape will contain one Hyperlink row for each hyperlink.

Hyperlink rows are named Hyperlink.name and contain the following cells. For more details, see the specific cell topics.

Cell | Description
Description | A descriptive text string for a hyperlink.
Address | A URL address, MS-DOS file name, or UNC path to which to jump.
SubAddress | A location within the target document to link to.
ExtraInfo | A string that passes information to be used in resolving a URL.
Frame | The name of a frame to target when Microsoft Office Visio is open as an Active document in an ActiveX container. The default is an empty string.
SortKey | Determines the order of hyperlinks as they appear on the shortcut menu.
NewWindow | Specifies whether to open the hyperlink in a new window. If TRUE, opens the linked page, document, or Web site in a new window. The default is FALSE.
Default | The default hyperlink for a shape or page.
Invisible | Indicates whether the hyperlink appears on the shortcut menu.

Remarks

You can add as many Hyperlink.name rows as you need, assign meaningful names to the rows, and set cell values. To add hyperlinks to an existing Hyperlinks section, right-click a row and click Insert Row on the shortcut menu.

You can reference these cells by their row name, which appears in a ShapeSheet window in red text. To assign meaningful names to Hyperlink.name rows, click the row, and then type a name such as Marketing, for example, to create the row name Hyperlink.Marketing. You can then reference the Description cell using Hyperlink.Marketing.Description.

The row name you enter must be unique within the section.


InfiniteLine Row (Geometry Section)

 Copy code hover
[image]

InfiniteLine Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains the x- and y-coordinates of two points on an infinite line.

An InfiniteLine row contains the following cells.

Cell | Description
X | An x-coordinate of a point on the infinite line; paired with y-coordinate represented by the Y cell.
Y | A y-coordinate of a point on the infinite line; paired with x-coordinate represented by the X cell.
A | An x-coordinate of a point on the infinite line; paired with y-coordinate represented by the B cell.
B | A y-coordinate of a point on an infinite line; paired with x-coordinate represented by the A cell.

Remarks

A geometry section that contains an Ellipse or InfiniteLine row should not contain any other rows.


LineTo Row (Geometry Section)

 Copy code hover
[image]

LineTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains x-and y-coordinates of the ending vertex of a straight line segment.

A LineTo row contains the following cells.

Cell | Description
X | The x-coordinate of the ending vertex of a straight line segment.
Y | The y-coordinate of the ending vertex of a straight line segment.


MoveTo Row (Geometry Section)

 Copy code hover
[image]

MoveTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains the x- and y-coordinates of the first vertex of a shape, or represents the x- and y-coordinates of the first vertex after a break in a path.

A MoveTo row contains the following cells.

Cell | Description
X | If the MoveTo row is the first row in the section, the X cell represents the x-coordinate of the first vertex of a shape. If the MoveTo row appears between two rows, the X cell represents the x-coordinate of the first vertex after the break in the path.
Y | If the MoveTo row is the first row in the section, the Y cell represents the y-coordinate of the first vertex of a shape. If the MoveTo row appears between two rows, the Y cell represents the y-coordinate of the first vertex after the break in the path.

Remarks

The MoveTo row contains the x- and y-coordinates of the first vertex for the shape if the MoveTo row is the first row in the section. Usually this is the first vertex placed when the shape was drawn, and it does not necessarily correspond to the begin point of a 1-D shape.

A geometry section must begin with either a RelMoveTo or a MoveTo row, but you can also use the MoveTo and RelMoveTo rows to represent a gap in the stroking of a shape's path. However, when the path is used to define the boundary of a filled region, this gap is interpreted as a straight line segment. To insert such a gap, insert a row between two rows and change the row type to MoveTo. If the MoveTo row is between two rows, it contains the x- and y-coordinates of the first vertex of the line after the break in the shape's path.


NURBSTo Row (Geometry Section)

 Copy code hover
[image]

NURBSTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains the x- and y-coordinates, position of the second to last knot, position of the last weight, position of the first knot, position of the first weight, and the formula for a nonuniform rational B-spline (NURBS).

A NURBSTo row contains the following cells.

Cell | Description
X | The x-coordinate of the last control point of a NURBS.
Y | The y-coordinate of the last control point of a NURBS.
A | The second to the last knot of the NURBS.
B | The last weight of the NURBS.
C | The first knot of the NURBS.
D | The first weight of the NURBS.
E | A NURBS formula.

Remarks

NURBS is a common way to represent a curve mathematically. You can create a NURBS with the Freeform tool.


PolylineTo Row (Geometry Section)

 Copy code hover
[image]

PolylineTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains x- and y-coordinates of the last point of a polyline and a polyline formula.

A PolylineTo row contains the following cells.

Cell | Description
X | The x-coordinate of the ending vertex of a polyline.
Y | The y-coordinate of the ending vertex of a polyline.
A | The polyline formula.

Remarks

Lines represented as a Polyline row are equivalent to lines represented as a sequence of LineTo rows, but a Polyline row is more efficient. You can change a PolylineTo row to a LineTo row so you can easily see the shape geometry. To do this, right-click the PolylineTo row, and then click Expand Row on the shortcut menu.

To change a row type to a PolylineTo row, right-click the row, and then click Change Row Type on the shortcut menu.


RelCubBezTo Row (Geometry Section)

 Copy code hover
[image]

RelCubBezTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains the x- and y-coordinates of the endpoint of a cubic Bézier curve relative to the shape's width and height, the x- and y-coordinates of the control point of the beginning of the curve relative shape's width and height, and the x- and y-coordinates of the control point of the ending of the curve relative shape's width and height.

Note Note

A RelCubBezTo row can only be persisted in the .vsdx, .vsdm, .vstx, .vstm, .vssx, and .vssm file formats. When a file is saved to the Visio 2003-2010 formats, the RelCubBezTo row is converted to a NURBSTo row.

A RelCubBezTo row contains the following cells.

Cell | Description
X | The x-coordinate of the ending vertex of a cubic Bézier curve relative to the width of the shape.
Y | The y-coordinate of the ending vertex of a cubic Bézier curve relative to the height of the shape.
A | The x-coordinate of the curve's beginning control point relative to the shape's width; a point on the arc. The control point is best located between the beginning and ending vertices of the arc.
B | The y-coordinate of a curve's beginning control point relative to the shape's height.
C | The x-coordinate of the curve's ending control point relative to the shape's width; a point on the arc. The control point is best located between the beginning control point and ending vertices of the arc.
D | The y-coordinate of a curve's ending control point relative to the shape's height.


RelEllipticalArcTo Row (Geometry Section)

 Copy code hover
[image]

RelEllipticalArcTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains x- and y-coordinates of an elliptical arc's endpoint relative to the shape's width and height, x- and y-coordinates of the control points on the arc relative to the shape's width and height, angle from the x-axis to the ellipse's major axis, and ratio between the ellipse's major and minor axes.

Note Note

A RelEllipticalArcTo row can only be persisted in the .vsdx, .vsdm, .vstx, .vstm, .vssx, and .vssm file formats. When a file is saved to the Visio 2003-2010 formats, the RelEllipticalArcTo row is converted to an EllipticalArcTo row.

A RelEllipticalArcTo row contains the following cells.

Cell | Description
X | The x-coordinate of the ending vertex on an arc relative to the width of the shape.
Y | The y-coordinate of the ending vertex on an arc relative to the height of the shape.
A | The x-coordinate of the arc's control point relative to the shape's width; a point on the arc. The control point is best located about halfway between the beginning and ending vertices of the arc. Otherwise, the arc may grow to an extreme size in order to pass through the control point, with unpredictable results.
B | The y-coordinate of an arc's control point relative to the shape's width.
C | The angle of an arc's major axis relative to the x-axis of its parent.
D | The ratio of an arc's major axis to its minor axis. Despite the usual meaning of these words, the "major" axis does not have to be greater than the "minor" axis, so this ratio does not have to be greater than 1. Setting this cell to a value less than or equal to 0 or greater than 1000 can lead to unpredictable results.

Remarks

Values in the RelEllipticalArcTo row are equivalent to values in an EllipticalArcTo row, multiplied by the width and height of the shape. For example: a RelEllipticalArcTo row where the X, Y, A, B, C, and D cells have the values 1, 1, 1.5, 0.5, 15 deg, and 1.5 (respectively) can be replaced with an EllipticalArcTo row with the cell formulas Width*1, Height*1', Width*1.5, Height*0.5, 15 deg, and 1.5 (respectively).


RelLineTo Row (Geometry Section)

 Copy code hover
[image]

RelLineTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains x-and y-coordinates of the ending vertex of a straight line segment relative to a shape's width and height.

Note Note

A RelLineTo row can only be persisted in the .vsdx, .vsdm, .vstx, .vstm, .vssx, and .vssm file formats. When a file is saved to the Visio 2003-2010 formats, the RelLineTo row is converted to a LineTo row.

A RelLineTo row contains the following cells.

Cell | Description
X | The x-coordinate of the ending vertex of a straight line segment relative to the shape's width.
Y | The y-coordinate of the ending vertex of a straight line segment relative to the shape's height.

Remarks

Values in the RelLineTo row are equivalent to values in a LineTo row that are multiplied by the width and height of the shape. For example: a RelLineTo row where the value of the X cell is "0" and the value of the Y cell is "0.5" can be replaced with LineTo row where the value of the X cell is the formula "Width*0" and the Y cell is the formula "Height*0.5."


RelMoveTo Row (Geometry Section)

 Copy code hover
[image]

RelMoveTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains the x- and y-coordinates of the first vertex of a shape or the x- and y-coordinates of the first vertex after a break in a path, relative to the height and width of the shape.

Note Note

A RelMoveTo row can only be persisted in the .vsdx, .vsdm, .vstx, .vstm, .vssx, and .vssm file formats. When a file is saved to the Visio 2003-2010 formats, the RelMoveTo row is converted to a MoveTo row.

A RelMoveTo row contains the following cells.

Cell | Description
X | If the RelMoveTo row is the first row in the section, the X cell represents the x-coordinate of the first vertex of a shape relative to the width of the shape. If the RelMoveTo row appears between two rows, the X cell represents the x-coordinate of the first vertex after the break in the path.
Y | If the RelMoveTo row is the first row in the section, the Y cell represents the y-coordinate of the first vertex of a shape. If the RelMoveTo row appears between two rows, the Y cell represents the y-coordinate of the first vertex after the break in the path.

Remarks

Values in the RelMoveTo row are equivalent to values in a MoveTo row that are multiplied by the width and height of the shape. For example: a RelMoveTo row where the value of the X cell is "0" and the value of the Y cell is "0.5" could be replaced with MoveTo row where the value of the X cell is the formula "Width*0" and the Y cell is the formula "Height*0.5."

The RelMoveTo row contains the x- and y-coordinates of the first vertex for the shape if the MoveTo row is the first row in the section. Usually this is the first vertex placed when the shape was drawn, and it does not necessarily correspond to the begin point of a 1-D shape.

A Geometry section must begin with a MoveTo or a RelMoveTo row, but you can also use the RelMoveTo row and MoveTo row to represent a gap in the stroking of a shape's path relative to the shape's width and height. However, when the path is used to define the boundary of a filled region, this gap is interpreted as a straight line segment. To insert such a gap, insert a row between two rows and change the row type to RelMoveTo. If the RelMoveTo row is between two rows, it contains the x- and y-coordinates of the first vertex of the line after the break in the shape's path.


RelQuadBezTo Row (Geometry Section)

 Copy code hover
[image]

RelQuadBezTo Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains the x- and y-coordinates of the endpoint of a quadratic Bézier curve relative to the shape's width and height and the x- and y-coordinates of the control point of the curve relative shape's width and height.

Note Note

A RelQuadBezTo row can only be persisted in the .vsdx, .vsdm, .vstx, .vstm, .vssx, and .vssm file formats. When a file is saved to the Visio 2003-2010 formats, the RelQuadBezTo row is converted to a NURBSTo row.

A RelQuadBezTo row contains the following cells.

Cell | Description
X | The x-coordinate of the ending vertex of a quadratic Bézier curve relative to the width of the shape.
Y | The y-coordinate of the ending vertex of a quadratic Bézier curve relative to the height of the shape.
A | The x-coordinate of the curve's control point relative to the shape's width; a point on the arc. The control point is best located about halfway between the beginning and ending vertices of the arc.
B | The y-coordinate of a curve's control point relative to the shape's height.


Shape Data Row (Shape Data Section)

 Copy code hover
[image]

Shape Data Row (Shape Data Section)
Send feedback

Published: July 16, 2012

Contains the information for a single shape data item associated with a shape. A shape contains one Shape Data row for each shape data item.Shape Data rows are named Prop.name and contain the following cells. For more details, see the specific cell topics.

Cell | Description
Label | Specifies the label that appears to users in the Shape Data dialog box or window.
Prompt | Specifies descriptive or instructional text that appears to users in the Shape Data dialog box or window when the item is selected.
Type | Specifies a data type for the shape data item value: string (0), a fixed list (1), a number (2), a Boolean value (3), a variable list (4), a date or time (5), a duration (6), or a currency (7).
Format | Specifies the formatting of a shape data item.
Value | Contains the item's value as entered in the Shape Data dialog box or window.
SortKey | Specifies a key by which items in the Shape Data dialog box or window are listed.
Invisible | Specifies whether the shape data item is visible in the Shape Data dialog box or window. TRUE = not visible; FALSE = visible.
Ask | Determines whether a user is queried to enter shape data information for a shape when an instance is created or the shape is duplicated or copied.
LangID | Specifies the language in which to display the shape data item value.
Calendar | Specifies the type of calendar used when the Type of a shape data item is Date.

Remarks

You can add as many Prop.name rows as you need, assign meaningful names to the rows, and set cell values. To add a shape data item to an existing Shape Data section, right-click a row and click Insert Row on the shortcut menu.

You can reference these cells by their row name, which appears in a ShapeSheet window in red text. To assign meaningful names to Prop.name rows, click the row, and then type a name such as Price, for example, to create the row name Prop.Price. You can then reference the Label cell by using Prop.Price.Label.

The row name you enter must be unique within the section.


Smart Tags Row (Action Tags Section)

 Copy code hover
[image]

Smart Tags Row (Action Tags Section)
Send feedback

Published: July 16, 2012

Contains the information for a single action tag associated with a shape or page. A shape or page contains one Smart Tags row for each action tag.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Smart Tags rows are named SmartTags.name and contain the following cells. For more details, see the specific cell topics.

Cell | Description
X | The x-coordinate position of a point in the shape's local coordinates around which the action tag button is placed.
Y | The y-coordinate position of a point in the shape's local coordinates around which the action tag button is placed.
TagName | The logical name of the action tag.
X Justify | The x-offset of the action tag button relative to the point defined by the X and Y cells.
Y Justify | The y-offset of the action tag button relative to the point defined by the X and Y cells.
DisplayMode | Determines when the action tag will appear.
ButtonFace | The ID of the image that appears on the face of the action tag button.
Description | Descriptive string for the action tag.
Disabled | Indicates whether the action tag is disabled.

Remarks

You can add as many SmartTags.name rows as you need, assign meaningful names to the rows, and set cell values. To add an action tag to an existing Smart Tags section, right-click a row and click Insert Row on the shortcut menu.

You can reference these cells by their row name, which appears in a ShapeSheet window in red text. To assign meaningful names to Smart Tags.name rows, click the row, and then type a name such as Size, for example, to create the row name Smart Tags.Size. You can then reference the Description cell using Smart Tags.Size.Description.

The row name you enter must be unique within the section.


SplineKnot Row (Geometry Section)

 Copy code hover
[image]

SplineKnot Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains x- and y-coordinates for a spline's control point and a spline's knot.

A SplineKnot row contains the following cells.

Cell | Description
X | The x-coordinate of a control point.
Y | The y-coordinate of a control point.
A | One of the spline's knots (other than the last one or the first two).

Remarks

Visio displays the definition of a spline in a Geometry section that contains a SplineStart row followed by one or more SplineKnot rows. The SplineStart row must be preceded by another kind of row, such as a MoveTo row, to indicate the first control point of the spline. The preceding row can be a LineTo, ArcTo, NURBSTo, PolylineTo, or EllipticalArcTo row if the spline follows a segment of that type.


SplineStart Row (Geometry Section)

 Copy code hover
[image]

SplineStart Row (Geometry Section)
Send feedback

Published: July 16, 2012

Contains x- and y-coordinates for a spline's second control point, its second knot, its first knot, the last knot, and the degree of the spline.

A SplineStart row contains the following cells.

Cell | Description
X | The x-coordinate of a spline's second control point.
Y | The y-coordinate of a spline's second control point.
A | The second knot of the spline.
B | The first knot of a spline.
C | The last knot of a spline.
D | The degree of a spline (an integer from 1 to 25).

Remarks

Visio displays the definition of a spline in a Geometry section that contains a SplineStart row followed by one or more SplineKnot rows. The SplineStart row must be preceded by another kind of row, such as a MoveTo row, to indicate the first control point of the spline. The preceding row can be a LineTo, ArcTo, NURBSTo, PolylineTo, or EllipticalArcTo row if the spline follows a segment of that type.


User-defined Cells Row (User-defined Cells Section)

 Copy code hover
[image]

User-defined Cells Row (User-defined Cells Section)
Send feedback

Published: July 16, 2012

Contains the value and descriptive prompt for any user-defined cells in your solution. A shape contains one User-defined Cells row for each user-defined Value/Prompt cell pair.

User-defined Cells rows are named User.name and contain the following cells. For more details, see the specific cell topics.

Cell | Description
Value | Specifies a value for the corresponding user-defined cell.
Prompt | Specifies a descriptive prompt or comment for the user-defined cell.

Remarks

User-defined cells can be used for entering formulas or constants that are referred to by other cells or add-ons. Values in user-defined cells are portable, that is, if a shape that refers to a user-defined cell in one shape is copied to another shape that does not have the same user-defined cell, the cell is added to the shape.

You can add as many User.name rows as you need, assign meaningful names to the rows, and set cell values. To add a row to an existing User-defined Cells section, right-click a row and click Insert Row on the shortcut menu.

You can reference these cells by their row name, which appears in a ShapeSheet window in red text. To assign meaningful names to User.name rows, click the row, and then type a name such as Offset, for example, to create the row name User.Offset. You can then reference the Prompt cell using User.Offset.Prompt.

The row name you enter must be unique within the section.


Sections (Visio 2013 ShapeSheet Reference)

 Copy code hover
[image]

Sections (Visio 2013 ShapeSheet Reference)
Send feedback

Published: July 16, 2012

In this section

  • 1-D Endpoints Section

  • 3-D Rotation Properties Section

  • Action Tag Section

  • Actions Section

  • Additional Effect Properties Section

  • Alignment Section

  • Annotation Section

  • Bevel Properties Section

  • Change Shape Behavior Section

  • Character Section

  • Connection Points Section

  • Controls Section

  • Document Properties Section

  • Events Section

  • Fill Format Section

  • Fill Gradient Section

  • Foreign Image Info Section

  • Geometry Section

  • Glue Info Section

  • Gradient Properties Section

  • Group Properties Section

  • Hyperlinks Section

  • Image Properties Section

  • Layer Membership Section

  • Layers Section

  • Line Format Section

  • Line Gradient Section

  • Miscellaneous Section

  • Page Layout Section

  • Page Properties Section

  • Paragraph Section

  • Print Properties Section

  • Protection Section

  • Quick Style Section

  • Reviewer Section

  • Ruler & Grid Section

  • Scratch Section

  • Shape Data Section

  • Shape Layout Section

  • Shape Transform Section

  • Style Properties Section

  • Tabs Section

  • Text Block Format Section

  • Text Fields Section

  • Text Transform Section

  • Theme Properties Section

  • User-defined Cells Section


1-D Endpoints Section

 Copy code hover
[image]

1-D Endpoints Section
Send feedback

Published: July 16, 2012

Contains x- and y-coordinates of the begin point and endpoint of a 1-D shape. This section appears for 1-D shapes only.


3-D Rotation Properties Section

 Copy code hover
[image]

3-D Rotation Properties Section
Send feedback

Published: July 16, 2012

Shows the current values of a shape's angle of rotation along the x-, y-, and z-axes.

Note Note

The 3-D Rotation Properties section does not include cells that control shape bevel effects. To set a bevel effect, change the values of the cells in the Bevel Properties section.

Remarks

You can change the 3-D rotation values in the Format Shape dialog box (Home > Shape Styles > Effects > 3-D Rotation or by making a change to one of the cells in the 3-D Rotation Properties section.


Action Tag Section

 Copy code hover
[image]

Action Tag Section
Send feedback

Published: July 16, 2012

Contains a row for each action tag defined for a shape or page.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

The Action Tag section controls the appearance and position of action tags in the drawing. Using the TagName cell, you can associate each action tag with a row or rows in the Actions section, where menu items that appear on an action tag menu are defined.

A single shape or page can contain multiple action tags.

If an action tag has no matching actions, the action tag button appears and disappears as defined, but its menu is blank.

You can only insert an Action Tag section in the ShapeSheet window (right-click in the ShapeSheet window, click Insert Section, and then select the Action tags check box). To add an action tag to an existing Action Tag section, right-click a row, and then click Insert Row on the shortcut menu.


Actions Section

 Copy code hover
[image]

Actions Section
Send feedback

Published: July 16, 2012

Contains rows that describe menu items on a shortcut or action tag menu of a shape or page. In previous versions of Microsoft Visio, action tags are called smart tags.The TagName cell is used to associate an action with a row in the Action Tag section, where action tags are defined.

Note Note

In previous versions of Microsoft Visio, action tags are called smart tags.

Remarks

The TagName cell is used to associate an action with a row in the Action Tag section, where action tags are defined.


Additional Effect Properties Section

 Copy code hover
[image]

Additional Effect Properties Section
Send feedback

Published: July 16, 2012

Shows the additional effects applied to the shape, including reflection, glow, and soft edges effects. This section also included the values for a Sketch effect.

Remarks

You can set the reflection, glow, and soft edges effects in the Format Shape dialog box (Home > Shape Styles > Effects). A Sketch effect can be applied to a shape by using one of the sketch themes (Design > Themes > Effects) or by making changes to values in the corresponding ShapeSheet cells.


Alignment Section

 Copy code hover
[image]

Alignment Section
Send feedback

Published: July 16, 2012

Indicates the alignment of a shape with respect to the guide or guide point to which the shape is glued. The Alignment section appears only for shapes that are glued to guides.


Annotation Section

 Copy code hover
[image]

Annotation Section
Send feedback

Published: July 16, 2012

Contains information about comments inserted into a document page.

Note Note

This section is used for tracking comments only when opening a .vsd file in Microsoft Visio 2013 or when saving a .vsdx file in the .vsd file format. It is not used for tracking comments in new .vsdx documents in Visio 2013.

Remarks

The Annotation section of a page's ShapeSheet contains one row for each comment added to a page in the drawing, whether it is an original drawing page or a markup overlay page (a page containing markup that has been added to the drawing by a reviewer). Information about markup that has been added using ink or other shapes, rather than comments, is not included in the Annotation section.

To view the ShapeSheet for a page, make sure nothing is selected on the page, right-click the page, and click Show ShapeSheet.

For information about particular reviewers, see the Reviewer section in the document's ShapeSheet.


Bevel Properties Section

 Copy code hover
[image]

Bevel Properties Section
Send feedback

Published: July 16, 2012

Shows the attributes for any bevel effects applied to the shape.

Remarks

You can apply a bevel to a shape in the Format Shape pane (Home > Shape Styles > Bevel > 3-D Options, or by making changes to the cells in the Bevel Properties section of the ShapeSheet.


Change Shape Behavior Section

 Copy code hover
[image]

Change Shape Behavior Section
Send feedback

Published: July 16, 2012

Determines the properties that are transferred from the old shape to the replacement shape during a replacement operation. The values of the cells in the Change Shape Behavior section of the Master shape of the replacement are read during the shape replacement operation.

Remarks

By setting the cells in the Change Shape Behavior section, you can ensure that certain properties of the replacement shape remain unchanged during the replacement operation. Properties that are not protected are updated with the local shape values from the old shape during the operation.

You can change the replacement behavior settings of a Master shape by editing the Master shape (in the Shapes window, right-click the shape, point to Edit Master, and then click Edit Master Shape) and changing the values of the ReplaceCopyCells, ReplaceLockFormat, ReplaceLockShapeData, and ReplaceLockText cells in the Master's ShapeSheet.

Note Note

You cannot change the shape replacement behaviors of the shapes that are included with the built-in stencils in Microsoft Visio 2013. To modify the shape replacement behaviors of the built-in Visio shapes, create a new stencil and add the shape that you want to modify to the new stencil.


Character Section

 Copy code hover
[image]

Character Section
Send feedback

Published: July 16, 2012

Shows the formatting attributes for the shape's text, such as font, color, text style, case, position relative to the baseline, and point size.

Remarks

Each character style in a shape has a corresponding row in the Character section as viewed in the ShapeSheet window. The name of the row represents the number of characters the character style applies to.

You can set text formats in the Text dialog box (click the dialog box launcher in the Font group on the Home tab), by applying a text style, or by making an entry in a Character section cell.


Connection Points Section

 Copy code hover
[image]

Connection Points Section
Send feedback

Contains a row and cells for each connection point defined for the shape.

Remarks

You can define connection points in the Connection Points section in the ShapeSheet window or by clicking the Connection Point tool on the Home tab.

If your shape has no Connection Points section you can insert a Connection Points section in the ShapeSheet window. Right-click in the ShapeSheet window, click Insert Section, and then click Connection points. To add connection points to an existing Connection Points section, right-click a row and click Insert Row on the shortcut menu.

You can change the row type of a connection point in this section to display additional cells that you can use for scratch calculations. To do this, right-click the row, and then click Change Row Type on the shortcut menu.


Controls Section

 Copy code hover
[image]

Controls Section
Send feedback

Published: July 16, 2012

Contains a row and cells for each control handle defined for the shape.

Remarks

You can define control handles in the Controls section in the ShapeSheet window. If your shape has no Controls section, you can insert one in the ShapeSheet window. Right-click in the ShapeSheet window, click Insert Section, and then select the Controls check box. To add control handles to an existing Controls section, right-click a row and click Insert Row on the shortcut menu.


Document Properties Section

 Copy code hover
[image]

Document Properties Section
Send feedback

Published: July 16, 2012

Contains cells for a document that control preview quality, scope, and output format.

Remarks

You can also set these values by using the Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties).


Events Section

 Copy code hover
[image]

Events Section
Send feedback

Published: July 16, 2012

Contains formulas that control shape events. Event cells are evaluated only when the event occurs, not upon formula entry.


Fill Format Section

 Copy code hover
[image]

Fill Format Section
Send feedback

Published: July 16, 2012

Shows the current fill formatting attributes for the shape and the shape's drop shadow, including pattern, foreground color, and background color.

Remarks

You can set fill formats in the Format Shape pane (on the Home tab, in the Shape Styles group, click Fill, and then click Fill Options), by applying a fill style, or by making an entry in a cell in the Fill Format section.


Fill Gradient Section

 Copy code hover
[image]

Fill Gradient Section
Send feedback

Published: July 16, 2012

Shows the color values for the fill gradient applied to the shape.

Remarks

Each Gradient Stop Row (Fill Gradient Section) row in the section represents a gradient stop in the fill. This section can be empty.

Only the first 10 rows contained in the section are used by the gradient settings. All Gradient Stop rows beyond 10 are ignored.

You can set the fill gradient properties in the Format Shape pane (on the Home tab, in the Shape Styles group, click Fill, and then click Fill Options).

You can enable or disable a gradient fill for the shape by changing the value of the FillGradientEnabled Cell (Gradient Properties Section) cell.


Foreign Image Info Section

 Copy code hover
[image]

Foreign Image Info Section
Send feedback

Published: July 16, 2012

Contains the width and height of an object from another program used in a Microsoft Visio drawing and appears in the ShapeSheet window only for such objects. It also indicates the distance the object's image is offset within its borders.

Remarks

In versions of Visio products earlier than version 2000, this section was named Image Info.


Geometry Section

 Copy code hover
[image]

Geometry Section
Send feedback

Published: July 16, 2012

Contains rows that list the coordinates of the vertices for the lines and arcs that make up the shape.

The geometry of a shape can be expressed in multiple Geometry sections. Multiple paths can be useful when multiple paths have different properties (e.g. image clipping paths).

Remarks

The Geometry section contains the following row types. For details, see the row topics.

Row | Description
MoveTo | Move to a coordinate.
LineTo | Draw a line to a coordinate.
ArcTo | Draw a circular arc to a coordinate.
EllipticalArcTo | Draw an elliptical arc to a coordinate.
PolylineTo | Draw a polyline, or consecutive lines, to a coordinate.
NURBSTo | Draw a non-uniform rational B-spline (NURBS) to a coordinate.
SplineStart | Start a spline.
SplineKnot | Draw a spline segment to a knot coordinate.
InfiniteLine | Draw an infinite line from one coordinate to another.
Ellipse | Draw an ellipse from a center coordinate and a major/minor axis.
RelCubBezTo | Draw a cubic Bezier curve relative to the width and height of the shape.
RelEllipticalArcTo | Draw an elliptical arc to a coordinate relative to the height and width of the shape.
RelLineTo | Draw a line to a coordinate relative the height and width of a shape.
RelMoveTo | Move to a coordinate relative to the width and height of the shape.
RelQuadBezTo | Draws a quadratic Bezier curve relative to the width and height of the shape.

To change a row type in this section, right-click the row, and then click Change Row Type on the shortcut menu.


Glue Info Section

 Copy code hover
[image]

Glue Info Section
Send feedback

Published: July 16, 2012

Contains formulas generated for a 1-D shape when the 1-D shape is glued to other shapes.


Gradient Properties Section

 Copy code hover
[image]

Gradient Properties Section
Send feedback

Published: July 16, 2012

Shows the properties for any gradient fill or line color effects applied to the shape. This section also includes cells that control whether a shape's gradient rotates with the shape or whether the shape assumes an applied gradient when grouped with other shapes.

Remarks

You can set gradient settings in the Format Shape dialog box (Home > Shape Styles > Fill > Fill Options > Fill > Gradient fill).


Group Properties Section

 Copy code hover
[image]

Group Properties Section
Send feedback

Published: July 16, 2012

Contains cells for a group that control how you add shapes to a group, move members of a group, and select groups.

Remarks

You can also set these values on the Behavior tab in the Behavior dialog box (click Behavior in the Shape Design group on the Developer tab).


Hyperlinks Section

 Copy code hover
[image]

Hyperlinks Section
Send feedback

Published: July 16, 2012

Contains cells for creating multiple jumps between a shape or drawing page and another drawing page, another file, or a Web site.

Remarks

To define a hyperlink, enter values in the cells of this section, or use the Hyperlinks dialog box (click Hyperlink on the Insert tab).

You can add the Hyperlinks section to a shape, group, page, or foreign object in a ShapeSheet window.


Image Properties Section

 Copy code hover
[image]

Image Properties Section
Send feedback

Published: July 16, 2012

Contains the gamma, brightness, contrast, blur, sharpen, and denoise values for bitmaps (an image that consists of pixels) and appears in the ShapeSheet window only for such objects.


Layer Membership Section

 Copy code hover
[image]

Layer Membership Section
Send feedback

Published: July 16, 2012

Contains one row that lists each layer to which the shape is assigned.

Remarks

The layer assignment is shown as an index to the list of layers on the page. The layer index corresponds to the order of the layers in the Layer Properties dialog box (on the Home tab, in the Editing group, click Layers, and then click Layer Properties). The first name in the dialog box is layer 0, the second is layer 1, and so forth.

If a shape is assigned to more than one layer, each layer index appears in the Layer Membership cell separated by a semicolon.

To refer to the value of the Layer Membership cell in a formula, use the name LayerMember.


Layers Section

 Copy code hover
[image]

Layers Section
Send feedback

Published: July 16, 2012

Shows all layers defined for the page and the properties set for each layer.

Remarks

This section is a page property that can be viewed only in the ShapeSheet window for a page. Its cells correspond to the options in the Layer Properties dialog box (on the Home tab, in the Editing group, click Layers, and then click Layer Properties).


Line Format Section

 Copy code hover
[image]

Line Format Section
Send feedback

Published: July 16, 2012

Contains cells that control line attributes for a shape, such as pattern, weight, and color. They determine whether the line ends are formatted (for example, with an arrowhead), the size of line end formats, radius of the rounding circle applied to the line, and line cap style (round or square).

Remarks

You can set line formats by using the Format Shape pane (on the Home tab, in the Shape Styles group, click Line, click Line Options), by applying a line style, or by entering a formula in a Line Format cell.


Line Gradient Section

 Copy code hover
[image]

Line Gradient Section
Send feedback

Published: July 16, 2012

Shows the color values for the line gradient applied to the shape.

Remarks

Each Gradient Stop Row (Line Gradient Section) row in the section represents a gradient stop in the line. This section can be empty.

Only the first 10 rows contained in the section are used by the gradient settings. All Gradient Stop rows beyond 10 are ignored.

You can set the line gradient properties in the Line section of the Format Shape pane (on the Home tab, in the Shape Styles group, click Line, and then click Line Options).

You can enable or disable a gradient line color for the shape by changing the value of the LineGradientEnabled Cell (Gradient Properties Section) cell.


Miscellaneous Section

 Copy code hover
[image]

Miscellaneous Section
Send feedback

Published: July 16, 2012

Contains various attributes of shapes and groups, such as control selection highlighting and visibility.

Remarks

You can set the value of many of the cells in this section in the ShapeSheet window, or on the Behavior tab in the Behavior dialog box (click Behavior in the Shape Design group on the Developer tab). in the drawing window. You can set other group properties using cells in the Group Properties section.

In Visio version 5.0 products, this section included ObjInteract and ObjBehavior cells. The behavior in the ObjInteract cell is now mapped to the following cells in the Shape Layout section: ShapeFixedCode, ShapePermeableX, ShapePermeableY, and ShapePermeablePlace. The behavior in the ObjBehavior cell is now mapped to the ConFixedCode and ShapeRouteStyle cells.

In Visio version 5.0 Japanese products, this section included a VerticalText cell. In Visio version 2000 products and later, the value of this cell is stored in the TextDirection cell in the Text Block Format section.


Page Layout Section

 Copy code hover
[image]

Page Layout Section
Send feedback

Published: July 16, 2012

Contains cells that control the page settings for shapes and connectors, such as the spacing between all shapes on the page, spacing between all connectors on the page, and routing style for all connectors on the page.

Remarks

To override the page defaults for a specific shape, use the cells in the Shape Layout section.

You can also set the values of the cells in this section on the Layout and Routing tab in the Page Setup dialog box (on the Design tab, click the dialog box launcher in the Page Setup group).


Page Properties Section

 Copy code hover
[image]

Page Properties Section
Send feedback

Published: July 16, 2012

Contains cells that control page attributes, such as the page width, height, and scale.

Remarks

You can set the values of page properties by making an entry in the Page Properties section cell, or by using the Page Setup dialog box (on the Design tab, click the dialog box launcher in the Page Setup group).


Paragraph Section

 Copy code hover
[image]

Paragraph Section
Send feedback

Published: July 16, 2012

Shows the paragraph formatting attributes for the shape's text, such as indents, line spacing, bullets, and horizontal alignment of paragraphs.

Remarks

Paragraph formats can be set by making an entry in a Paragraph section cell by applying a text style, or by entering values in the Text dialog box (on the Home tab, click the dialog box launcher in the Font group).

The Paragraph section does not include cells for tab settings. To set tabs for a shape's text, use the Text dialog box.


Print Properties Section

 Copy code hover
[image]

Print Properties Section
Send feedback

Published: July 16, 2012

Contains the cells that control how the drawing page is formatted (appears) on the printer page.

Remarks

Use the Print Properties section to control printing at the page level. These settings are per page and are independent of the drawing page settings, for example, a drawing page that uses landscape orientation can be printed using portrait orientation. Also, documents can be printed using a combination of orientations.

The settings in the Print Properties section correspond to the values set on the Print Setup tab in the Page Setup dialog box (on the Design tab, click the dialog box launcher in the Page Setup group). See the Page Properties section for settings that apply to the drawing page.


Protection Section

 Copy code hover
[image]

Protection Section
Send feedback

Published: July 16, 2012

Shows the current lock settings set with the Protection command (Developer tab) plus a few additional locks that can be set only in a ShapeSheet window.

Remarks

Locking helps prevent inadvertent changes to the shape but does not prevent values from being reset in other circumstances. It also does not protect against changes made in the ShapeSheet window.

To protect a formula from being changed, use the GUARD function.


Quick Style Section

 Copy code hover
[image]

Quick Style Section
Send feedback

Published: July 16, 2012

Shows the current Quick Style formatting values applied to the shape, including line color and style, fill color and style, shadow color, effects, font, and style type.

Remarks

You can Quick Style selecting the shape and then selecting a new Quick Style (on the Home tab, in the Shape Styles group, click More, and then select another Quick Style from the gallery).


Reviewer Section

 Copy code hover
[image]

Reviewer Section
Send feedback

Published: July 16, 2012

Contains identifying information about each document reviewer.

Remarks

The reviewer section contains one row for each reviewer who has added markup to the document, even if all of a particular reviewer's markup is deleted.

The reviewer section is contained in the ShapeSheet of a document. To view a document's ShapeSheet, on the Developer tab, in the Show/Hide group, select Drawing Explorer, right-click the document name, and then click Show ShapeSheet.

For more information about comments that are added to a document as a part of markup, see the Annotation section.


Ruler & Grid Section

 Copy code hover
[image]

Ruler & Grid Section
Send feedback

Shows the current settings of the page's rulers and grid.

Remarks

This section is a page property that can be viewed only in the ShapeSheet window for a page. The cells it contains correspond to the settings in the Ruler & Grid dialog box (on the View tab, in the Show/Hide group, click the dialog box launcher).


Scratch Section

 Copy code hover
[image]

Scratch Section
Send feedback

Published: July 16, 2012

A work area for entering and testing formulas that can be referred to by other cells.

Remarks

You can add this section by using the Insert Section dialog box. Right-click in the ShapeSheet window, and then click Insert Section.

The Scratch section is typically used to isolate repeated complex calculations. If your solution has a well-defined purpose, it's wiser to use a cell in the User-Defined Cells section for clarity because User cells can be named.

Cells in the Scratch section use units in two different ways. X and Y cells use drawing units; A through D cells don't use units. (In C programmers' jargon, X and Y cells are "typed," and cells A through D are "void.") The Scratch X and Scratch Y cells are often used for deriving x- and y-coordinates, such as PinX and PinY, or the X and Y cells found in a Geometry section cell. Scratch cells A through D can display whatever units you specify.

A further difference is the way these cells store point values. A point in Visio is a single data package for an (x,y) coordinate. When a formula returns a point value, that value is interpreted in one of three ways, depending on the ShapeSheet cell the formula is in. Cells that relate to x-coordinates (for example, PinX, or cells in the X column of a Geometry section) extract just the x-coordinate part of a point value. Cells that relate to y-coordinates extract just the y-coordinate part of a point value.

For example, Visio extracts the formula PNT(3,4) in these three ways.

Cell | If you enter | Visio treats it as | Result
X | PNT(3,4) | PNTX(PNT(3,4)) | 3.0000 in.
Y | PNT(3,4) | PNTY(PNT(3,4)) | 4.0000 in.
A-D | PNT(3,4) | PNT(3,4) | PNT(3.0000 in., 4.0000 in.)


Shape Data Section

 Copy code hover
[image]

Shape Data Section
Send feedback

Published: July 16, 2012

Contains one row for each item of shape data and cells for associating data with a shape.

Remarks

Shape Data can be defined by using the Shape Data window or the cells in the Shape Data section.

Note Note

In previous versions of Visio, the Shape Data section was called Custom Properties.

  • In the ShapeSheet window, you can define shape data in the Shape Data section. Right-click in the ShapeSheet window and click Insert Section, and then select the Shape Data check box. You can add as many Prop.name rows as you need, assign meaningful names to the rows, and set cell values.

  • In the drawing window, you can define shape data in the Shape Data window. On the View tab, in the Show/Hide group, click Task Panes, and then click Shape Data. To access the Define Shape Data dialog box, right-click the Shape Data window, and then click Define Shape Data.


Shape Layout Section

 Copy code hover
[image]

Shape Layout Section
Send feedback

Published: July 16, 2012

Contains cells that control shape placement and connector routing settings.

Remarks

You can also set the values of the shape-specific cells in this section by using the Placement tab in the Behavior dialog box (on the Developer tab, in the Shape Design group, click Behavior). You can set the values of the connector-specific cells in this section using the Connector tab in the Behavior dialog box. (To see the Connector tab, select the connector in the drawing window, and then display the Behavior dialog box.)

You can use values in the Shape Layout section to override default values contained in the Page Layout section.


Shape Transform Section

 Copy code hover
[image]

Shape Transform Section
Send feedback

Published: July 16, 2012

Contains general positioning information about a shape: for example, its width, height, angle, and center of rotation (pin); whether the shape has been flipped; and how the shape should behave when resized within a group.


Style Properties Section

 Copy code hover
[image]

Style Properties Section
Send feedback

Published: July 16, 2012

Includes cells that control style behavior, such as whether a style includes text, line, and fill attributes.


Tabs Section

 Copy code hover
[image]

Tabs Section
Send feedback

Published: July 16, 2012

Contains cells for shapes or styles that control tab stop position and alignment.

Remarks

You can also set these values by using the Tabs tab in the Text dialog box (click dialog box launcher in the Font group on the Home tab) or by using the Text Ruler. To display the Text Ruler, right-click the text while in text-editing mode, and then click Text Ruler on the shortcut menu.

You can set tab stops for specific characters by selecting the text, and then setting the tab stop. When you set tab stops for specific characters, a new row is added in the ShapeSheet window. The name of the row represents the number of characters the tab stop contains.


Text Block Format Section

 Copy code hover
[image]

Text Block Format Section
Send feedback

Published: July 16, 2012

Contains cells that control the alignment, margins, and default tab stop position of text in a shape's text block.

Remarks

You can also set these text attributes by using the Text dialog box (on the Home tab, click the dialog box launcher in the Font group).


Text Fields Section

 Copy code hover
[image]

Text Fields Section
Send feedback

Published: July 16, 2012

Displays functions and formulas inserted in the shape's text by using the Field dialog box.

Remarks

The only way to add this section is to insert a field into a shape by using the Field dialog box (Insert tab).

Each text field in a text block has a corresponding row in the ShapeSheet window. The name of the row represents the number of characters the field contains.


Text Transform Section

 Copy code hover
[image]

Text Transform Section
Send feedback

Published: July 16, 2012

Contains positioning information about a shape's text block.

Remarks

To add this section, use the Insert Section dialog box (right-click in the ShapeSheet window and click Insert Section). Setting values in the Text Transform section is comparable to working with the text block by using the Text Block tool (the Tools group on the Home tab).


Theme Properties Section

 Copy code hover
[image]

Theme Properties Section
Send feedback

Published: July 16, 2012

Shows the index values of the theme currently applied to the document, including color, font, connector, and effects values.

Remarks

You can set theme values on the Design tab or by making changes in the cells in the Theme Properties section of the ShapeSheet.


User-defined Cells Section

 Copy code hover
[image]

User-defined Cells Section
Send feedback

Published: July 16, 2012

A work area for entering formulas in user-specific cells that can be referred to by other cells and add-on tools.

Remarks

Like the Scratch section, the User-defined Cells section can be used by your solution in many different ways. The advantage of the User-defined Cells section is that cells can be named; cells in the Scratch section cannot be named.

If your solution has a well-defined purpose it is suggested that you use cells in the User-defined Cells section for clarity because User cells can be named. The Scratch section is typically used to isolate repeated complex calculations.

To add this section, use the Insert Section dialog box (right-click in the ShapeSheet window and click Insert Section).


Office 2013 documentation copyright notice

 Copy code hover
[image]

Office 2013 documentation copyright notice
Send feedback

Published: July 16, 2012

This document is provided "as-is". Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it.

Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred.

This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes.

© 2013 Microsoft Corporation. All rights reserved.

Microsoft, Access, ActiveX, ClearType, Excel, FrontPage, InfoPath, IntelliSense, JScript, MSDN, MS-DOS, MSN, OneNote, Outlook, PowerPoint, SharePoint, Silverlight, SmartArt, SQL Server, Visio, Visual Basic, Visual C#, Visual C++, Visual Studio, Win32, Windows, Windows PowerShell, Windows Server, and Windows Vista are trademarks of the Microsoft group of companies.

All other trademarks are property of their respective owners.